+ BUGFIX: it didn't load the area before saving the nodes with an inventory
+ BUGFIX: when a node was broken/placed, it didn't check if it was a skywars arenamaster
parent
94ab778f3a
commit
12986e69ff
|
@ -20,6 +20,7 @@ minetest.registered_entities["__builtin:item"].on_step = function(self, dtime, m
|
|||
local arena = skywars.get_arena_by_pos(pos)
|
||||
|
||||
if arena and arena.match_id then
|
||||
-- If the drop has not been initializated yet.
|
||||
if self.match_id == -2 then
|
||||
self.match_id = arena.match_id
|
||||
elseif self.match_id ~= arena.match_id then
|
||||
|
|
|
@ -2,10 +2,12 @@ local function save_node() end
|
|||
|
||||
|
||||
minetest.register_on_placenode(function(pos, newnode, player, oldnode, itemstack, pointed_thing)
|
||||
local arena = arena_lib.get_arena_by_player(player:get_player_name())
|
||||
local pl_name = player:get_player_name()
|
||||
local arena = arena_lib.get_arena_by_player(pl_name)
|
||||
if arena_lib.get_mod_by_player(pl_name) ~= "skywars" then return end
|
||||
save_node(arena, pos, oldnode)
|
||||
|
||||
if arena == nil then
|
||||
if not arena then
|
||||
arena = skywars.get_arena_by_pos(pos)
|
||||
if arena and arena.enabled then
|
||||
save_node(arena, pos, oldnode)
|
||||
|
@ -16,7 +18,9 @@ end)
|
|||
|
||||
|
||||
minetest.register_on_dignode(function(pos, oldnode, player)
|
||||
local arena = arena_lib.get_arena_by_player(player:get_player_name())
|
||||
local pl_name = player:get_player_name()
|
||||
local arena = arena_lib.get_arena_by_player(pl_name)
|
||||
if arena_lib.get_mod_by_player(pl_name) ~= "skywars" then return end
|
||||
save_node(arena, pos, oldnode)
|
||||
|
||||
if arena == nil then
|
||||
|
@ -65,7 +69,10 @@ end
|
|||
|
||||
function skywars.save_nodes_with_inventories(arena)
|
||||
local maps = skywars.load_table("maps")
|
||||
|
||||
skywars.load_mapblocks(arena)
|
||||
initialize_map_data(maps, arena)
|
||||
maps[arena.name].always_to_be_reset_nodes = {}
|
||||
skywars.overwrite_table("maps", maps)
|
||||
|
||||
skywars.iterate_area_nodes(arena.min_pos, arena.max_pos, function(node, node_pos)
|
||||
|
@ -89,12 +96,14 @@ function save_node(arena, pos, node, has_inventory)
|
|||
|
||||
-- If this block has not been changed yet then save it.
|
||||
if maps[arena.name].changed_nodes[serialized_pos] == nil then
|
||||
if has_inventory then
|
||||
maps[arena.name].always_to_be_reset_nodes[serialized_pos] = true
|
||||
end
|
||||
maps[arena.name].changed_nodes[serialized_pos] = node
|
||||
skywars.overwrite_table("maps", maps)
|
||||
end
|
||||
|
||||
if has_inventory then
|
||||
maps[arena.name].always_to_be_reset_nodes[serialized_pos] = true
|
||||
end
|
||||
|
||||
skywars.overwrite_table("maps", maps)
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ function skywars.kill_players_out_map(arena)
|
|||
local pl_pos = player:get_pos()
|
||||
local map_area = VoxelArea:new{MinEdge = arena.min_pos, MaxEdge = arena.max_pos}
|
||||
|
||||
if map_area:contains(pl_pos.x, pl_pos.y, pl_pos.z) == false then
|
||||
if not map_area:contains(pl_pos.x, pl_pos.y, pl_pos.z) then
|
||||
player:set_hp(0)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@ function skywars.auto_equip_item(player, picked_itemstack, picked_itemstack_slot
|
|||
local hotbar_item_name = hotbar_itemstack:get_name()
|
||||
local best_item_name = compare_items(hotbar_item_name, picked_item_name)
|
||||
-- Returning if the picked item is in the hotbar already.
|
||||
if not picked_item_name == hotbar_item_name then return end
|
||||
if picked_item_name == hotbar_item_name then return end
|
||||
|
||||
if best_item_name == picked_item_name then
|
||||
local first_empty_slot = picked_itemstack_slot or get_first_empty_slot(hotbar)
|
||||
|
|
Loading…
Reference in New Issue