mirror of
https://github.com/minetest/minetest_game.git
synced 2024-12-22 14:12:26 +01:00
Add optional bones messages for player and log
This commit is contained in:
parent
37b206e49f
commit
e376d57bd2
@ -23,6 +23,9 @@
|
|||||||
# 0 to disable. By default it is "share_bones_time" divide by four.
|
# 0 to disable. By default it is "share_bones_time" divide by four.
|
||||||
#share_bones_time_early = 300
|
#share_bones_time_early = 300
|
||||||
|
|
||||||
|
# Inform player of condition and location of new bones.
|
||||||
|
#bones_position_message = false
|
||||||
|
|
||||||
# Whether fire should be enabled. If disabled, 'basic_flame' nodes will
|
# Whether fire should be enabled. If disabled, 'basic_flame' nodes will
|
||||||
# disappear.
|
# disappear.
|
||||||
# 'permanent_flame' nodes will remain with either setting.
|
# 'permanent_flame' nodes will remain with either setting.
|
||||||
|
@ -186,20 +186,32 @@ minetest.register_on_dieplayer(function(player)
|
|||||||
bones_mode = "bones"
|
bones_mode = "bones"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local bones_position_message = minetest.settings:get_bool("bones_position_message") == true
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
local pos = vector.round(player:get_pos())
|
||||||
|
local pos_string = minetest.pos_to_string(pos)
|
||||||
|
|
||||||
-- return if keep inventory set or in creative mode
|
-- return if keep inventory set or in creative mode
|
||||||
if bones_mode == "keep" or (creative and creative.is_enabled_for
|
if bones_mode == "keep" or (creative and creative.is_enabled_for
|
||||||
and creative.is_enabled_for(player:get_player_name())) then
|
and creative.is_enabled_for(player:get_player_name())) then
|
||||||
|
minetest.log("action", player_name .. " dies at " .. pos_string ..
|
||||||
|
". No bones placed")
|
||||||
|
if bones_position_message then
|
||||||
|
minetest.chat_send_player(player_name, player_name .. " died at " .. pos_string .. ".")
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local player_inv = player:get_inventory()
|
local player_inv = player:get_inventory()
|
||||||
if is_all_empty(player_inv) then
|
if is_all_empty(player_inv) then
|
||||||
|
minetest.log("action", player_name .. " dies at " .. pos_string ..
|
||||||
|
". No bones placed")
|
||||||
|
if bones_position_message then
|
||||||
|
minetest.chat_send_player(player_name, player_name .. " died at " .. pos_string .. ".")
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos = vector.round(player:getpos())
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
|
|
||||||
-- check if it's possible to place bones, if not find space near player
|
-- check if it's possible to place bones, if not find space near player
|
||||||
if bones_mode == "bones" and not may_replace(pos, player) then
|
if bones_mode == "bones" and not may_replace(pos, player) then
|
||||||
local air = minetest.find_node_near(pos, 1, {"air"})
|
local air = minetest.find_node_near(pos, 1, {"air"})
|
||||||
@ -218,12 +230,25 @@ minetest.register_on_dieplayer(function(player)
|
|||||||
player_inv:set_list(list_name, {})
|
player_inv:set_list(list_name, {})
|
||||||
end
|
end
|
||||||
drop(pos, ItemStack("bones:bones"))
|
drop(pos, ItemStack("bones:bones"))
|
||||||
|
minetest.log("action", player_name .. " dies at " .. pos_string ..
|
||||||
|
". Inventory dropped")
|
||||||
|
if bones_position_message then
|
||||||
|
minetest.chat_send_player(player_name, player_name .. " died at " .. pos_string ..
|
||||||
|
", and dropped their inventory.")
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local param2 = minetest.dir_to_facedir(player:get_look_dir())
|
local param2 = minetest.dir_to_facedir(player:get_look_dir())
|
||||||
minetest.set_node(pos, {name = "bones:bones", param2 = param2})
|
minetest.set_node(pos, {name = "bones:bones", param2 = param2})
|
||||||
|
|
||||||
|
minetest.log("action", player_name .. " dies at " .. pos_string ..
|
||||||
|
". Bones placed")
|
||||||
|
if bones_position_message then
|
||||||
|
minetest.chat_send_player(player_name, player_name .. " died at " .. pos_string ..
|
||||||
|
", and bones were placed.")
|
||||||
|
end
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("main", 8 * 4)
|
inv:set_size("main", 8 * 4)
|
||||||
|
@ -44,6 +44,9 @@ tnt_radius (TNT radius) int 3 0
|
|||||||
# Setting this to 0 will disable sharing of bones completely.
|
# Setting this to 0 will disable sharing of bones completely.
|
||||||
share_bones_time (Bone share time) int 1200 0
|
share_bones_time (Bone share time) int 1200 0
|
||||||
|
|
||||||
|
# Inform player of condition and location of new bones.
|
||||||
|
bones_position_message (Inform player about bones) bool false
|
||||||
|
|
||||||
# Replaces old stairs with new ones. Only required for older worlds.
|
# Replaces old stairs with new ones. Only required for older worlds.
|
||||||
enable_stairs_replace_abm (Replace old stairs) bool false
|
enable_stairs_replace_abm (Replace old stairs) bool false
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user