mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-19 09:31:07 +01:00
Don't remove throwables in creative
This commit is contained in:
parent
92c68792e2
commit
a7ed0520b5
2 changed files with 5 additions and 1 deletions
|
@ -11,7 +11,9 @@ local GRAVITY = 9.81
|
||||||
local mcl_throwing_shoot_arrow = function(itemstack, player)
|
local mcl_throwing_shoot_arrow = function(itemstack, player)
|
||||||
for _,arrow in ipairs(arrows) do
|
for _,arrow in ipairs(arrows) do
|
||||||
if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then
|
if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then
|
||||||
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
player:get_inventory():remove_item("main", arrow[1])
|
player:get_inventory():remove_item("main", arrow[1])
|
||||||
|
end
|
||||||
local playerpos = player:getpos()
|
local playerpos = player:getpos()
|
||||||
local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2])
|
local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2])
|
||||||
local dir = player:get_look_dir()
|
local dir = player:get_look_dir()
|
||||||
|
|
|
@ -16,7 +16,9 @@ local throw_function = function (entity_name, velocity)
|
||||||
obj:setvelocity({x=dir.x*velocity, y=dir.y*velocity, z=dir.z*velocity})
|
obj:setvelocity({x=dir.x*velocity, y=dir.y*velocity, z=dir.z*velocity})
|
||||||
obj:setacceleration({x=dir.x*-3, y=-GRAVITY, z=dir.z*-3})
|
obj:setacceleration({x=dir.x*-3, y=-GRAVITY, z=dir.z*-3})
|
||||||
obj:get_luaentity()._thrower = player:get_player_name()
|
obj:get_luaentity()._thrower = player:get_player_name()
|
||||||
item:take_item()
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
|
item:take_item()
|
||||||
|
end
|
||||||
return item
|
return item
|
||||||
end
|
end
|
||||||
return func
|
return func
|
||||||
|
|
Loading…
Reference in a new issue