diff options
author | Anthony Zhang <azhang9@gmail.com> | 2013-03-14 13:44:49 -0400 |
---|---|---|
committer | Anthony Zhang <azhang9@gmail.com> | 2013-03-14 13:44:49 -0400 |
commit | 79bb4a343345f1d4825f5bed8d2a24cfe8c4ce8e (patch) | |
tree | 34a2f76f1a16472c2de584bfdb6621b5f87afa5d | |
parent | e1577eba4671b8604567099dde4e1ba3ab10eab0 (diff) | |
download | mesecons-79bb4a343345f1d4825f5bed8d2a24cfe8c4ce8e.tar mesecons-79bb4a343345f1d4825f5bed8d2a24cfe8c4ce8e.tar.gz mesecons-79bb4a343345f1d4825f5bed8d2a24cfe8c4ce8e.tar.bz2 mesecons-79bb4a343345f1d4825f5bed8d2a24cfe8c4ce8e.tar.xz mesecons-79bb4a343345f1d4825f5bed8d2a24cfe8c4ce8e.zip |
Lots of bugs in movestones fixed:
* Movestones no longer eat nodes when running off the track.
* Movestones no longer eat nodes when colliding with an mvps stopper.
* Movestones no longer pass through mvps stoppers.
* Movestones do not eat nodes when they are suddenly placed in the entity's path.
-rw-r--r-- | mesecons_movestones/init.lua | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/mesecons_movestones/init.lua b/mesecons_movestones/init.lua index a78b879..8f4ff81 100644 --- a/mesecons_movestones/init.lua +++ b/mesecons_movestones/init.lua @@ -66,17 +66,6 @@ minetest.register_node("mesecons_movestones:movestone", { action_on = function (pos, node) local direction=mesecon:get_movestone_direction(pos) if not direction then return end - local checknode={} - local collpos={x=pos.x, y=pos.y, z=pos.z} - repeat -- Check if it collides with a stopper - collpos = mesecon:addPosRule(collpos, direction) - checknode=minetest.env:get_node(collpos) - if mesecon:is_mvps_stopper(checknode.name, direction) then - return - end - until checknode.name=="air" - or checknode.name=="ignore" - or not(minetest.registered_nodes[checknode.name].liquidtype == "none") minetest.env:remove_node(pos) mesecon:update_autoconnect(pos) minetest.env:add_entity(pos, "mesecons_movestones:movestone_entity") @@ -98,17 +87,27 @@ minetest.register_entity("mesecons_movestones:movestone_entity", { on_step = function(self, dtime) local pos = self.object:getpos() + pos.x, pos.y, pos.z = math.floor(pos.x), math.floor(pos.y), math.floor(pos.z) local direction = mesecon:get_movestone_direction(pos) if not direction then + local name = minetest.env:get_node(pos).name + if name ~= "air" and name ~= "ignore" and minetest.registered_nodes[name].liquidtype == "none" then + mesecon:mvps_push(pos, direction, MOVESTONE_MAXIMUM_PUSH) + end minetest.env:add_node(pos, {name="mesecons_movestones:movestone"}) self.object:remove() return end - self.object:setvelocity({x=direction.x*2, y=direction.y*2, z=direction.z*2}) + local np = mesecon:addPosRule(pos, direction) + if not mesecon:mvps_push(np, direction, MOVESTONE_MAXIMUM_PUSH) then + minetest.env:add_node(pos, {name="mesecons_movestones:movestone"}) + self.object:remove() + return + end - mesecon:mvps_push(pos, direction, 100) + self.object:setvelocity({x=direction.x*2, y=direction.y*2, z=direction.z*2}) end, }) |