From 536a9a309d01f5b1254f8fe2b3c3c783bc2ca719 Mon Sep 17 00:00:00 2001 From: LoneWolfHT Date: Fri, 23 Nov 2018 08:30:20 -0800 Subject: [PATCH] Grenade nodes are no longer walkable. No more infinite grenades when not in creative --- init.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/init.lua b/init.lua index cddcb96..ae359bb 100644 --- a/init.lua +++ b/init.lua @@ -14,7 +14,6 @@ local function throw_grenade(name, player) end function grenades.register_grenade(name, def) - minetest.log("\n\n\nREGISTERING "..name.."\n\n\n\n") local grenade_entity = { physical = true, timer = 0, @@ -55,6 +54,7 @@ function grenades.register_grenade(name, def) range = 4, paramtype = "light", sunlight_propagates = true, + walkable = false, drawtype = "plantlike", selection_box = { type = "fixed", @@ -67,11 +67,17 @@ function grenades.register_grenade(name, def) local player_name = user:get_player_name() local inv = user:get_inventory() - local grenade = throw_grenade("grenades:grenade_"..name, user) - grenade.timer = 0 - grenade.thrower_name = player_name + if pointed_thing.type ~= "node" then + local grenade = throw_grenade("grenades:grenade_"..name, user) + grenade.timer = 0 + grenade.thrower_name = player_name - inv:remove_item("main", "grenades:grenade_"..name) + if not minetest.setting_getbool("creative_mode") then + itemstack = "" + end + end + + return itemstack end }) end