mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-29 05:13:02 +05:00
Add on-the-fly animation swapping support
This commit is contained in:
parent
6e24708ecd
commit
fb620979c1
15 changed files with 75 additions and 2 deletions
BIN
beatrun/gamemodes/beatrun/content/models/meclimbanim.dx80.vtx
Normal file
BIN
beatrun/gamemodes/beatrun/content/models/meclimbanim.dx80.vtx
Normal file
Binary file not shown.
BIN
beatrun/gamemodes/beatrun/content/models/meclimbanim.dx90.vtx
Normal file
BIN
beatrun/gamemodes/beatrun/content/models/meclimbanim.dx90.vtx
Normal file
Binary file not shown.
BIN
beatrun/gamemodes/beatrun/content/models/meclimbanim.mdl
Normal file
BIN
beatrun/gamemodes/beatrun/content/models/meclimbanim.mdl
Normal file
Binary file not shown.
BIN
beatrun/gamemodes/beatrun/content/models/meclimbanim.sw.vtx
Normal file
BIN
beatrun/gamemodes/beatrun/content/models/meclimbanim.sw.vtx
Normal file
Binary file not shown.
BIN
beatrun/gamemodes/beatrun/content/models/meclimbanim.vvd
Normal file
BIN
beatrun/gamemodes/beatrun/content/models/meclimbanim.vvd
Normal file
Binary file not shown.
|
@ -13,6 +13,12 @@ local animtable = {
|
||||||
usefullbody = 2
|
usefullbody = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changedanimset = false
|
||||||
|
|
||||||
|
if UseOldAnims:GetBool() then
|
||||||
|
animtable.animmodelstring = "meclimbanim"
|
||||||
|
end
|
||||||
|
|
||||||
fbanims = {
|
fbanims = {
|
||||||
ladderexittoplefthand = true,
|
ladderexittoplefthand = true,
|
||||||
runfwdstart = true,
|
runfwdstart = true,
|
||||||
|
@ -1340,10 +1346,50 @@ hook.Add("CalcViewModelView", "lol", function(wep, vm, oldpos, oldang, pos, ang)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function JumpAnim(event, ply)
|
local function JumpAnim(event, ply)
|
||||||
|
if !animsetchange then animsetchange = false end
|
||||||
|
print("-------------")
|
||||||
|
print("JumpAnim called -- " .. engine.TickCount())
|
||||||
|
if animsetchange != UseOldAnims:GetBool() then
|
||||||
|
print("---- BodyAnim removed -- " .. engine.TickCount())
|
||||||
|
RemoveBodyAnim()
|
||||||
|
end
|
||||||
|
if animsetchange != UseOldAnims:GetBool() then
|
||||||
|
if UseOldAnims:GetBool() then
|
||||||
|
animtable.animmodelstring = "meclimbanim"
|
||||||
|
else
|
||||||
|
animtable.animmodelstring = "climbanim"
|
||||||
|
end
|
||||||
|
StartBodyAnim(animtable)
|
||||||
|
print("---- BodyAnim recreated -- " .. engine.TickCount())
|
||||||
|
|
||||||
|
if not IsValid(BodyAnim) then return end
|
||||||
|
|
||||||
|
CreateBodyAnimArmCopy()
|
||||||
|
|
||||||
|
if not ply:ShouldDrawLocalPlayer() or CurTime() < 10 then
|
||||||
|
for k, v in ipairs(playermodelbones) do
|
||||||
|
local b = BodyAnim:LookupBone(v)
|
||||||
|
|
||||||
|
if b then
|
||||||
|
BodyAnim:ManipulateBonePosition(b, Vector(0, 0, 100 * (k == 1 and -1 or 1)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
hook.Add("BodyAnimCalcView", "JumpCalcView", JumpCalcView)
|
||||||
|
hook.Add("BodyAnimDrawArm", "JumpArmThink", JumpArmThink)
|
||||||
|
hook.Add("PostDrawOpaqueRenderables", "JumpArmDraw", JumpArmDraw)
|
||||||
|
end
|
||||||
if events[event] then
|
if events[event] then
|
||||||
|
print("-- JumpAnim in event -- " .. engine.TickCount())
|
||||||
local wasjumpanim = fbanims[BodyAnimString] and IsValid(BodyAnim)
|
local wasjumpanim = fbanims[BodyAnimString] and IsValid(BodyAnim)
|
||||||
|
|
||||||
|
if changedanimset then
|
||||||
|
wasjumpanim = false
|
||||||
|
end
|
||||||
|
|
||||||
if not wasjumpanim then
|
if not wasjumpanim then
|
||||||
|
print("---- BodyAnim removed -- " .. engine.TickCount())
|
||||||
RemoveBodyAnim()
|
RemoveBodyAnim()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1372,7 +1418,13 @@ local function JumpAnim(event, ply)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not wasjumpanim then
|
if not wasjumpanim then
|
||||||
|
if UseOldAnims:GetBool() then
|
||||||
|
animtable.animmodelstring = "meclimbanim"
|
||||||
|
else
|
||||||
|
animtable.animmodelstring = "climbanim"
|
||||||
|
end
|
||||||
StartBodyAnim(animtable)
|
StartBodyAnim(animtable)
|
||||||
|
print("---- BodyAnim recreated -- " .. engine.TickCount())
|
||||||
|
|
||||||
if not IsValid(BodyAnim) then return end
|
if not IsValid(BodyAnim) then return end
|
||||||
|
|
||||||
|
@ -1395,6 +1447,7 @@ local function JumpAnim(event, ply)
|
||||||
BodyAnim:ResetSequence(BodyAnim:LookupSequence(BodyAnimString))
|
BodyAnim:ResetSequence(BodyAnim:LookupSequence(BodyAnimString))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
animsetchange = UseOldAnims:GetBool()
|
||||||
end
|
end
|
||||||
|
|
||||||
hook.Add("OnParkour", "JumpAnim", JumpAnim)
|
hook.Add("OnParkour", "JumpAnim", JumpAnim)
|
||||||
|
@ -1790,4 +1843,4 @@ local function JumpThink()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
hook.Add("Think", "JumpThink", JumpThink)
|
hook.Add("Think", "JumpThink", JumpThink)
|
|
@ -1,3 +1,4 @@
|
||||||
|
--include("preexecute/client.lua")
|
||||||
include("shared.lua")
|
include("shared.lua")
|
||||||
|
|
||||||
for _, v in ipairs(file.Find("gamemodes/beatrun/gamemode/cl/*.lua", "GAME")) do
|
for _, v in ipairs(file.Find("gamemodes/beatrun/gamemode/cl/*.lua", "GAME")) do
|
||||||
|
|
0
beatrun/gamemodes/beatrun/gamemode/preexecute/client.lua
Normal file
0
beatrun/gamemodes/beatrun/gamemode/preexecute/client.lua
Normal file
|
@ -1,3 +1,5 @@
|
||||||
CrueltyParkour = CreateConVar("Beatrun_CrueltyParkour", 0, {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "Also known as \"Cruelty Mode\".\nDisables some Beatrun parkour abilities using anything but the Beatrun hands when enabled.", 0, 1)
|
CrueltyParkour = CreateConVar("Beatrun_CrueltyParkour", 0, {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "Also known as \"Cruelty Mode\".\nDisables some Beatrun parkour abilities using anything but the Beatrun hands when enabled.", 0, 1)
|
||||||
|
|
||||||
SlippyWallrun = CreateConVar("Beatrun_Experimentals_SlippyWallrun", 0, {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "Makes your wallrun slippy. Only usable with Cruelty Parkour on.", 0, 1)
|
SlippyWallrun = CreateConVar("Beatrun_Experimentals_SlippyWallrun", 0, {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "Makes your wallrun slippy. Only usable with Cruelty Parkour on.", 0, 1)
|
||||||
|
|
||||||
|
UseOldAnims = CreateConVar("Beatrun_UseOldAnims", 0, {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "Use Mirror's Edge animations instead of the reanimated ones.", 0, 1)
|
|
@ -94,6 +94,12 @@ net.Receive("RollAnimSP", function()
|
||||||
roll.BodyAnimSpeed = 1.15
|
roll.BodyAnimSpeed = 1.15
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if UseOldAnims:GetBool() then
|
||||||
|
roll.animmodelstring = "meclimbanim"
|
||||||
|
else
|
||||||
|
roll.animmodelstring = "climbanim"
|
||||||
|
end
|
||||||
|
|
||||||
CacheBodyAnim()
|
CacheBodyAnim()
|
||||||
RemoveBodyAnim()
|
RemoveBodyAnim()
|
||||||
StartBodyAnim(roll)
|
StartBodyAnim(roll)
|
||||||
|
@ -132,6 +138,12 @@ hook.Add("SetupMove", "EvadeRoll", function(ply, mv, cmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
if CLIENT and IsFirstTimePredicted() then
|
if CLIENT and IsFirstTimePredicted() then
|
||||||
|
if UseOldAnims:GetBool() then
|
||||||
|
roll.animmodelstring = "meclimbanim"
|
||||||
|
else
|
||||||
|
roll.animmodelstring = "climbanim"
|
||||||
|
end
|
||||||
|
|
||||||
CacheBodyAnim()
|
CacheBodyAnim()
|
||||||
RemoveBodyAnim()
|
RemoveBodyAnim()
|
||||||
StartBodyAnim(roll)
|
StartBodyAnim(roll)
|
||||||
|
@ -202,6 +214,11 @@ hook.Add("OnPlayerHitGround", "SafetyRoll", function(ply, water, floater, speed)
|
||||||
end
|
end
|
||||||
|
|
||||||
if CLIENT and IsFirstTimePredicted() then
|
if CLIENT and IsFirstTimePredicted() then
|
||||||
|
if UseOldAnims:GetBool() then
|
||||||
|
roll.animmodelstring = "meclimbanim"
|
||||||
|
else
|
||||||
|
roll.animmodelstring = "climbanim"
|
||||||
|
end
|
||||||
CacheBodyAnim()
|
CacheBodyAnim()
|
||||||
RemoveBodyAnim()
|
RemoveBodyAnim()
|
||||||
StartBodyAnim(roll)
|
StartBodyAnim(roll)
|
||||||
|
|
Loading…
Reference in a new issue