decent property names
This commit is contained in:
parent
a79bb7728f
commit
67c01fbc25
@ -56,11 +56,11 @@ arena_lib.on_start("block_league", function(arena)
|
||||
|
||||
-- se è TD, forza chunk entità e la aggiunge nel mondo
|
||||
if arena.mod == 1 then
|
||||
local pos1 = {x = arena.prototipo_spawn.x - 1, y = arena.prototipo_spawn.y - 1, z = arena.prototipo_spawn.z - 1}
|
||||
local pos2 = {x = arena.prototipo_spawn.x + 1, y = arena.prototipo_spawn.y + 1, z = arena.prototipo_spawn.z + 1}
|
||||
local pos1 = {x = arena.ball_spawn.x - 1, y = arena.ball_spawn.y - 1, z = arena.ball_spawn.z - 1}
|
||||
local pos2 = {x = arena.ball_spawn.x + 1, y = arena.ball_spawn.y + 1, z = arena.ball_spawn.z + 1}
|
||||
minetest.forceload_block(pos1, pos2)
|
||||
|
||||
local ent = minetest.add_entity(arena.prototipo_spawn,"block_league:prototipo",arena.name)
|
||||
local ent = minetest.add_entity(arena.ball_spawn,"block_league:prototipo",arena.name)
|
||||
end
|
||||
|
||||
block_league.energy_refill(arena)
|
||||
|
@ -180,7 +180,7 @@ function ball:on_step(d_time, moveresult)
|
||||
-- se il giocatore è vivo
|
||||
if w_pos == nil then return end
|
||||
|
||||
local goal = self.team_name == S("red") and arena.destinazione_red or arena.destinazione_blue
|
||||
local goal = self.team_name == S("red") and arena.goal_red or arena.goal_blue
|
||||
|
||||
check_for_touchdown(id, arena, self, wielder, w_pos, goal)
|
||||
end
|
||||
@ -249,7 +249,7 @@ function ball:reset()
|
||||
end
|
||||
|
||||
self:_destroy()
|
||||
minetest.add_entity(arena.prototipo_spawn,"block_league:prototipo",arena.name)
|
||||
minetest.add_entity(arena.ball_spawn,"block_league:prototipo",arena.name)
|
||||
return
|
||||
end
|
||||
|
||||
@ -299,12 +299,12 @@ function check_for_touchdown(id, arena, ball, wielder, w_pos, goal)
|
||||
arena.weapons_disabled = true
|
||||
minetest.after(5, function()
|
||||
teleport_players(arena)
|
||||
local pos1 = {x = arena.prototipo_spawn.x - 1, y = arena.prototipo_spawn.y - 1, z = arena.prototipo_spawn.z - 1}
|
||||
local pos2 = {x = arena.prototipo_spawn.x + 1, y = arena.prototipo_spawn.y + 1, z = arena.prototipo_spawn.z + 1}
|
||||
local pos1 = {x = arena.ball_spawn.x - 1, y = arena.ball_spawn.y - 1, z = arena.ball_spawn.z - 1}
|
||||
local pos2 = {x = arena.ball_spawn.x + 1, y = arena.ball_spawn.y + 1, z = arena.ball_spawn.z + 1}
|
||||
--minetest.load_area(pos1, pos2)
|
||||
minetest.forceload_block(pos1, pos2)
|
||||
--minetest.emerge_area(pos1, pos2)
|
||||
minetest.add_entity(arena.prototipo_spawn,"block_league:prototipo",arena.name)
|
||||
minetest.add_entity(arena.ball_spawn,"block_league:prototipo",arena.name)
|
||||
arena.weapons_disabled = false
|
||||
end)
|
||||
|
||||
|
@ -440,7 +440,7 @@ end
|
||||
|
||||
|
||||
|
||||
--block_league.shoot(user, pointed_players, bullet_definition.bullet_damage, bullet_definition.knockback, bullet_definition.decrease_damage_with_distance)
|
||||
-- block_league.shoot(user, pointed_players, bullet_definition.bullet_damage, bullet_definition.knockback, bullet_definition.decrease_damage_with_distance)
|
||||
-- può avere uno o più target: formato ObjectRef
|
||||
function block_league.shoot(user, targets, damage, knockback, decrease_damage_with_distance, knockback_dir)
|
||||
local p_name = user:get_player_name()
|
||||
|
69
commands.lua
69
commands.lua
@ -105,58 +105,65 @@ ChatCmdBuilder.new("bleagueadmin", function(cmd)
|
||||
arena_lib.disable_arena(sender, mod, arena)
|
||||
end)
|
||||
|
||||
cmd:sub("adddestination :arena :team", function(sender, arena_name, team)
|
||||
-- aggiunta/rimozione TD. option può essere "add" o "remove"
|
||||
cmd:sub("goal :option :arena :team", function(sender, option, arena_name, team)
|
||||
-- TODO: muovere in una funzione a parte
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
local pos = vector.round(minetest.get_player_by_name(sender):get_pos())
|
||||
if team == "red" then
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "destinazione_red" , pos)
|
||||
print("Aggiunta destinazione red")
|
||||
|
||||
if not arena then
|
||||
minetest.chat_send_player(sender, "Invalid parameter")
|
||||
return end
|
||||
|
||||
if arena.mod == 2 then
|
||||
minetest.chat_send_player(sender, "Invalid parameter")
|
||||
return end
|
||||
|
||||
if team ~= "red" and team ~= "blue" then
|
||||
minetest.chat_send_player(sender, "Invalid parameter")
|
||||
return end
|
||||
|
||||
local team_goal = team == "red" and "goal_red" or "goal_blue"
|
||||
|
||||
if option == "set" then
|
||||
local pos = vector.round(minetest.get_player_by_name(sender):get_pos())
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, team_goal, pos)
|
||||
elseif option == "remove" then
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, team_goal , {})
|
||||
else
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "destinazione_blue" , pos)
|
||||
print("Aggiunta destinazione blue")
|
||||
minetest.chat_send_player(sender, "Invalid parameter")
|
||||
return
|
||||
end
|
||||
|
||||
end)
|
||||
|
||||
--Rimuove la destinazione.
|
||||
cmd:sub("removedestination :arena :team", function(sender, arena_name, team)
|
||||
cmd:sub("ball :option :arena", function(sender, option, arena_name)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
if team == "red" then
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "destinazione_red" , {})
|
||||
print("Rimossa destinazione red")
|
||||
else
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "destinazione_blue" , {})
|
||||
print("Rimossa destinazione blue")
|
||||
end
|
||||
|
||||
end)
|
||||
if not arena then
|
||||
minetest.chat_send_player(sender, "Invalid parameter")
|
||||
return end
|
||||
|
||||
cmd:sub("addspawn :arena", function(sender, arena_name)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
local pos = vector.round(minetest.get_player_by_name(sender):get_pos())
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "prototipo_spawn" , pos)
|
||||
print("Aggiunto spawn")
|
||||
if arena.mod == 2 then
|
||||
minetest.chat_send_player(sender, "Invalid parameter")
|
||||
return end
|
||||
|
||||
end)
|
||||
if option ~= "set" and option ~= "remove" then
|
||||
minetest.chat_send_player(sender, "Invalid parameter")
|
||||
return end
|
||||
|
||||
cmd:sub("removespawn :arena", function(sender, arena_name)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "prototipo_spawn" , {})
|
||||
print("Rimosso spawn")
|
||||
local new_param = option == "set" and vector.round(minetest.get_player_by_name(sender):get_pos()) or {}
|
||||
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "ball_spawn" , new_param)
|
||||
end)
|
||||
|
||||
cmd:sub("addminy :arena", function(sender, arena_name)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
local pos = vector.round(minetest.get_player_by_name(sender):get_pos())
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "min_y" , pos.y)
|
||||
print("Aggiunta y minima")
|
||||
|
||||
end)
|
||||
|
||||
cmd:sub("removeminy :arena", function(sender, arena_name)
|
||||
local id, arena = arena_lib.get_arena_by_name("block_league", arena_name)
|
||||
arena_lib.change_arena_property(sender, "block_league", arena_name, "min_y" , 0)
|
||||
print("Rimossa y minima")
|
||||
end)
|
||||
|
||||
|
||||
|
6
init.lua
6
init.lua
@ -31,9 +31,9 @@ arena_lib.register_minigame("block_league", {
|
||||
score_cap = 10,
|
||||
max_energy = 100,
|
||||
immunity_time = 6,
|
||||
destinazione_red = {"lol"},
|
||||
destinazione_blue = {"lol"},
|
||||
prototipo_spawn = {"lol"},
|
||||
goal_red = {},
|
||||
goal_blue = {},
|
||||
ball_spawn = {},
|
||||
min_y = 0,
|
||||
},
|
||||
temp_properties = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user