fix anim after getting out of water + update anims

This commit is contained in:
Jonny_Bro (Nikita) 2023-09-09 18:03:45 +05:00
parent 0249b3baf9
commit 219f8804e6
17 changed files with 27 additions and 17 deletions

View file

@ -145,7 +145,12 @@ local runanims = {
walkfwd = true,
crouchstill = true,
sprintfwd = true,
runbwd = true
runbwd = true,
water_swimfwd = true,
water_swimright = true,
water_swimleft = true,
water_swimback = true,
water_float = true
}
local events = {
@ -383,7 +388,12 @@ local transitionanims = {
ladderclimbuprighthand = "ladderclimbuprighthandstill",
meleeairstill = "jumpair",
vaultontohigh = "runfwd",
snatchscar = "stand"
snatchscar = "stand",
water_swimfwd = "water_out",
water_swimright = "water_out",
water_swimleft = "water_out",
water_swimback = "water_out",
water_float = "water_out"
}
local nospinebend = {
@ -1457,20 +1467,6 @@ local function JumpThink()
local moving = ply:KeyDown(IN_FORWARD) or ply:KeyDown(IN_MOVELEFT) or ply:KeyDown(IN_MOVERIGHT)
local back = ply:KeyDown(IN_BACK)
if ply:WaterLevel() > 0 then
BodyAnim:SetSequence(BodyAnim:LookupSequence("water_float"))
if ply:KeyDown(IN_MOVELEFT) and vel_l > 5 then
BodyAnim:SetSequence(BodyAnim:LookupSequence("water_swimleft"))
elseif ply:KeyDown(IN_MOVERIGHT) and vel_l > 5 then
BodyAnim:SetSequence(BodyAnim:LookupSequence("water_swimright"))
elseif ply:KeyDown(IN_FORWARD) and vel_l > 5 then
BodyAnim:SetSequence(BodyAnim:LookupSequence("water_swimfwd"))
elseif ply:KeyDown(IN_BACK) and vel_l > 5 then
BodyAnim:SetSequence(BodyAnim:LookupSequence("water_swimback"))
end
end
if runanims[BodyAnimString] then
if lastBAString == "stand" and vel_l > 0 then
BodyAnimCycle = ply:GetStepRight() and 0.5 or 0
@ -1640,6 +1636,20 @@ local function JumpThink()
BodyAnim:SetSequence(transitionanims[BodyAnimString])
end
if ply:WaterLevel() > 0 then
BodyAnim:SetSequence(BodyAnim:LookupSequence("water_float"))
if ply:KeyDown(IN_MOVELEFT) and vel_l > 5 then
BodyAnim:SetSequence(BodyAnim:LookupSequence("water_swimleft"))
elseif ply:KeyDown(IN_MOVERIGHT) and vel_l > 5 then
BodyAnim:SetSequence(BodyAnim:LookupSequence("water_swimright"))
elseif ply:KeyDown(IN_FORWARD) and vel_l > 5 then
BodyAnim:SetSequence(BodyAnim:LookupSequence("water_swimfwd"))
elseif ply:KeyDown(IN_BACK) and vel_l > 5 then
BodyAnim:SetSequence(BodyAnim:LookupSequence("water_swimback"))
end
end
if BodyAnimString == "wallrunverticalstart" or BodyAnimString == "wallrunvertical" then
ang = ply.WallrunOrigAng or ang
BodyAnimSpeed = 1.2 * math.Clamp((LocalPlayer():GetWallrunTime() - CurTime()) / 1.2, 0.5, 1)

View file

@ -9,7 +9,7 @@ if SERVER then
if not ply:IsAdmin() and not allowPropSpawn:GetBool() then return false end
end
for k, v in ipairs(spawn) do
for _, v in ipairs(spawn) do
hook.Add(v, "BlockSpawn", BlockSpawn)
end