forked from mtcontrib/homedecor_modpack
keyword --> current_keyword
This commit is contained in:
parent
f0a846b200
commit
a79c752c40
@ -11,7 +11,7 @@
|
|||||||
-- }
|
-- }
|
||||||
|
|
||||||
-- CWz's keyword interact mod uses this setting.
|
-- CWz's keyword interact mod uses this setting.
|
||||||
local keyword = minetest.setting_get("interact_keyword") or "iaccept"
|
local current_keyword = minetest.setting_get("interact_keyword") or "iaccept"
|
||||||
|
|
||||||
signs_lib = {}
|
signs_lib = {}
|
||||||
screwdriver = screwdriver or {}
|
screwdriver = screwdriver or {}
|
||||||
@ -367,7 +367,7 @@ end
|
|||||||
|
|
||||||
local function split_lines_and_words(text)
|
local function split_lines_and_words(text)
|
||||||
if not text then return end
|
if not text then return end
|
||||||
text = string.gsub(text, "@KEYWORD", keyword)
|
text = string.gsub(text, "@KEYWORD", current_keyword)
|
||||||
local lines = { }
|
local lines = { }
|
||||||
for _, line in ipairs(text:split("\n")) do
|
for _, line in ipairs(text:split("\n")) do
|
||||||
table.insert(lines, line:split(" "))
|
table.insert(lines, line:split(" "))
|
||||||
@ -539,19 +539,19 @@ signs_lib.update_sign = function(pos, fields, owner)
|
|||||||
|
|
||||||
if fields then -- ...we're editing the sign.
|
if fields then -- ...we're editing the sign.
|
||||||
if fields.text and string.find(dump(fields.text), "@KEYWORD") then
|
if fields.text and string.find(dump(fields.text), "@KEYWORD") then
|
||||||
meta:set_string("keyword", keyword)
|
meta:set_string("keyword", current_keyword)
|
||||||
else
|
else
|
||||||
meta:set_string("keyword", nil)
|
meta:set_string("keyword", nil)
|
||||||
end
|
end
|
||||||
elseif string.find(dump(stored_text), "@KEYWORD") then -- we need to check if the password is being set/changed
|
elseif string.find(dump(stored_text), "@KEYWORD") then -- we need to check if the password is being set/changed
|
||||||
|
|
||||||
local stored_keyword = meta:get_string("keyword")
|
local stored_keyword = meta:get_string("keyword")
|
||||||
if stored_keyword and stored_keyword ~= "" and stored_keyword ~= keyword then
|
if stored_keyword and stored_keyword ~= "" and stored_keyword ~= current_keyword then
|
||||||
signs_lib.destruct_sign(pos)
|
signs_lib.destruct_sign(pos)
|
||||||
meta:set_string("keyword", keyword)
|
meta:set_string("keyword", current_keyword)
|
||||||
local ownstr = ""
|
local ownstr = ""
|
||||||
if owner then ownstr = "Locked sign, owned by "..owner.."\n" end
|
if owner then ownstr = "Locked sign, owned by "..owner.."\n" end
|
||||||
meta:set_string("infotext", ownstr..string.gsub(make_infotext(stored_text), "@KEYWORD", keyword).." ")
|
meta:set_string("infotext", ownstr..string.gsub(make_infotext(stored_text), "@KEYWORD", current_keyword).." ")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -564,7 +564,7 @@ signs_lib.update_sign = function(pos, fields, owner)
|
|||||||
local ownstr = ""
|
local ownstr = ""
|
||||||
if owner then ownstr = "Locked sign, owned by "..owner.."\n" end
|
if owner then ownstr = "Locked sign, owned by "..owner.."\n" end
|
||||||
|
|
||||||
meta:set_string("infotext", ownstr..string.gsub(make_infotext(fields.text), "@KEYWORD", keyword).." ")
|
meta:set_string("infotext", ownstr..string.gsub(make_infotext(fields.text), "@KEYWORD", current_keyword).." ")
|
||||||
meta:set_string("text", fields.text)
|
meta:set_string("text", fields.text)
|
||||||
|
|
||||||
meta:set_int("__signslib_new_format", 1)
|
meta:set_int("__signslib_new_format", 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user