Allow more than two teams in a match at once (#724)

* Fix bugs with more than two teams

* Fix team allocation

* Fix bugz

* Fix crash

* Fix crash with crash fix
This commit is contained in:
LoneWolfHT 2020-12-25 10:37:02 -08:00 committed by GitHub
parent 0ef16edb23
commit fbf0126599
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 87 additions and 30 deletions

View file

@ -153,9 +153,12 @@ function _doors.door_toggle(pos, node, clicker)
-- If team door, check clicker's team
if node.name:find("doors:door_steel") then
local tname = ctf.player(clicker:get_player_name()).team
local owner_team = meta:get_string("owner_team")
if clicker and tname ~= owner_team then
return false
if tname == "red" or tname == "blue" then
local owner_team = meta:get_string("owner_team")
if clicker and tname ~= owner_team then
return false
end
end
end
@ -303,6 +306,11 @@ function doors.register(name, def)
-- Get placer's team
local tname = ctf.player(pn).team or ""
if tname ~= "red" and tname ~= "blue" then
minetest.chat_send_player(pn, "Your team can't place doors!")
return itemstack
end
-- Prevent door placement if within 40 nodes of enemy base
local enemy_team = tname == "red" and "blue" or "red"
local enemy_base = ctf_map.map.teams[enemy_team].pos