Skip to content

Commit

Permalink
Add a command that prints the current mode and matches played (/mode) (
Browse files Browse the repository at this point in the history
…#1188)

* Initial commit

* Removing line for priv requirement

* Update init.lua

* Update init.lua

---------

Co-authored-by: LoneWolfHT <[email protected]>
  • Loading branch information
src4026 and LoneWolfHT authored Jul 26, 2023
1 parent 72a85d4 commit 42eb6c0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions mods/ctf/ctf_modebase/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,20 @@ end)
minetest.override_chatcommand("pulverize", {
privs = {creative = true},
})

minetest.register_chatcommand("mode", {
description = "Prints the current mode and matches played",
func = function()
local mode = ctf_modebase.current_mode

if not mode then
return false, "The game isn't running"
end

return true, string.format("The current mode is %s. Matches finished: %d/%d",
HumanReadable(ctf_modebase.current_mode),
ctf_modebase.current_mode_matches_played-1,
ctf_modebase.current_mode_matches
)
end
})

0 comments on commit 42eb6c0

Please sign in to comment.