Add settings for pickups and drops

This commit is contained in:
tacotexmex 2017-06-26 15:24:56 +02:00
parent d9581ec795
commit a666252f1c

@ -1,3 +1,7 @@
local enable_item_pickup = minetest.settings:get_bool("enable_item_pickup") or true
local enable_item_drops = minetest.settings:get_bool("enable_item_drops") or true
if enable_item_pickup then
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
for _,player in ipairs(minetest.get_connected_players()) do for _,player in ipairs(minetest.get_connected_players()) do
if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then
@ -68,8 +72,10 @@ minetest.register_globalstep(function(dtime)
end end
end end
end end
end
end) end)
if enable_item_drops then
function minetest.handle_node_drops(pos, drops, digger) function minetest.handle_node_drops(pos, drops, digger)
local inv local inv
if minetest.settings:get_bool("creative_mode") and digger and digger:is_player() then if minetest.settings:get_bool("creative_mode") and digger and digger:is_player() then
@ -110,6 +116,7 @@ function minetest.handle_node_drops(pos, drops, digger)
end end
end end
end end
end
if minetest.settings:get("log_mods") then if minetest.settings:get("log_mods") then
minetest.log("action", "item_drop loaded") minetest.log("action", "item_drop loaded")