Skip to content

Commit

Permalink
Move code to match.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
src4026 authored Oct 28, 2023
1 parent da8d1cf commit 721894a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 0 additions & 10 deletions mods/ctf/ctf_map/map_functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,6 @@ function ctf_map.place_map(mapmeta, callback)
ctf_map.current_map = mapmeta

callback()

local current_map = ctf_map.current_map
local current_mode = ctf_modebase.current_mode
if table.indexof(current_map.game_modes, current_mode) == -1 then
local concat = "The current mode is not in the list of modes supported by the current map."
local cmd_text = string.format("/ctf_next -f [mode:technical modename] %s", current_map.dirname)
minetest.chat_send_all(minetest.colorize(
"red", string.format("%s\nSupported mode(s): %s. To switch to a mode set for the map, do %s",
concat, table.concat(current_map.game_modes, ", "), cmd_text)))
end
end)
end

Expand Down
11 changes: 11 additions & 0 deletions mods/ctf/ctf_modebase/match.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ function ctf_modebase.start_match_after_vote()
ctf_teams.allocate_teams(ctf_map.current_map.teams)

ctf_modebase.current_mode_matches_played = ctf_modebase.current_mode_matches_played + 1

local current_map = ctf_map.current_map
local current_mode = ctf_modebase.current_mode

if table.indexof(current_map.game_modes, current_mode) == -1 then
local concat = "The current mode is not in the list of modes supported by the current map."
local cmd_text = string.format("/ctf_next -f [mode:technical modename] %s", current_map.dirname)
minetest.chat_send_all(minetest.colorize(
"red", string.format("%s\nSupported mode(s): %s. To switch to a mode set for the map, do %s",
concat, table.concat(current_map.game_modes, ", "), cmd_text)))
end
end)
end

Expand Down

0 comments on commit 721894a

Please sign in to comment.