Add support for mcl_tmp_message (which is part of Mineclonia) and update mod.conf for it
This commit is contained in:
parent
f477c31e75
commit
04d7596b54
48
init.lua
48
init.lua
|
@ -1,6 +1,34 @@
|
|||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
local mcl_cozy_print_actions = minetest.settings:get_bool("mcl_cozy_print_actions") ~= false
|
||||
|
||||
-- functions
|
||||
local function print_action_sit(name)
|
||||
if mcl_cozy_print_actions then
|
||||
minetest.chat_send_all("* "..name..S(" sits"))
|
||||
end
|
||||
end
|
||||
local function print_action_lay(name)
|
||||
if mcl_cozy_print_actions then
|
||||
minetest.chat_send_all("* "..name..S(" lies"))
|
||||
end
|
||||
end
|
||||
local function print_action_stand(name)
|
||||
if mcl_cozy_print_actions then
|
||||
minetest.chat_send_all("* "..name..S(" stands up"))
|
||||
end
|
||||
end
|
||||
|
||||
-- to support both Mineclonia and MineClone 2/5
|
||||
local function actionbar_show_status(player)
|
||||
if minetest.get_modpath("mcl_title") then
|
||||
mcl_title.set(player, "actionbar", {text=S("Move to stand up"), color="white", stay=60})
|
||||
elseif minetest.get_modpath("mcl_tmp_message") then
|
||||
mcl_tmp_message.message(player, S("Move to stand up"))
|
||||
else
|
||||
minetest.log("warning", "Didn't found any mod to set titles in actionbar (mcl_title or mcl_tmp_message)!")
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
local players = minetest.get_connected_players()
|
||||
for i=1, #players do
|
||||
|
@ -28,18 +56,14 @@ 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(" stands up"))
|
||||
end
|
||||
print_action_stand(name)
|
||||
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(" sits"))
|
||||
end
|
||||
mcl_title.set(player, "actionbar", {text=S("Move to stand up"), color="white", stay=60})
|
||||
print_action_sit(name)
|
||||
actionbar_show_status(player)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -53,18 +77,14 @@ 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(" stands up"))
|
||||
end
|
||||
print_action_stand(name)
|
||||
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(" lies"))
|
||||
end
|
||||
mcl_title.set(player, "actionbar", {text=S("Move to stand up"), color="white", stay=60})
|
||||
print_action_lay(name)
|
||||
actionbar_show_status(player)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
|
Reference in New Issue