From c62d9b9a3dfb32dae3377a2fe27c5d1febd7a05a Mon Sep 17 00:00:00 2001 From: Fernando Carmona Varo Date: Wed, 11 Nov 2015 00:26:01 +0100 Subject: Fixed turtles going through portals, fly/noclip/fast priviledges will be temporarily disabled during the game, and increased a bit ghost radius --- mario/turtle.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'mario/turtle.lua') diff --git a/mario/turtle.lua b/mario/turtle.lua index 546123f..262997e 100644 --- a/mario/turtle.lua +++ b/mario/turtle.lua @@ -80,9 +80,17 @@ for i in ipairs(turtles) do local velocity = self.object:getvelocity() - -- if our velocity is close to zero, turn around (we are in collision) + -- if our velocity is close to zero, we are in collision if math.abs(velocity.x) < 0.25 then - self.direction.x = -self.direction.x + -- Check if there's a portal or some other node + local pos = self.object:getpos() + pos.y = pos.y + 0.5 + local node = minetest.get_node(pos) + if minetest.registered_nodes[node.name].on_turtle_collision then + minetest.registered_nodes[node.name].on_turtle_collision(pos, self.object, self.gameid) + else + self.direction.x = -self.direction.x + end if(self.direction.x == 0) then self.direction.x = 1 end @@ -121,7 +129,7 @@ for i in ipairs(turtles) do end --end mario.update_hud(self.gameid, player) - + else -- cgit v1.2.3