Grenade nodes are no longer walkable. No more infinite grenades when not in creative

This commit is contained in:
LoneWolfHT 2018-11-23 08:30:20 -08:00
parent a20795e6b8
commit 536a9a309d

@ -14,7 +14,6 @@ local function throw_grenade(name, player)
end end
function grenades.register_grenade(name, def) function grenades.register_grenade(name, def)
minetest.log("\n\n\nREGISTERING "..name.."\n\n\n\n")
local grenade_entity = { local grenade_entity = {
physical = true, physical = true,
timer = 0, timer = 0,
@ -55,6 +54,7 @@ function grenades.register_grenade(name, def)
range = 4, range = 4,
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
walkable = false,
drawtype = "plantlike", drawtype = "plantlike",
selection_box = { selection_box = {
type = "fixed", type = "fixed",
@ -67,11 +67,17 @@ function grenades.register_grenade(name, def)
local player_name = user:get_player_name() local player_name = user:get_player_name()
local inv = user:get_inventory() local inv = user:get_inventory()
local grenade = throw_grenade("grenades:grenade_"..name, user) if pointed_thing.type ~= "node" then
grenade.timer = 0 local grenade = throw_grenade("grenades:grenade_"..name, user)
grenade.thrower_name = player_name 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
}) })
end end