forked from MineClone5/MineClone5
Animations for swiming
This commit is contained in:
parent
282af37555
commit
df8bdfbc36
|
@ -359,6 +359,10 @@ mcl_player.player_register_model("mcl_armor_character.b3d", {
|
|||
sneak_mine = {x=346, y=366},
|
||||
sneak_walk = {x=304, y=323},
|
||||
sneak_walk_mine = {x=325, y=344},
|
||||
swim_walk = {x=368, y=387},
|
||||
swim_walk_mine = {x=389, y=408},
|
||||
swim_stand = {x=434, y=434},
|
||||
swim_mine = {x=411, y=430},
|
||||
},
|
||||
})
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -31,6 +31,10 @@ mcl_player.player_register_model("character.b3d", {
|
|||
sneak_mine = {x=346, y=366},
|
||||
sneak_walk = {x=304, y=323},
|
||||
sneak_walk_mine = {x=325, y=344},
|
||||
swim_walk = {x=368, y=388},
|
||||
swim_walk_mine = {x=389, y=409},
|
||||
swim_stand = {x=434, y=434},
|
||||
swim_mine = {x=411, y=430},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -147,6 +151,8 @@ minetest.register_globalstep(function(dtime)
|
|||
animation_speed_mod = animation_speed_mod / 2
|
||||
end
|
||||
|
||||
local standing_on_water = minetest.get_item_group(mcl_playerinfo[name].node_stand, "water") ~= 0
|
||||
|
||||
-- Apply animations based on what the player is doing
|
||||
if player:get_hp() == 0 then
|
||||
player_set_animation(player, "lay")
|
||||
|
@ -155,20 +161,28 @@ minetest.register_globalstep(function(dtime)
|
|||
player_anim[name] = nil
|
||||
player_sneak[name] = controls.sneak
|
||||
end
|
||||
if controls.LMB and not controls.sneak then
|
||||
if controls.LMB and not controls.sneak and standing_on_water then
|
||||
player_set_animation(player, "swim_walk_mine", animation_speed_mod)
|
||||
elseif not controls.sneak and standing_on_water then
|
||||
player_set_animation(player, "swim_walk", animation_speed_mod)
|
||||
elseif controls.LMB and not controls.sneak and not standing_on_water then
|
||||
player_set_animation(player, "walk_mine", animation_speed_mod)
|
||||
elseif controls.LMB and controls.sneak then
|
||||
elseif controls.LMB and controls.sneak and not standing_on_water then
|
||||
player_set_animation(player, "sneak_walk_mine", animation_speed_mod)
|
||||
elseif not controls.sneak then
|
||||
elseif not controls.sneak and not standing_on_water then
|
||||
player_set_animation(player, "walk", animation_speed_mod)
|
||||
else
|
||||
player_set_animation(player, "sneak_walk", animation_speed_mod)
|
||||
end
|
||||
elseif controls.LMB and not controls.sneak then
|
||||
elseif controls.LMB and not controls.sneak and standing_on_water then
|
||||
player_set_animation(player, "swim_mine")
|
||||
elseif controls.LMB and not controls.sneak and not standing_on_water then
|
||||
player_set_animation(player, "mine")
|
||||
elseif controls.LMB and controls.sneak then
|
||||
player_set_animation(player, "sneak_mine")
|
||||
elseif not controls.sneak then
|
||||
elseif not controls.sneak and standing_on_water then
|
||||
player_set_animation(player, "swim_stand", animation_speed_mod)
|
||||
elseif not controls.sneak and not standing_on_water then
|
||||
player_set_animation(player, "stand", animation_speed_mod)
|
||||
else
|
||||
player_set_animation(player, "sneak_stand", animation_speed_mod)
|
||||
|
|
|
@ -39,6 +39,13 @@ minetest.register_globalstep(function(dtime)
|
|||
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
|
||||
elseif minetest.get_item_group(mcl_playerinfo[name].node_stand, "water") ~= 0 then
|
||||
-- controls head pitch when swiming
|
||||
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90,0,0))
|
||||
-- sets collisionbox, eye height, and nametag color accordingly
|
||||
if player:get_properties().collisionbox ~= {-0.35,0.2,-0.35,0.35,1.8,0.35} then
|
||||
player:set_properties({collisionbox = {-0.35,0.2,-0.35,0.35,1.8,0.35}, eye_height = 1.65, nametag_color = { r = 255, b = 225, a = 225, 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))
|
||||
|
|
Loading…
Reference in New Issue