be sure to clear the board

master
MisterE123 2021-02-27 12:30:57 -05:00
parent c1f13192c1
commit 4ccbc012ab
2 changed files with 78 additions and 35 deletions

View File

@ -32,44 +32,44 @@ arena_lib.on_load("wormball", function(arena)
end, arena) end, arena)
--clear the board of gamepieces -- --clear the board of gamepieces
local pos1 = arena.area_to_clear_after_game_pos_1 -- local pos1 = arena.area_to_clear_after_game_pos_1
local pos2 = arena.area_to_clear_after_game_pos_2 -- local pos2 = arena.area_to_clear_after_game_pos_2
local x1 = pos1.x -- local x1 = pos1.x
local x2 = pos2.x -- local x2 = pos2.x
local y1 = pos1.y -- local y1 = pos1.y
local y2 = pos2.y -- local y2 = pos2.y
local z1 = pos1.z -- local z1 = pos1.z
local z2 = pos2.z -- local z2 = pos2.z
if x1 > x2 then -- if x1 > x2 then
local temp = x2 -- local temp = x2
x2 = x1 -- x2 = x1
x1 = temp -- x1 = temp
end -- end
if y1 > y2 then -- if y1 > y2 then
local temp = y2 -- local temp = y2
y2 = y1 -- y2 = y1
y1 = temp -- y1 = temp
end -- end
if z1 > z2 then -- if z1 > z2 then
local temp = z2 -- local temp = z2
z2 = z1 -- z2 = z1
z1 = temp -- z1 = temp
end -- end
for x = x1,x2 do -- for x = x1,x2 do
for y = y1,y2 do -- for y = y1,y2 do
for z = z1,z2 do -- for z = z1,z2 do
--only remove wormball-registered nodes -- --only remove wormball-registered nodes
local nodename = minetest.get_node({x=x,y=y,z=z}).name -- local nodename = minetest.get_node({x=x,y=y,z=z}).name
if string.find(nodename,'wormball') then -- if string.find(nodename,'wormball') then
minetest.set_node({x=x,y=y,z=z}, {name="air"}) -- minetest.set_node({x=x,y=y,z=z}, {name="air"})
end -- end
end -- end
end -- end
end -- end

View File

@ -8,6 +8,47 @@ arena_lib.on_start('wormball', function(arena)
end end
arena.num_players = c arena.num_players = c
--clear the board of gamepieces
local pos1 = arena.area_to_clear_after_game_pos_1
local pos2 = arena.area_to_clear_after_game_pos_2
local x1 = pos1.x
local x2 = pos2.x
local y1 = pos1.y
local y2 = pos2.y
local z1 = pos1.z
local z2 = pos2.z
if x1 > x2 then
local temp = x2
x2 = x1
x1 = temp
end
if y1 > y2 then
local temp = y2
y2 = y1
y1 = temp
end
if z1 > z2 then
local temp = z2
z2 = z1
z1 = temp
end
for x = x1,x2 do
for y = y1,y2 do
for z = z1,z2 do
--only remove wormball-registered nodes
local nodename = minetest.get_node({x=x,y=y,z=z}).name
if string.find(nodename,'wormball') then
minetest.set_node({x=x,y=y,z=z}, {name="air"})
end
end
end
end
-- set players' attachment entities -- set players' attachment entities
for pl_name, stats in pairs(arena.players) do for pl_name, stats in pairs(arena.players) do
@ -19,4 +60,6 @@ arena_lib.on_start('wormball', function(arena)
end end
end) end)