Print players' actions (sits, lies...) in chat if enabled

enabled by default
This commit is contained in:
Mikita Wiśniewski 2022-05-02 10:31:58 +07:00
parent dfd072586d
commit 9f8a59f653
4 changed files with 21 additions and 0 deletions

View File

@ -1,4 +1,5 @@
local S = minetest.get_translator(minetest.get_current_modname())
local mcl_cozy_print_actions = minetest.settings:get_bool("mcl_cozy_print_actions") ~= false
minetest.register_globalstep(function(dtime)
local players = minetest.get_connected_players()
@ -27,11 +28,17 @@ minetest.register_chatcommand("sit", {
player:set_physics_override(1, 1, 1)
mcl_player.player_attached[name] = false
mcl_player.player_set_animation(player, "stand", 30)
if mcl_cozy_print_status then
minetest.chat_send_all("* "..name..S(" got up"))
end
else
player:set_eye_offset({x=0, y=-7, z=2}, {x=0, y=0, z=0})
player:set_physics_override(0, 0, 0)
mcl_player.player_attached[name] = true
mcl_player.player_set_animation(player, "sit", 30)
if mcl_cozy_print_actions then
minetest.chat_send_all("* "..name..S(" sat down"))
end
mcl_title.set(player, "actionbar", {text=S("Move to stand up"), color="white", stay=60})
end
end
@ -46,11 +53,17 @@ minetest.register_chatcommand("lay", {
player:set_physics_override(1, 1, 1)
mcl_player.player_attached[name] = false
mcl_player.player_set_animation(player, "stand", 30)
if mcl_cozy_print_actions then
minetest.chat_send_all("* "..name..S(" got up"))
end
else
player:set_eye_offset({x=0, y=-13, z=0}, {x=0, y=0, z=0})
player:set_physics_override(0, 0, 0)
mcl_player.player_attached[name] = true
mcl_player.player_set_animation(player, "lay", 0)
if mcl_cozy_print_actions then
minetest.chat_send_all("* "..name..S(" lay down"))
end
mcl_title.set(player, "actionbar", {text=S("Move to stand up"), color="white", stay=60})
end
end

View File

@ -2,3 +2,6 @@
Sit down=Сесть
Lay down=Лечь
Move to stand up=Двиньтесь чтобы встать
sits= сел(а)
lies= лег(ла)
stands up= встал(а)

View File

@ -2,3 +2,6 @@
Sit down=
Lay down=
Move to stand up=
sits=
lies=
stands up=

2
settingtypes.txt Normal file
View File

@ -0,0 +1,2 @@
# If false then actions (like "* player stands up", in style of /me) won't be printed
mcl_cozy_print_actions (Print actions) bool true