Merge pull request 'Visual Sneaking, Minecraft-like breathing anim, Spawn egg textures. Whielditem reposition, and arm pitch control.' (#1071) from epCode/MineClone2:master into master
Reviewed-on: MineClone2/MineClone2#1071
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 582 B |
Before Width: | Height: | Size: 388 B After Width: | Height: | Size: 581 B |
Before Width: | Height: | Size: 315 B After Width: | Height: | Size: 546 B |
Before Width: | Height: | Size: 648 B After Width: | Height: | Size: 571 B |
Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 559 B |
Before Width: | Height: | Size: 476 B After Width: | Height: | Size: 637 B |
Before Width: | Height: | Size: 342 B After Width: | Height: | Size: 606 B |
Before Width: | Height: | Size: 437 B After Width: | Height: | Size: 618 B |
Before Width: | Height: | Size: 489 B After Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 439 B After Width: | Height: | Size: 541 B |
Before Width: | Height: | Size: 529 B After Width: | Height: | Size: 590 B |
Before Width: | Height: | Size: 759 B After Width: | Height: | Size: 563 B |
Before Width: | Height: | Size: 750 B After Width: | Height: | Size: 534 B |
Before Width: | Height: | Size: 337 B After Width: | Height: | Size: 639 B |
Before Width: | Height: | Size: 335 B After Width: | Height: | Size: 611 B |
Before Width: | Height: | Size: 410 B After Width: | Height: | Size: 554 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 553 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 601 B |
Before Width: | Height: | Size: 409 B After Width: | Height: | Size: 621 B |
Before Width: | Height: | Size: 866 B After Width: | Height: | Size: 644 B |
Before Width: | Height: | Size: 323 B After Width: | Height: | Size: 597 B |
Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 527 B |
Before Width: | Height: | Size: 706 B After Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 427 B After Width: | Height: | Size: 600 B |
Before Width: | Height: | Size: 447 B After Width: | Height: | Size: 583 B |
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 568 B |
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 575 B |
Before Width: | Height: | Size: 372 B After Width: | Height: | Size: 436 B |
Before Width: | Height: | Size: 385 B After Width: | Height: | Size: 623 B |
Before Width: | Height: | Size: 469 B After Width: | Height: | Size: 597 B |
Before Width: | Height: | Size: 329 B After Width: | Height: | Size: 607 B |
Before Width: | Height: | Size: 285 B After Width: | Height: | Size: 609 B |
Before Width: | Height: | Size: 855 B After Width: | Height: | Size: 559 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 577 B |
Before Width: | Height: | Size: 322 B After Width: | Height: | Size: 600 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 521 B |
Before Width: | Height: | Size: 692 B After Width: | Height: | Size: 598 B |
Before Width: | Height: | Size: 356 B After Width: | Height: | Size: 529 B |
Before Width: | Height: | Size: 775 B After Width: | Height: | Size: 595 B |
Before Width: | Height: | Size: 629 B After Width: | Height: | Size: 582 B |
Before Width: | Height: | Size: 676 B After Width: | Height: | Size: 580 B |
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 578 B |
Before Width: | Height: | Size: 469 B After Width: | Height: | Size: 521 B |
Before Width: | Height: | Size: 345 B After Width: | Height: | Size: 554 B |
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 568 B |
Before Width: | Height: | Size: 751 B After Width: | Height: | Size: 606 B |
Before Width: | Height: | Size: 446 B After Width: | Height: | Size: 599 B |
Before Width: | Height: | Size: 350 B After Width: | Height: | Size: 605 B |
|
@ -94,6 +94,16 @@ armor.def = {
|
|||
}
|
||||
|
||||
armor.update_player_visuals = function(self, player)
|
||||
|
||||
local player_holding = player:get_wielded_item():get_name()
|
||||
if string.find(player_holding,"mcl_tools:") or player_holding == "mcl_mobitems:bone" or player_holding == "mcl_fishing:fishing_rod" then
|
||||
player:set_bone_position("Wield_Item", vector.new(0,3.9,1.3), vector.new(90,0,0))
|
||||
elseif string.find(player_holding, "mcl_bows:bow") then
|
||||
player:set_bone_position("Wield_Item", vector.new(.5,4.5,-1.6), vector.new(90,0,20))
|
||||
else
|
||||
player:set_bone_position("Wield_Item", vector.new(-1.5,4.9,1.8), vector.new(135,0,90))
|
||||
end
|
||||
|
||||
if not player then
|
||||
return
|
||||
end
|
||||
|
@ -345,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=344},
|
||||
},
|
||||
})
|
||||
|
||||
|
|
|
@ -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=344},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -107,7 +111,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 <https://minecraft.gamepedia.com/Options#Video_settings>>>>
|
||||
end)
|
||||
|
||||
|
@ -151,15 +155,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
|
||||
|
|
|
@ -20,11 +20,33 @@ 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.LMB then
|
||||
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(pitch,0,0))
|
||||
else
|
||||
player:set_bone_position("Arm_Right_Pitch_Control", vector.new(-3,5.785,0), vector.new(0,0,0))
|
||||
end
|
||||
|
||||
if controls.sneak and player:get_attach() == nil then
|
||||
-- controls head pitch when sneaking
|
||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+36,0,0))
|
||||
-- sets collisionbox, eye height, and nametag color accordingly
|
||||
if player:get_properties().collisionbox ~= {-0.35,0,-0.35,0.35,1.35,0.35} then
|
||||
player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.35,0.35}, eye_height = 1.35, nametag_color = { r = 255, b = 225, a = 0, g = 225 }})
|
||||
end
|
||||
else
|
||||
-- controls head pitch when not sneaking
|
||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch,0,0))
|
||||
-- sets collisionbox, eye height, and nametag color accordingly
|
||||
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, nametag_color = { r = 255, b = 225, a = 225, g = 225 }})
|
||||
end
|
||||
end
|
||||
|
||||
if mcl_playerplus_internal[name].jump_cooldown > 0 then
|
||||
mcl_playerplus_internal[name].jump_cooldown = mcl_playerplus_internal[name].jump_cooldown - dtime
|
||||
|
|