From 512211ca0d2712dd14b220bdaab43c85383d5395 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 26 Jan 2018 18:33:02 +0000 Subject: [PATCH] Add support for map hints --- mods/ctf_map/schem_map.lua | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/mods/ctf_map/schem_map.lua b/mods/ctf_map/schem_map.lua index b7951ec..1d37dbb 100644 --- a/mods/ctf_map/schem_map.lua +++ b/mods/ctf_map/schem_map.lua @@ -65,7 +65,11 @@ function ctf_map.place_map(map) end minetest.after(2, function() - minetest.chat_send_all("Map: " .. map.name .. " by " .. map.author) + local msg = "Map: " .. map.name .. " by " .. map.author + if map.hint then + msg = msg .. "\n" .. map.hint + end + minetest.chat_send_all(msg) end) minetest.after(10, function() @@ -83,6 +87,7 @@ function ctf_match.load_map_meta(idx, name) idx = idx, name = meta:get("name"), author = meta:get("author"), + hint = meta:get("hint"), rotation = meta:get("rotation"), schematic = name .. ".mts", r = tonumber(meta:get("r")), @@ -184,3 +189,16 @@ function ctf_match.create_teams() end end end + +minetest.register_on_joinplayer(function(player) + local map = ctf_map.map + if not map then + return + end + + local msg = "Map: " .. map.name .. " by " .. map.author + if map.hint then + msg = msg .. "\n" .. map.hint + end + minetest.chat_send_player(player:get_player_name(), msg) +end)