mirror of
https://github.com/LoneWolfHT/grenades.git
synced 2024-11-22 06:43:45 +01:00
Grenade nodes are no longer walkable. No more infinite grenades when not in creative
This commit is contained in:
parent
a20795e6b8
commit
536a9a309d
10
init.lua
10
init.lua
@ -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()
|
||||||
|
|
||||||
|
if pointed_thing.type ~= "node" then
|
||||||
local grenade = throw_grenade("grenades:grenade_"..name, user)
|
local grenade = throw_grenade("grenades:grenade_"..name, user)
|
||||||
grenade.timer = 0
|
grenade.timer = 0
|
||||||
grenade.thrower_name = player_name
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user