Revert the broken and unwanted feature 'quick and hacky way to automatically start matches'

This commit is contained in:
a-bad-dev 2026-01-05 00:56:21 -04:00 committed by GitHub
commit 1755505463
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 53 deletions

View file

@ -119,50 +119,48 @@ function start_match(map) -- Start the match
map_data = place_map(map or "forest") -- default to forest if no map is specified
core.after(3, function() -- add a few seconds to allow the map to be placed fully
assert(loadstring(map_data.scripts.on_start or ""))()
core.chat_send_all(core.colorize("green", string.format("Match about to start in %d seconds!\nOpen inventory to change class!", map_data.start_time)))
assert(loadstring(map_data.scripts.on_start or ""))()
core.chat_send_all(core.colorize("green", string.format("Match about to start in %d seconds!\nOpen inventory to change class!", map_data.start_time)))
for _, player in pairs(core.get_connected_players()) do
set_player_mode(player, "pre_match")
give_player_items(player)
player:set_pos({x = map_data.spawn_x, y = map_data.spawn_y, z = map_data.spawn_z})
player:set_hp(20)
end
for i = 10, 1, -1 do -- count down from 10 to 1 (yes you are free to set me on fire for this horrible solution)
core.after(map_data.start_time - 10 + i, function()
core.chat_send_all(core.colorize("green", string.format("Match starts in %d second%s.", 11 - i, 11 - i == 1 and "" or "s"))) -- <- RIP readability
end)
end
core.after(map_data.start_time, function()
set_match_state("in_progress")
core.chat_send_all(core.colorize("green", "Match started!"))
remove_barrier(map_data.size_x, map_data.barrier_level, map_data.size_z)
alive_players = {}
for _, player in pairs(core.get_connected_players()) do
set_player_mode(player, "pre_match")
local player_name = player:get_player_name()
inv = player:get_inventory()
inv:set_list("main", {})
give_player_items(player)
player:set_pos({x = map_data.spawn_x, y = map_data.spawn_y, z = map_data.spawn_z})
player:set_properties({
pointable = true, -- allow players to be killable after the match starts
})
alive_players[player_name] = "alive"
player:set_hp(20)
set_player_mode(player, "normal")
end
for i = 10, 1, -1 do -- count down from 10 to 1 (yes you are free to set me on fire for this horrible solution)
core.after(map_data.start_time - 10 + i, function()
core.chat_send_all(core.colorize("green", string.format("Match starts in %d second%s.", 11 - i, 11 - i == 1 and "" or "s"))) -- <- RIP readability
end)
end
core.after(map_data.start_time, function()
set_match_state("in_progress")
core.chat_send_all(core.colorize("green", "Match started!"))
remove_barrier(map_data.size_x, map_data.barrier_level, map_data.size_z)
alive_players = {}
for _, player in pairs(core.get_connected_players()) do
local player_name = player:get_player_name()
inv = player:get_inventory()
inv:set_list("main", {})
give_player_items(player)
player:set_properties({
pointable = true, -- allow players to be killable after the match starts
})
alive_players[player_name] = "alive"
set_player_mode(player, "normal")
end
end)
end)
end