change now player_speed and player_jump for tagged players too.

Closes #4
This commit is contained in:
debiankaios 2022-10-08 22:04:47 +02:00
parent 35c84d10c5
commit 6f0a34c07b
2 changed files with 16 additions and 10 deletions

10
api.lua
View File

@ -36,16 +36,26 @@ end
-- called when tagged
function tnttag.tagplayer(p_name, arena)
local player = minetest.get_player_by_name(p_name)
arena.players[p_name].tagged = true
tnttag.add_tager(minetest.get_player_by_name(p_name))
tnttag.add_tnthead(p_name)
player:set_physics_override({
speed = tnttag.player_speed_tagged,
jump = tnttag.player_jump_tagged,
})
end
-- called when a player tags another player
function tnttag.untagplayer(p_name, arena)
local player = minetest.get_player_by_name(p_name)
arena.players[p_name].tagged = false
tnttag.remove_tager(minetest.get_player_by_name(p_name))
tnttag.remove_tnthead(p_name)
player:set_physics_override({
speed = tnttag.player_speed,
jump = tnttag.player_jump,
})
end
-- get the get tagstatus

View File

@ -3,14 +3,10 @@ local S = minetest.get_translator("tnttag")
tnttag = {}
tnttag.saved_huds = {}
local player_speed = minetest.settings:get("tnttag.player_speed") or 3
local player_jump = minetest.settings:get("tnttag.player_jump") or 1.2
local player_speed_tagged = minetest.settings:get("tnttag.player_speed_tagged") or 3
local player_jump_tagged = minetest.settings:get("tnttag.player_jump_tagged") or 1.2
minetest.register_on_joinplayer(function(player)
print(player_speed)
end)
tnttag.player_speed = minetest.settings:get("tnttag.player_speed") or 3
tnttag.player_jump = minetest.settings:get("tnttag.player_jump") or 1.2
tnttag.player_speed_tagged = minetest.settings:get("tnttag.player_speed_tagged") or 3
tnttag.player_jump_tagged = minetest.settings:get("tnttag.player_jump_tagged") or 1.2
arena_lib.register_minigame("tnttag", {
prefix = "[tnttag] ",
@ -35,8 +31,8 @@ arena_lib.register_minigame("tnttag", {
tnt_if_tagged,
},
in_game_physics = {
speed = player_speed,
jump = player_jump,
speed = tnttag.player_speed,
jump = tnttag.player_jump,
},
hotbar = {
slots = 1,