From aeaca5d7494efe55767c997181a5c071c4800c43 Mon Sep 17 00:00:00 2001 From: Fernando Carmona Varo Date: Sat, 7 Nov 2015 10:27:05 +0100 Subject: Some refactoring for the on_player_collision --- mario/blocks.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mario/blocks.lua') diff --git a/mario/blocks.lua b/mario/blocks.lua index f44f61f..4c493d4 100644 --- a/mario/blocks.lua +++ b/mario/blocks.lua @@ -52,6 +52,10 @@ minetest.register_node("mario:coin", { on_destruct = function(pos) minetest.sound_play("mario-coin", {pos = pos,max_hear_distance = 40,gain = 10.0,}) end, + on_player_collision = function(pos, player, gameid) + minetest.remove_node(pos) + mario.on_player_got_coin(player) + end }) local nbox = { @@ -86,6 +90,10 @@ minetest.register_node("mario:mushroom",{ on_destruct = function(pos) minetest.sound_play("mario-bonus", {pos = pos,max_hear_distance = 40,gain = 10.0,}) end, + on_player_collision = function(pos, player, gameid) + minetest.remove_node(pos) + mario.on_player_got_mushroom(player, 15) + end }) minetest.register_node("mario:mushroom_green",{ @@ -106,4 +114,8 @@ minetest.register_node("mario:mushroom_green",{ on_destruct = function(pos) minetest.sound_play("mario-1-up", {pos = pos,max_hear_distance = 40,gain = 10.0,}) end, + on_player_collision = function(pos, player, gameid) + minetest.remove_node(pos) + mario.on_player_got_mushroom(player, 15) + end }) -- cgit v1.2.3