diff options
author | Fernando Carmona Varo <ferkiwi@gmail.com> | 2015-11-07 10:27:05 +0100 |
---|---|---|
committer | Fernando Carmona Varo <ferkiwi@gmail.com> | 2015-11-07 10:27:05 +0100 |
commit | aeaca5d7494efe55767c997181a5c071c4800c43 (patch) | |
tree | 8ea473837f6efed03c5c5ec63639b0e3042272fe /mario/gamestate.lua | |
parent | 234cac868e1baf2089ef255d0751a7e288725db5 (diff) |
Some refactoring for the on_player_collision
Diffstat (limited to 'mario/gamestate.lua')
-rwxr-xr-x | mario/gamestate.lua | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/mario/gamestate.lua b/mario/gamestate.lua index 1ccf4a7..c4c664b 100755 --- a/mario/gamestate.lua +++ b/mario/gamestate.lua @@ -262,18 +262,10 @@ local function on_player_gamestep(player, gameid) for _,pos in pairs(positions) do pos = vector.add(player_pos, pos) local node = minetest.get_node(pos) - if node.name == "mario:coin" then - minetest.remove_node(pos) - mario.on_player_got_coin(player) - elseif node.name == "mario:mushroom" then - minetest.remove_node(pos) - mario.on_player_got_mushroom(player, 15) - elseif node.name == "mario:portal_right" then - player_pos.x = player_pos.x -31 - player:setpos(player_pos) - elseif node.name == "mario:portal_left" then - player_pos.x = player_pos.x +31 - player:setpos(player_pos) + local nodedef = minetest.registered_nodes[node.name] + + if nodedef and nodedef.on_player_collision then + nodedef.on_player_collision(pos, player, gameid) end end end |