From 535928dee838cf5e79703bef3721cd1021258e7b Mon Sep 17 00:00:00 2001 From: fairiestoy Date: Sat, 5 Oct 2013 07:27:11 +0200 Subject: Quick Snowball Fix This is a quick security fix for thrown snowballs, which sometimes have the effect of punching holes into claimed ground. --- init.lua | 1 + snow.lua | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 snow.lua diff --git a/init.lua b/init.lua index 8b58cb4..75edaa7 100644 --- a/init.lua +++ b/init.lua @@ -532,5 +532,6 @@ dofile(path.."/doors.lua") dofile(path.."/fire.lua") dofile(path.."/chatcommands.lua") dofile(path.."/screwdriver.lua") +dofile(path.."/snow.lua") end ) diff --git a/snow.lua b/snow.lua new file mode 100644 index 0000000..7f21548 --- /dev/null +++ b/snow.lua @@ -0,0 +1,27 @@ +--[[ +Snow mod rewrite to make it secure for use on landrush +This is a quick workaround before we can upload +an working fix which restores original functionality +]] +if minetest.get_modpath( 'snow' ) then + local entity_prototype = minetest.registered_entities['snow:snowball_entity'] + if not entity_prototype then + print( 'COuld not detect snowball prototype...') + return + end + entity_prototype.on_step = function(self, dtime) + self.timer=self.timer+dtime + local pos = self.object:getpos() + local node = minetest.get_node(pos) + + if self.lastpos.x~=nil then + if node.name ~= "air" then + if landrush.can_interact( ' ', pos ) then + snow.place(pos) + end + self.object:remove() + end + end + self.lastpos={x=pos.x, y=pos.y, z=pos.z} -- Set lastpos-->Node will be added at last pos outside the node + end +end -- cgit v1.2.3