From 3e6a731caba803c9da0dd4db7c51a3dda8dc653f Mon Sep 17 00:00:00 2001 From: tacotexmex Date: Sat, 23 Jun 2018 10:01:40 +0200 Subject: [PATCH 1/3] Fix crash on no drops (@HybridDog) --- init.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index ad24afd..3167b6e 100644 --- a/init.lua +++ b/init.lua @@ -47,7 +47,7 @@ minetest.settings:get_bool("enable_item_pickup") ~= false then if pickup_particle then local item = minetest.registered_nodes[ent.itemstring:gsub("(.*)%s.*$","%1")] local image = "" - if minetest.registered_items[item.name] and minetest.registered_items[item.name].tiles then + if item and minetest.registered_items[item.name] and minetest.registered_items[item.name].tiles then if minetest.registered_items[item.name].tiles[1] then local dt = minetest.registered_items[item.name].drawtype if dt == "normal" or dt == "allfaces" or dt == "allfaces_optional" @@ -70,12 +70,6 @@ minetest.settings:get_bool("enable_item_pickup") ~= false then if not image then image = minetest.registered_items[item.name].tiles[1] end end end - end - if item then - local texture = item.tiles[1] or item.inventory_image or "" - if item.drawtype == "normal" then - texture = item.tiles - end minetest.add_particle({ pos = {x = pos.x, y = pos.y + 1.5, z = pos.z}, velocity = {x = 0, y = 1, z = 0}, @@ -266,10 +260,15 @@ and not minetest.settings:get_bool("creative_mode") then name = item:get_name() end + if name == "" then + -- Sometimes nothing should be dropped + count = 0 + end + for _ = 1,count do local obj = minetest.add_item(pos, name) if not obj then - error("Couldn't spawn item") + error("Couldn't spawn item " .. name .. ", drops: " .. dump(drops)) end local vel = obj:getvelocity() From 293fd776141d30fe4947a608276ffe5a9ce5cd20 Mon Sep 17 00:00:00 2001 From: tacotexmex Date: Sat, 23 Jun 2018 10:02:04 +0200 Subject: [PATCH 2/3] Fix settings bug --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 3167b6e..58ccf93 100644 --- a/init.lua +++ b/init.lua @@ -1,7 +1,7 @@ local load_time_start = minetest.get_us_time() pickup_radius = tonumber(minetest.settings:get("item_pickup_radius")) -if minetest.settings:get_bool("item_drop.enable_item_pickup") ~= false or +if minetest.settings:get_bool("item_drop.enable_item_pickup") ~= false and minetest.settings:get_bool("enable_item_pickup") ~= false then local pickup_gain = tonumber( minetest.settings:get("item_drop.pickup_sound_gain")) or @@ -245,7 +245,7 @@ minetest.settings:get_bool("enable_item_pickup") ~= false then minetest.after(3.0, pickup_step) end -if minetest.settings:get_bool("item_drop.enable_item_drop") ~= false or +if minetest.settings:get_bool("item_drop.enable_item_drop") ~= false and minetest.settings:get_bool("enable_item_drop") ~= false and not minetest.settings:get_bool("creative_mode") then function minetest.handle_node_drops(pos, drops) From d51b468428e232c13cacb26eda2f8519d3d2716a Mon Sep 17 00:00:00 2001 From: tacotexmex Date: Sat, 23 Jun 2018 10:09:02 +0200 Subject: [PATCH 3/3] Simplify inventorycube code (again) --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 58ccf93..8993cb6 100644 --- a/init.lua +++ b/init.lua @@ -64,7 +64,7 @@ minetest.settings:get_bool("enable_item_pickup") ~= false then if not right then right = left end if (type(right) == "table") then right = right.item end - image = "[inventorycube{"..top.."{"..left.."{"..right + image = minetest.inventorycube(top, left, right) else image = minetest.registered_items[item.name].inventory_image if not image then image = minetest.registered_items[item.name].tiles[1] end