Fix crash in protected area when user violates area protection

This commit is contained in:
James David Clarke 2024-01-02 17:55:20 +00:00
parent 3c064d33fe
commit b4db66d76f
No known key found for this signature in database
GPG Key ID: 9F5ECFD0E20F1C4C
4 changed files with 7 additions and 9 deletions

@ -5,6 +5,7 @@ read_globals = {
"dump", "dump",
"ItemStack", "ItemStack",
"pipeworks", "pipeworks",
"unified_inventory",
"PseudoRandom", "PseudoRandom",
"stairsplus", "stairsplus",
"intllib", "intllib",

@ -4,8 +4,6 @@
local me = microexpansion local me = microexpansion
local substitute_basic_materials = microexpansion.settings.simple_craft == true or not minetest.get_modpath("basic_materials") local substitute_basic_materials = microexpansion.settings.simple_craft == true or not minetest.get_modpath("basic_materials")
local gold_wire_recipe = nil
if minetest.get_modpath("mcl_core") then if minetest.get_modpath("mcl_core") then
gold_wire_recipe = { gold_wire_recipe = {
{ 2, { { 2, {

@ -4,9 +4,6 @@ local me = microexpansion
-- custom items that are used by multiple devices -- custom items that are used by multiple devices
local steel_infused_obsidian_ingot_recipe = nil
local machine_casing_recipe = nil
if minetest.get_modpath("mcl_core") then if minetest.get_modpath("mcl_core") then
steel_infused_obsidian_ingot_recipe = { steel_infused_obsidian_ingot_recipe = {
{ 2, { { 2, {

@ -349,13 +349,14 @@ microexpansion.register_node("drive", {
me.send_event(pos,"disconnect") me.send_event(pos,"disconnect")
end, end,
allow_metadata_inventory_put = function(pos, _, _, stack, player) allow_metadata_inventory_put = function(pos, _, _, stack, player)
local name = player:get_player_name()
local network = me.get_connected_network(pos) local network = me.get_connected_network(pos)
if network then if network then
if network:get_access_level(player) < access_level.interact then if network:get_access_level(player) < access_level.interact then
return 0 return 0
end end
elseif minetest.is_protected(pos, player) then elseif minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, player) minetest.record_protection_violation(pos, name)
return 0 return 0
end end
if minetest.get_item_group(stack:get_name(), "microexpansion_cell") == 0 then if minetest.get_item_group(stack:get_name(), "microexpansion_cell") == 0 then
@ -384,14 +385,15 @@ microexpansion.register_node("drive", {
me.send_event(pos,"items",{net=network}) me.send_event(pos,"items",{net=network})
end, end,
allow_metadata_inventory_take = function(pos,_,_,stack, player) --args: pos, listname, index, stack, player allow_metadata_inventory_take = function(pos,_,_,stack, player) --args: pos, listname, index, stack, player
local name = player:get_player_name()
local network = me.get_connected_network(pos) local network = me.get_connected_network(pos)
if network then if network then
write_drive_cells(pos,network) write_drive_cells(pos,network)
if network:get_access_level(player) < access_level.interact then if network:get_access_level(player) < access_level.interact then
return 0 return 0
end end
elseif minetest.is_protected(pos, player) then elseif minetest.is_protected(pos, name) then
minetest.record_protection_violation(pos, player) minetest.record_protection_violation(pos, name)
return 0 return 0
end end
return stack:get_count() return stack:get_count()