aboutsummaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-06-01 20:51:15 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-06-03 22:31:01 +0300
commitd7447cdf9e4df3c345218886ab2bae0e0cc4fc55 (patch)
tree4ebc1c2fd91d66f8711ed87013af80a4adf53cc0 /games
parentff8d2bbc3682b12d40d1dfb212d39a50c498fb93 (diff)
downloadminetest-d7447cdf9e4df3c345218886ab2bae0e0cc4fc55.tar.gz
minetest-d7447cdf9e4df3c345218886ab2bae0e0cc4fc55.tar.bz2
minetest-d7447cdf9e4df3c345218886ab2bae0e0cc4fc55.zip
Implement sign using form field protocol
Diffstat (limited to 'games')
-rw-r--r--games/minimal/mods/default/init.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/games/minimal/mods/default/init.lua b/games/minimal/mods/default/init.lua
index 9573db119..603380d5b 100644
--- a/games/minimal/mods/default/init.lua
+++ b/games/minimal/mods/default/init.lua
@@ -1116,7 +1116,16 @@ minetest.register_node("default:sign_wall", {
--local n = minetest.env:get_node(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", "hack:sign_text_input")
- meta:set_string("infotext", "\"${text}\"")
+ meta:set_string("infotext", "\"\"")
+ end,
+ on_receive_fields = function(pos, formname, fields, sender)
+ --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields))
+ local meta = minetest.env:get_meta(pos)
+ fields.text = fields.text or ""
+ print((sender:get_player_name() or "").." wrote \""..fields.text..
+ "\" to sign at "..minetest.pos_to_string(pos))
+ meta:set_string("text", fields.text)
+ meta:set_string("infotext", '"'..fields.text..'"')
end,
})