Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev lp #1896

Closed
wants to merge 4 commits into from
Closed

Dev lp #1896

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions mods/lord/Blocks/lord_mail/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,18 @@ minetest.register_craftitem("lord_mail:paper_with_text", {

local function book_on_use(itemstack, user, pointed_thing)
local player_name = user:get_player_name()
local meta = itemstack:get_metadata()
local data = minetest.deserialize(meta)
local meta = itemstack:get_meta()
local title, text, owner = "", "", player_name
if data then

-- Backwards compatibility
local old_data = minetest.deserialize(itemstack:get_meta():get_string(""))
if old_data then
meta:from_table({ fields = old_data })
end

local data = meta:to_table().fields

if data.owner then
title, text, owner = data.title, data.text, data.owner
meta:set_string("description", SL('Book')..': '..colorize('#ee8' , '"'.. title ..'"'))
end
Expand Down
Loading