Longer build time, more cobble

This commit is contained in:
rubenwardy 2015-12-30 12:53:10 +00:00
parent e0fef5b56a
commit 0a675d5f7c
4 changed files with 14 additions and 6 deletions

View file

@ -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

View file

@ -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}

View file

@ -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"))

View file

@ -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})