Compare commits

..

4 commits

Author SHA1 Message Date
philipmi
327504b131 Merge branch 'master' of https://github.com/MT-CTF/capturetheflag 2021-03-16 20:15:20 +01:00
David Leal
1ef6ddadfd
Fix changing to the same class being treated as a change to a different class (#829)
* Fix running cooldown when changing...

...to the same class.

* Implement savilli's suggestion

Co-authored-by: savilli <savilli@users.noreply.github.com>

* Move return and remove unneeded check

* Completely remove an if check as now unneeded

* Remove whitespace from empty line

Co-authored-by: savilli <savilli@users.noreply.github.com>
Co-authored-by: LoneWolfHT <lonewolf04361@gmail.com>
2021-03-15 20:08:01 -07:00
LoneWolfHT
844436ca3d
Fix crash with shooter_hook 2021-03-15 08:30:54 -07:00
LoneWolfHT
0ed4cadb7c
Add missing priv check to /join cmd 2021-03-15 08:25:14 -07:00
3 changed files with 13 additions and 5 deletions

View file

@ -183,6 +183,7 @@ minetest.register_chatcommand("team", {
minetest.register_chatcommand("join", { minetest.register_chatcommand("join", {
params = "team name", params = "team name",
description = "Add to team", description = "Add to team",
privs = {ctf_team_mgr = true},
func = function(name, param) func = function(name, param)
if ctf.join(name, param, false, name) then if ctf.join(name, param, false, name) then
return true, "Joined team " .. param .. "!" return true, "Joined team " .. param .. "!"

View file

@ -73,17 +73,19 @@ function ctf_classes.set(player, new_name)
local meta = player:get_meta() local meta = player:get_meta()
local old_name = meta:get("ctf_classes:class") local old_name = meta:get("ctf_classes:class")
if old_name == new_name then
return
end
meta:set_string("ctf_classes:class", new_name) meta:set_string("ctf_classes:class", new_name)
ctf_classes.update(player) ctf_classes.update(player)
ctf_classes.set_cooldown(player:get_player_name()) ctf_classes.set_cooldown(player:get_player_name())
if old_name == nil or old_name ~= new_name then
local old = old_name and ctf_classes.__classes[old_name] local old = old_name and ctf_classes.__classes[old_name]
for i=1, #registered_on_changed do for i=1, #registered_on_changed do
registered_on_changed[i](player, old, new) registered_on_changed[i](player, old, new)
end end
end
end end
local function set_max_hp(player, max_hp) local function set_max_hp(player, max_hp)

View file

@ -73,6 +73,11 @@ check_grapple("shooter_hook:grapple_hook")
-- Override grappling hook entity to check if player has flag before teleporting -- Override grappling hook entity to check if player has flag before teleporting
local old_grapple_step = minetest.registered_entities["shooter_hook:hook"].on_step local old_grapple_step = minetest.registered_entities["shooter_hook:hook"].on_step
minetest.registered_entities["shooter_hook:hook"].on_step = function(self, dtime, ...) minetest.registered_entities["shooter_hook:hook"].on_step = function(self, dtime, ...)
-- User left the game. Life is no longer worth living for this poor hook
if not self.user then
self.object:remove()
end
-- Remove entity if player has flag -- Remove entity if player has flag
-- This is to prevent players from firing the hook, and then punching the flag -- This is to prevent players from firing the hook, and then punching the flag
if ctf_flag.has_flag(self.user) then if ctf_flag.has_flag(self.user) then