mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-06-06 13:54:25 -04:00
added option to disable bones
Added the option to disable bone drops so that players can use alternative mods like DropOnDie instead.
This commit is contained in:
parent
676822d286
commit
9f0223f3d8
1 changed files with 51 additions and 51 deletions
|
@ -43,11 +43,7 @@ minetest.register_node("bones:bones", {
|
|||
|
||||
can_dig = function(pos, player)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
local name = ""
|
||||
if player then
|
||||
name = player:get_player_name()
|
||||
end
|
||||
return is_owner(pos, name) and inv:is_empty("main")
|
||||
return is_owner(pos, player:get_player_name()) and inv:is_empty("main")
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
|
@ -76,11 +72,11 @@ minetest.register_node("bones:bones", {
|
|||
end,
|
||||
|
||||
on_punch = function(pos, node, player)
|
||||
if(not is_owner(pos, player:get_player_name())) then
|
||||
if not is_owner(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
if(minetest.get_meta(pos):get_string("infotext") == "") then
|
||||
if minetest.get_meta(pos):get_string("infotext") == "" then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -153,11 +149,14 @@ local function may_replace(pos, player)
|
|||
return node_definition.buildable_to and not minetest.is_protected(pos, player:get_player_name())
|
||||
end
|
||||
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
if minetest.setting_getbool("creative_mode") then
|
||||
-- go no further if creative mode or bones disabled
|
||||
if minetest.setting_getbool("disable_bones") == true
|
||||
or minetest.setting_getbool("creative_mode") == true then
|
||||
return
|
||||
end
|
||||
|
||||
minetest.register_on_dieplayer(function(player)
|
||||
|
||||
local player_inv = player:get_inventory()
|
||||
if player_inv:is_empty("main") and
|
||||
player_inv:is_empty("craft") then
|
||||
|
@ -175,7 +174,8 @@ minetest.register_on_dieplayer(function(player)
|
|||
if (not may_replace(pos, player)) then
|
||||
if (may_replace({x = pos.x, y = pos.y + 1, z = pos.z}, player)) then
|
||||
-- drop one node above if there's space
|
||||
-- this should solve most cases of protection related deaths in which players dig straight down
|
||||
-- this should solve most cases of protection related deaths
|
||||
-- in which players dig straight down
|
||||
-- yet keeps the bones reachable
|
||||
pos.y = pos.y + 1
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue