From 0a675d5f7c52cef98990d84528e5e6b7f023c836 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 30 Dec 2015 12:53:10 +0000 Subject: [PATCH] Longer build time, more cobble --- minetest.conf | 2 +- mods/ctf_match/buildtime.lua | 11 +++++++++-- mods/ctf_team_base/init.lua | 5 +++-- mods/ctf_treasure/init.lua | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/minetest.conf b/minetest.conf index 93d60fd..f4c3767 100644 --- a/minetest.conf +++ b/minetest.conf @@ -28,7 +28,7 @@ ctf.autoalloc_on_joinplayer = true ctf.match = true ctf.match.teams = red, red, -64, 16, 85; blue, blue, 23, 14, -77 -ctf.match.build_time = 120 +ctf.match.build_time = 240 ctf.match.clear_inv = true ctf.match.destroy_team = true ctf.match.reset_on_winner = true diff --git a/mods/ctf_match/buildtime.lua b/mods/ctf_match/buildtime.lua index 1ab0fde..5193387 100644 --- a/mods/ctf_match/buildtime.lua +++ b/mods/ctf_match/buildtime.lua @@ -36,6 +36,13 @@ ctf.register_on_new_game(function() end end) +local function get_m_s_from_s(s) + local m = math.floor(s / 60) + s = math.floor(s - m * 60) + + return m .. "m " .. s .. "s" +end + local last = 0 minetest.register_globalstep(function(delta) if ctf_match.build_timer > 0 then @@ -47,7 +54,7 @@ minetest.register_globalstep(function(delta) end local rbt = math.floor(ctf_match.build_timer) if last ~= rbt then - local text = math.floor(ctf_match.build_timer) .. "s until match begins!" + local text = get_m_s_from_s(ctf_match.build_timer) .. " until match begins!" for _, player in pairs(minetest.get_connected_players()) do ctf.hud:change(player, "ctf_match:countdown", "text", text) end @@ -90,7 +97,7 @@ ctf.hud.register_part(function(player, name, tplayer) hud_elem_type = "text", position = {x = 0.5, y = 0.5}, scale = {x = 0, y = 70}, - text = math.floor(ctf_match.build_timer) .. "s until match begins!", + text = get_m_s_from_s(ctf_match.build_timer) .. " until match begins!", number = 0xFFFFFF, offset = {x = -20, y = 20}, alignment = {x = 0.2, y = 0} diff --git a/mods/ctf_team_base/init.lua b/mods/ctf_team_base/init.lua index b215df9..d7b1131 100644 --- a/mods/ctf_team_base/init.lua +++ b/mods/ctf_team_base/init.lua @@ -43,11 +43,11 @@ for _, color in pairs(colors) do end, on_metadata_inventory_put = function(pos, listname, index, stack, player) minetest.log("action", player:get_player_name() .. - " moves stuff to chest at " .. minetest.pos_to_string(pos)) + " moves " .. (stack:get_name() or "stuff") .. " " .. (stack:get_count() or 0) .. " to chest at " .. minetest.pos_to_string(pos)) end, on_metadata_inventory_take = function(pos, listname, index, stack, player) minetest.log("action", player:get_player_name() .. - " takes stuff from chest at " .. minetest.pos_to_string(pos)) + " takes " .. (stack:get_name() or "stuff") .. " " .. (stack:get_count() or 0) .. " from chest at " .. minetest.pos_to_string(pos)) end }) end @@ -95,6 +95,7 @@ minetest.register_on_generated(function(minp, maxp, seed) minetest.set_node(pos, chest) local inv = minetest.get_inventory({type = "node", pos=pos}) inv:add_item("main", ItemStack("default:cobble 99")) + inv:add_item("main", ItemStack("default:cobble 99")) inv:add_item("main", ItemStack("default:cobble 99")) inv:add_item("main", ItemStack("default:glass 10")) inv:add_item("main", ItemStack("default:torch 10")) diff --git a/mods/ctf_treasure/init.lua b/mods/ctf_treasure/init.lua index 98ce99c..a43dca5 100644 --- a/mods/ctf_treasure/init.lua +++ b/mods/ctf_treasure/init.lua @@ -1,6 +1,6 @@ treasurer.register_treasure("default:ladder",0.3,5,{1,20}) treasurer.register_treasure("default:torch",0.3,5,{1,20}) -treasurer.register_treasure("default:cobble",0.3,5,{45,99}) +treasurer.register_treasure("default:cobble",0.4,5,{45,99}) treasurer.register_treasure("default:apple",0.3,5,{1,8}) treasurer.register_treasure("default:pick_steel",0.5,5,{1,10})