From a7ed0520b5eb0a632fc43fe1e0d9a6ac9c18b86f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 26 Jan 2017 18:50:06 +0100 Subject: [PATCH] Don't remove throwables in creative --- mods/mcl_throwing/init.lua | 2 ++ mods/mcl_throwing/throwable.lua | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mods/mcl_throwing/init.lua b/mods/mcl_throwing/init.lua index 450312bcd7..4787668417 100644 --- a/mods/mcl_throwing/init.lua +++ b/mods/mcl_throwing/init.lua @@ -11,7 +11,9 @@ local GRAVITY = 9.81 local mcl_throwing_shoot_arrow = function(itemstack, player) for _,arrow in ipairs(arrows) do 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]) + end local playerpos = player:getpos() local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2]) local dir = player:get_look_dir() diff --git a/mods/mcl_throwing/throwable.lua b/mods/mcl_throwing/throwable.lua index 77839c55ad..6773a3f68f 100644 --- a/mods/mcl_throwing/throwable.lua +++ b/mods/mcl_throwing/throwable.lua @@ -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:setacceleration({x=dir.x*-3, y=-GRAVITY, z=dir.z*-3}) 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 end return func