diff --git a/mods/ITEMS/mcl_armor/armor.lua b/mods/ITEMS/mcl_armor/armor.lua index 2085635eb1..e7e5b90420 100644 --- a/mods/ITEMS/mcl_armor/armor.lua +++ b/mods/ITEMS/mcl_armor/armor.lua @@ -355,6 +355,10 @@ mcl_player.player_register_model("mcl_armor_character.b3d", { mine = {x=189, y=198}, walk_mine = {x=200, y=219}, sit = {x=81, y=160}, + sneak_stand = {x=222, y=302}, + sneak_mine = {x=346, y=366}, + sneak_walk = {x=304, y=323}, + sneak_walk_mine = {x=325, y=345}, }, }) diff --git a/mods/ITEMS/mcl_armor/models/mcl_armor_character.b3d b/mods/ITEMS/mcl_armor/models/mcl_armor_character.b3d index f5666cb20b..1b2eb8157c 100644 Binary files a/mods/ITEMS/mcl_armor/models/mcl_armor_character.b3d and b/mods/ITEMS/mcl_armor/models/mcl_armor_character.b3d differ diff --git a/mods/ITEMS/mcl_armor/models/mcl_armor_character.blend b/mods/ITEMS/mcl_armor/models/mcl_armor_character.blend index 3211f560eb..51000e28b5 100644 Binary files a/mods/ITEMS/mcl_armor/models/mcl_armor_character.blend and b/mods/ITEMS/mcl_armor/models/mcl_armor_character.blend differ diff --git a/mods/PLAYER/mcl_player/init.lua b/mods/PLAYER/mcl_player/init.lua index d2dca49ca3..2738d667e0 100644 --- a/mods/PLAYER/mcl_player/init.lua +++ b/mods/PLAYER/mcl_player/init.lua @@ -21,12 +21,16 @@ mcl_player.player_register_model("character.b3d", { textures = {"character.png", }, animations = { -- Standard animations. - stand = { x= 0, y= 79, }, - lay = { x=162, y=166, }, - walk = { x=168, y=187, }, - mine = { x=189, y=198, }, - walk_mine = { x=200, y=219, }, - sit = { x= 81, y=160, }, + stand = {x=0, y=79}, + lay = {x=162, y=166}, + walk = {x=168, y=187}, + mine = {x=189, y=198}, + walk_mine = {x=200, y=219}, + sit = {x=81, y=160}, + sneak_stand = {x=222, y=302}, + sneak_mine = {x=346, y=366}, + sneak_walk = {x=304, y=323}, + sneak_walk_mine = {x=325, y=345}, }, }) @@ -106,7 +110,7 @@ end minetest.register_on_joinplayer(function(player) mcl_player.player_attached[player:get_player_name()] = false mcl_player.player_set_model(player, "character.b3d") - player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30) + --player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30) player:set_fov(86.1) -- see >>> end) @@ -150,15 +154,23 @@ minetest.register_globalstep(function(dtime) player_anim[name] = nil player_sneak[name] = controls.sneak end - if controls.LMB then + if controls.LMB and not controls.sneak then player_set_animation(player, "walk_mine", animation_speed_mod) - else + elseif controls.LMB and controls.sneak then + player_set_animation(player, "sneak_walk_mine", animation_speed_mod) + elseif not controls.sneak then player_set_animation(player, "walk", animation_speed_mod) + else + player_set_animation(player, "sneak_walk", animation_speed_mod) end - elseif controls.LMB then + elseif controls.LMB and not controls.sneak then player_set_animation(player, "mine") - else + elseif controls.LMB and controls.sneak then + player_set_animation(player, "sneak_mine") + elseif not controls.sneak then player_set_animation(player, "stand", animation_speed_mod) + else + player_set_animation(player, "sneak_stand", animation_speed_mod) end end end diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index f18e6adfcf..97e91ad42e 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -3,6 +3,7 @@ local S = minetest.get_translator("mcl_playerplus") -- Internal player state local mcl_playerplus_internal = {} + local def = {} local time = 0 @@ -20,11 +21,22 @@ minetest.register_globalstep(function(dtime) -- Update jump status immediately since we need this info in real time. -- WARNING: This section is HACKY as hell since it is all just based on heuristics. for _,player in pairs(minetest.get_connected_players()) do + local controls = player:get_player_control() name = player:get_player_name() -- controls head bone pitch = degrees(player:get_look_vertical()) * -1 - player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,0,0)) + if controls.sneak then + player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+36,0,0)) + if player:get_properties().collisionbox ~= {-0.35,0,-0.35,0.35,1.40,0.35} then + player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.35,0.35}, eye_height = 1.35}) + end + else + player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,0,0)) + if player:get_properties().collisionbox ~= {-0.35,0,-0.35,0.35,1.8,0.35} then + player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.65}) + end + end if mcl_playerplus_internal[name].jump_cooldown > 0 then mcl_playerplus_internal[name].jump_cooldown = mcl_playerplus_internal[name].jump_cooldown - dtime