Compare commits

...

14 Commits

Author SHA1 Message Date
Mikita Wiśniewski 1f7ab3a8b6 Update README.md (Migration notice) 2024-03-05 22:06:20 +07:00
Mikita Wiśniewski 8d1ae3cc8c Add playerphysics to mod.conf 2024-02-22 19:35:29 +07:00
Mikita Wiśniewski 25e3efc9ae Merge branch 'cora-fix_phys_override' 2024-02-22 19:29:00 +07:00
cora d661bbc04b Fix wrong usage of set_physics_override, use playerphysics 2024-02-22 19:28:20 +07:00
Mikita Wiśniewski 1927a1aabe Merge pull request 'Change function call of set_physics_override to a more modern syntax so we dont get the deprecation warnings and added linting.' (#6) from Impulse/mcl_cozy:master into master
Reviewed-on: MineClone2/mcl_cozy#6
2024-02-22 11:19:42 +00:00
James Clarke 626b12c0cb Added luachechrc 2024-01-14 13:42:45 +00:00
James Clarke 28bf2612fd Added .luacheckrc for linting. 2024-01-14 13:20:30 +00:00
James Clarke b39deed14d Change function call of set_physics_override to a more modern syntax so we dont get the deprecation warnings. 2024-01-14 13:09:32 +00:00
Mikita Wiśniewski ad33e6bc1e Merge pull request 'French translation' (#4) from syl/mcl_cozy:master into master
Reviewed-on: MineClone2/mcl_cozy#4
2023-04-23 05:32:20 +00:00
syl 82898f79e2 French translation 2023-04-22 23:03:22 +00:00
Mikita Wiśniewski fbf247d92e Check the node below on globalstep, and if it's air just unmount (fixes #1)
cora, thanks again ^^
2022-05-16 21:28:39 +07:00
Mikita Wiśniewski 78ad6f1e6c Update README: add CDB downloads badge and change text a bit 2022-05-16 19:15:32 +07:00
Mikita Wiśniewski 0185f69567 Fix mounting while flying (partially fixes #1) and add title to the mod.conf
big thanks to cora!
2022-05-16 19:04:28 +07:00
Mikita Wiśniewski 04d7596b54 Add support for mcl_tmp_message (which is part of Mineclonia) and update mod.conf for it 2022-05-11 19:31:18 +07:00
5 changed files with 127 additions and 29 deletions

50
.luacheckrc Normal file
View File

@ -0,0 +1,50 @@
unused_args = false
allow_defined_top = true
globals = {
"minetest","mcl_tmp_message","mcl_player"
}
read_globals = {
string = {fields = {"split"}},
table = {fields = {"copy", "getn"}},
-- My mod
"mcl_cozy",
-- Builtin
"vector", "ItemStack",
"dump", "DIR_DELIM", "VoxelArea", "Settings",
-- MTG
"default", "sfinv", "creative",
-- Mineclone
"mcl_loot", "tga_encoder", "mcl_util", "flowlib", "mcl_sounds", "mcl_autogroup",
"mcl_events", "biomeinfo", "mcl_damage", "mcl_particles", "mcl_worlds", "mcl_colors",
"mcl_explosions", "mcl_vars", "controls", "walkover", "mcl_meshhand", "mcl_fovapi",
"playerphysics", "mcl_hunger", "mcl_death_drop", "mcl_playerplus",
"mcl_gamemode", "mcl_spawn", "mcl_skins", "mcl_sprint", "mcl_playerinfo",
"mcl_item_id", "tt", "mcl_craftguide", "doc", "mcl_dripping",
"mcl_entity_invs", "mcl_item_entity", "mcl_burning",
"mcl_minecarts", "pillager", "mobs_mc", "sounds",
"textures", "mcl_mobs", "mcl_paintings",
"mcl_grindstone", "mcl_walls", "mcl_bamboo",
"mcl_maps", "mcl_clock", "mcl_end", "mcl_starting_inventory",
"mcl_bows", "mcl_bows_s", "mcl_dye", "mcl_copper",
"mcl_flowerpots", "mcl_furnaces", "mcl_farming",
"mcl_campfires", "mcl_crafting_table", "mcl_doors",
"mcl_jukebox", "screwdriver", "mcl_itemframes",
"mcl_heads", "mcl_beacons", "xpanes", "mcl_enchanting",
"mcl_beds", "mcl_throwing", "mcl_banners", "mcl_mobspawners",
"mcl_cocoas", "mcl_smithing_table", "mcl_flowers",
"mcl_core", "mcl_torches", "mcl_target", "mesecon", "mcl_observers",
"mcl_sculk", "mcl_armor", "mcl_lanterns", "mcl_stairs", "mcl_bells",
"mcl_hamburger", "mcl_signs", "mcl_honey", "mcl_stonecutter", "mcl_fire",
"mcl_compass", "mcl_ocean", "mcl_fences", "mcl_buckets", "mcl_potions",
"tnt", "mcl_cherry_blossom", "mcl_portals", "mcl_chests", "mcl_shields",
"mcl_wip", "mcl_raids", "mcl_moon", "lightning", "mcl_weather",
"mcl_formspec", "mcl_death_messages", "mcl_bossbars", "awards",
"mcl_inventory", "mcl_title", "mcl_offhand", "hb", "mcl_experience",
"mcl_info", "mcl_credits", "tsm_railcorridors", "mcl_mapgen_core",
"mcl_structures", "settlements", "mcl_dungeons", "mcl_colors_official"
}

View File

@ -1,6 +1,9 @@
# MineClone2 Get Comfortable # MineClone2 Get Comfortable
Adds commands to /lay or /sit to the MineClone 2 (5) game
**Migrated, see <https://codeberg.org/rudzik8/mcl_cozy>**
[![ContentDB](https://content.minetest.net/packages/rudzik8/mcl_cozy/shields/downloads/)](https://content.minetest.net/packages/rudzik8/mcl_cozy/)
Adds commands to /lay or /sit to the MineClone 2/5/a game. Port of good old [cozy mod](https://forum.minetest.net/viewtopic.php?f=11&t=14143) (originally made for MTG by everamzah) to work with MCL properly and even provide some nice new features!
![Screenshot](screenshot.png) ![Screenshot](screenshot.png)
Port of [cozy mod](https://forum.minetest.net/viewtopic.php?f=11&t=14143) for Minetest Game by everamzah with some new features!

View File

@ -1,20 +1,57 @@
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
local mcl_cozy_print_actions = minetest.settings:get_bool("mcl_cozy_print_actions") ~= false 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", "[mcl_cozy] Didn't found any mod to set titles in actionbar (mcl_title or mcl_tmp_message)!")
end
end
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
local players = minetest.get_connected_players() local players = minetest.get_connected_players()
for i=1, #players do for i=1, #players do
local name = players[i]:get_player_name() local name = players[i]:get_player_name()
if mcl_player.player_attached[name] and not players[i]:get_attach() and if mcl_player.player_attached[name] and not players[i]:get_attach() and
(players[i]:get_player_control().up == true or (players[i]:get_player_control().up == true or
players[i]:get_player_control().down == true or players[i]:get_player_control().down == true or
players[i]:get_player_control().left == true or players[i]:get_player_control().left == true or
players[i]:get_player_control().right == true or players[i]:get_player_control().right == true or
players[i]:get_player_control().jump == true) then players[i]:get_player_control().jump == true or
players[i]:get_player_control().sneak == true) then
players[i]:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
playerphysics.remove_physics_factor(players[i], "speed", "mcl_cozy:attached")
playerphysics.remove_physics_factor(players[i], "jump", "mcl_cozy:attached")
mcl_player.player_attached[name] = false
mcl_player.player_set_animation(players[i], "stand", 30)
end
-- check the node below player (and if it's air, just unmount)
if minetest.get_node(vector.offset(players[i]:get_pos(),0,-1,0)).name == "air" then
players[i]:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0}) players[i]:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
players[i]:set_physics_override(1, 1, 1) playerphysics.remove_physics_factor(players[i], "speed", "mcl_cozy:attached")
playerphysics.remove_physics_factor(players[i], "jump", "mcl_cozy:attached")
mcl_player.player_attached[name] = false mcl_player.player_attached[name] = false
mcl_player.player_set_animation(players[i], "stand", 30)
end end
end end
end) end)
@ -23,23 +60,23 @@ minetest.register_chatcommand("sit", {
description = S("Sit down"), description = S("Sit down"),
func = function(name) func = function(name)
local player = minetest.get_player_by_name(name) local player = minetest.get_player_by_name(name)
-- check the node below player (and if it's air, just don't sit)
if minetest.get_node(vector.offset(player:get_pos(),0,-1,0)).name == "air" then return end
if mcl_player.player_attached[name] then if mcl_player.player_attached[name] then
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0}) player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
player:set_physics_override(1, 1, 1) playerphysics.remove_physics_factor(player, "speed", "mcl_cozy:attached")
playerphysics.remove_physics_factor(player, "jump", "mcl_cozy:attached")
mcl_player.player_attached[name] = false mcl_player.player_attached[name] = false
mcl_player.player_set_animation(player, "stand", 30) mcl_player.player_set_animation(player, "stand", 30)
if mcl_cozy_print_status then print_action_stand(name)
minetest.chat_send_all("* "..name..S(" stands up"))
end
else else
player:set_eye_offset({x=0, y=-7, z=2}, {x=0, y=0, z=0}) player:set_eye_offset({x=0, y=-7, z=2}, {x=0, y=0, z=0})
player:set_physics_override(0, 0, 0) playerphysics.add_physics_factor(player, "speed", "mcl_cozy:attached", 0)
playerphysics.add_physics_factor(player, "jump", "mcl_cozy:attached", 0)
mcl_player.player_attached[name] = true mcl_player.player_attached[name] = true
mcl_player.player_set_animation(player, "sit", 30) mcl_player.player_set_animation(player, "sit", 30)
if mcl_cozy_print_actions then print_action_sit(name)
minetest.chat_send_all("* "..name..S(" sits")) actionbar_show_status(player)
end
mcl_title.set(player, "actionbar", {text=S("Move to stand up"), color="white", stay=60})
end end
end end
}) })
@ -48,23 +85,22 @@ minetest.register_chatcommand("lay", {
description = S("Lay down"), description = S("Lay down"),
func = function(name) func = function(name)
local player = minetest.get_player_by_name(name) local player = minetest.get_player_by_name(name)
if minetest.get_node(vector.offset(player:get_pos(),0,-1,0)).name == "air" then return end
if mcl_player.player_attached[name] then if mcl_player.player_attached[name] then
player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0}) player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
player:set_physics_override(1, 1, 1) playerphysics.remove_physics_factor(player, "speed", "mcl_cozy:attached")
playerphysics.remove_physics_factor(player, "jump", "mcl_cozy:attached")
mcl_player.player_attached[name] = false mcl_player.player_attached[name] = false
mcl_player.player_set_animation(player, "stand", 30) mcl_player.player_set_animation(player, "stand", 30)
if mcl_cozy_print_actions then print_action_stand(name)
minetest.chat_send_all("* "..name..S(" stands up"))
end
else else
player:set_eye_offset({x=0, y=-13, z=0}, {x=0, y=0, z=0}) player:set_eye_offset({x=0, y=-13, z=0}, {x=0, y=0, z=0})
player:set_physics_override(0, 0, 0) playerphysics.add_physics_factor(player, "speed", "mcl_cozy:attached", 0)
playerphysics.add_physics_factor(player, "jump", "mcl_cozy:attached", 0)
mcl_player.player_attached[name] = true mcl_player.player_attached[name] = true
mcl_player.player_set_animation(player, "lay", 0) mcl_player.player_set_animation(player, "lay", 0)
if mcl_cozy_print_actions then print_action_lay(name)
minetest.chat_send_all("* "..name..S(" lies")) actionbar_show_status(player)
end
mcl_title.set(player, "actionbar", {text=S("Move to stand up"), color="white", stay=60})
end end
end end
}) })

7
locale/mcl_cozy.fr.tr Normal file
View File

@ -0,0 +1,7 @@
# textdomain: mcl_cozy
Sit down=S'assoir
Lay down=Se coucher
Move to stand up=Se déplacer pour se lever
sits= s'assoit
lies= se couche
stands up= se lève

View File

@ -1,3 +1,5 @@
name = mcl_cozy name = mcl_cozy
title = MineClone2 Get Comfortable
description = Sit and lay using chat commands description = Sit and lay using chat commands
depends = mcl_player, mcl_title depends = mcl_player, mcl_playerinfo, playerphysics
optional_depends = mcl_title, mcl_tmp_message