From 2a38a33ff831f687a85bb842f5df46975afde97e Mon Sep 17 00:00:00 2001 From: luk3yx Date: Tue, 20 Dec 2022 20:58:52 +1300 Subject: [PATCH] Disable node_drop by default (#116) * Drop `item_lava_destroy` builtin function --- builtin/game/item.lua | 2 +- builtin/game/item_entity.lua | 31 ++----------------------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/builtin/game/item.lua b/builtin/game/item.lua index dc165a7a3..bd7596443 100644 --- a/builtin/game/item.lua +++ b/builtin/game/item.lua @@ -8,7 +8,7 @@ local vadd, vnew, vmultiply, vnormalize, vsubtract = vector.add, vector.new, vector.multiply, vector.normalize, vector.subtract local creative_mode = core.settings:get_bool("creative_mode") -local node_drop = core.settings:get_bool("node_drop", true) +local node_drop = core.settings:get_bool("node_drop") local function copy_pointed_thing(pointed_thing) return { diff --git a/builtin/game/item_entity.lua b/builtin/game/item_entity.lua index 485210dd0..068aea529 100644 --- a/builtin/game/item_entity.lua +++ b/builtin/game/item_entity.lua @@ -21,7 +21,6 @@ local time_to_live = tonumber(core.settings:get("item_entity_ttl")) or 600 local gravity = tonumber(core.settings:get("movement_gravity")) or 9.81 local collection = core.settings:get_bool("item_collection", true) local water_flow = core.settings:get_bool("item_water_flow", true) -local lava_destroy = core.settings:get_bool("item_lava_destroy", true) -- Water flow functions, based on QwertyMine3 (WTFPL), and TenPlus1 (MIT) mods local function quick_flow_logic(node, pos_testing, dir) @@ -315,37 +314,11 @@ core.register_entity(":__builtin:item", { end end - local node_inside = core.get_node_or_nil(pos) - local def_inside = node_inside and core.registered_nodes[node_inside.name] - - -- Destroy item when dropped into lava - if lava_destroy and def_inside - and def_inside.groups and def_inside.groups.lava then - core.sound_play("default_cool_lava", { - pos = pos, max_hear_distance = 10}) - self.itemstring = "" - self.object:remove() - core.add_particlespawner({ - amount = 3, - time = 0.1, - minpos = {x = pos.x - 0.1, y = pos.y + 0.1, z = pos.z - 0.1}, - maxpos = {x = pos.x + 0.1, y = pos.y + 0.2, z = pos.z + 0.1}, - minvel = {x = 0, y = 2.5, z = 0}, - maxvel = {x = 0, y = 2.5, z = 0}, - minacc = {x = -0.15, y = -0.02, z = -0.15}, - maxacc = {x = 0.15, y = -0.01, z = 0.15}, - minexptime = 4, - maxexptime = 6, - minsize = 2, - maxsize = 4, - texture = "item_smoke.png" - }) - return - end - local vel = self.object:get_velocity() -- Moving items in the water flow (TenPlus1, MIT) + local node_inside = core.get_node_or_nil(pos) + local def_inside = node_inside and core.registered_nodes[node_inside.name] if water_flow and def_inside and def_inside.liquidtype == "flowing" then local vec = quick_flow(pos, node_inside) self.object:set_velocity({x = vec.x, y = vel.y, z = vec.z})