From 9f8a59f653589c12bf15ab295b0f39da5e2446ba Mon Sep 17 00:00:00 2001 From: rudzik8 Date: Mon, 2 May 2022 10:31:58 +0700 Subject: [PATCH] Print players' actions (sits, lies...) in chat if enabled enabled by default --- init.lua | 13 +++++++++++++ locale/mcl_cozy.ru.tr | 3 +++ locale/template.txt | 3 +++ settingtypes.txt | 2 ++ 4 files changed, 21 insertions(+) create mode 100644 settingtypes.txt diff --git a/init.lua b/init.lua index 74c00ee..595545f 100644 --- a/init.lua +++ b/init.lua @@ -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 diff --git a/locale/mcl_cozy.ru.tr b/locale/mcl_cozy.ru.tr index ffbfb8e..6bba53d 100644 --- a/locale/mcl_cozy.ru.tr +++ b/locale/mcl_cozy.ru.tr @@ -2,3 +2,6 @@ Sit down=Сесть Lay down=Лечь Move to stand up=Двиньтесь чтобы встать + sits= сел(а) + lies= лег(ла) + stands up= встал(а) diff --git a/locale/template.txt b/locale/template.txt index 15315df..19d15bb 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -2,3 +2,6 @@ Sit down= Lay down= Move to stand up= + sits= + lies= + stands up= diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..87757d4 --- /dev/null +++ b/settingtypes.txt @@ -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