New VManip and settings menu!!

This commit is contained in:
Jonny_Bro (Nikita) 2023-06-04 19:50:50 +05:00
parent c01c1ce6a4
commit c13bc69b95
49 changed files with 1056 additions and 85 deletions

35
.glualint.json Normal file
View file

@ -0,0 +1,35 @@
{
"lint_maxScopeDepth": 0,
"lint_syntaxErrors": true,
"lint_syntaxInconsistencies": true,
"lint_deprecated": true,
"lint_trailingWhitespace": true,
"lint_whitespaceStyle": true,
"lint_beginnerMistakes": true,
"lint_emptyBlocks": false,
"lint_shadowing": false,
"lint_gotos": true,
"lint_doubleNegations": true,
"lint_redundantIfStatements": false,
"lint_redundantParentheses": true,
"lint_duplicateTableKeys": true,
"lint_profanity": false,
"lint_unusedVars": true,
"lint_unusedParameters": false,
"lint_unusedLoopVars": false,
"lint_inconsistentVariableStyle": false,
"lint_ignoreFiles": [],
"prettyprint_spaceAfterParens": false,
"prettyprint_spaceAfterBrackets": false,
"prettyprint_spaceAfterBraces": false,
"prettyprint_spaceEmptyBrackets": true,
"prettyprint_spaceAfterLabel": false,
"prettyprint_spaceBeforeComma": false,
"prettyprint_spaceAfterComma": true,
"prettyprint_semicolons": false,
"prettyprint_cStyle": false,
"prettyprint_rejectInvalidCode": false,
"prettyprint_indentation": "\t",
"log_format": "auto"
}

View file

@ -1,36 +0,0 @@
"C:\Users\Jonny\Desktop\xd\lua\weapons\mg_base\modules\client\cl_spawnmenu.lua"
Courses client
Beatrun_Apikey
Beatrun_Domain
Viewpunch client
Beatrun_ViewbobIntensity
Beatrun_ViewbobStabilized
Courses client
Beatrun_FastStart
Beatrun_CPSave
Misc server
Beatrun_AllowPropSpawn (Server)
Beatrun_AllowOvedriveInMultiplayer (server)
Purist mode
Beatrun_PuristMode (client)
Beatrun_PuristModeForce (server)
Beatrun_PuristWallrun (server)
Moves
Beatrun_QuickturnGround (client)
Beatrun_KickGlitch (server)
Beatrun_QuakeJump (server)
Beatrun_SideStep (server)
Beatrun_MaxSpeed (server)
Beatrun_Disarm (server)
Dive
Beatrun_Totsugeki
Beatrun_TotsugekiSpam
Beatrun_TotsugekiHeading
Beatrun_TotsugekiDir

View file

@ -4,9 +4,10 @@ There are lua modules, they are for Discord Rich Presence to work, if you want p
This version of the beatrun works on any version of the game (Chromium or not).
# Installation
0. Delete `beatrun` folder in *addons* if you have it!
1. Extract `beatrun` folder to *your_game_folder/garrysmod/addons*.
2. Extract `lua` folder to *your_game_folder/garrysmod*.
**1. Delete or disable VManip (Base) that downloaded from Workshop!**
**2. Delete `beatrun` folder in *addons* if you have one!**
3. Extract `beatrun` and `vmaniprework` folders to *your_game_folder/garrysmod/addons*.
4. Extract `lua` folder to *your_game_folder/garrysmod*.
* `lua` folder constains modules for Discord Rich Presense to work. They are open source, visit [this](https://github.com/fluffy-servers/gmod-discord-rpc) to see the source.
## Changes added by me
@ -26,6 +27,7 @@ This version of the beatrun works on any version of the game (Chromium or not).
- [ ] Gamemodes menu
## Fixes and changes from previous version
* All mentioned issues with sliding or grapple fixed with new VManip version.
* You can now dive to your death =)
* Kick glitch version toggle.

View file

@ -3,7 +3,7 @@ local minimalvm
if CLIENT then
minimalvm = CreateClientConVar("Beatrun_MinimalVM", 1, true, true, "Lowers the running viewmodel", 0, 1)
cvarwindsound = CreateClientConVar("Beatrun_Wind", 1, true, false, "Wind noises")
cvarwindsound = CreateClientConVar("Beatrun_Wind", 1, true, false, "Wind noises", 0, 1)
SWEP.PrintName = "Unarmed"
SWEP.Slot = 0

View file

@ -1,3 +1,5 @@
local NametagsEnable = CreateClientConVar("Beatrun_Nametags", "1", true, false, "Toggles nametags above players", 0, 1)
local enemy = Color(255, 0, 0)
local function HideNearby(ply)
@ -7,7 +9,7 @@ local function HideNearby(ply)
ply.distfromlocal = LocalPlayer():GetPos():Distance(ply:GetPos())
local Distance = ply.distfromlocal or 40000
if Distance < 20000 then
if Distance < 20000 and NametagsEnable:GetBool() then
local infectionmode = GetGlobalBool(GM_INFECTION)
local localinfected = LocalPlayer():GetNW2Bool("Infected")
local plyinfected = ply:GetNW2Bool("Infected")

View file

@ -12,37 +12,76 @@ end
hook.Add("AddToolMenuCategories", "Beatrun_Category", function()
spawnmenu.AddToolCategory("Beatrun", "Client", "Client")
spawnmenu.AddToolCategory("Beatrun", "Server", "Server")
end)
hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function()
--[[
Beatrun_FOV
spawnmenu.AddToolMenuOption("Beatrun", "Client", "beatrun_courses", "Courses", "", "", function(panel)
panel:ClearControls()
panel:SetName("Courses Setttings")
Beatrun_HUDXP
Beatrun_HUDSway
Beatrun_HUDDynamic
Beatrun_HUDHidden
Beatrun_HUDReticle
panel:CheckBox("Fast Start", "Beatrun_FastStart")
panel:ControlHelp("Faster countdown in courses")
Beatrun_HUDTextColor
Beatrun_HUDCornerColor
Beatrun_HUDFloatingXPColor
panel:CheckBox("Save at Checkpoint", "Beatrun_CPSave")
panel:ControlHelp("Respawn at last hit checkpoint in courses")
panel:TextEntry("Courses server", "Beatrun_Domain")
panel:ControlHelp("Database domain\nDefault: courses.beatrun.ru")
local apiKeyButton = vgui.Create("DButton", panel)
apiKeyButton:SetText("Change API Key")
apiKeyButton:SetSize(0, 20)
apiKeyButton.DoClick = function()
local frame = vgui.Create("DFrame")
frame:SetTitle("Enter your API Key")
frame:SetSize(300, 100)
frame:SetDeleteOnClose(true)
frame:Center()
frame:MakePopup()
local TextEntry = vgui.Create("DTextEntry", frame)
TextEntry:Dock(TOP)
local okButton = vgui.Create("DButton", frame)
okButton:SetText("Change API Key")
okButton:SetPos(25, 60)
okButton:SetSize(250, 30)
okButton.DoClick = function()
RunConsoleCommand("Beatrun_Apikey", TextEntry:GetValue())
frame:Close()
end
end
panel:AddItem(apiKeyButton)
end)
Beatrun_MinimalVM
Beatrun_Wind
--]]
spawnmenu.AddToolMenuOption("Beatrun", "Client", "beatrun_hud", "HUD", "", "", function(panel)
panel:ClearControls()
panel:SetName("HUD Setttings")
panel:CheckBox("Show total XP near your nickname", "Beatrun_HUDXP")
panel:CheckBox("Display HUD swaying", "Beatrun_HUDSway")
panel:CheckBox("Hide HUD when moving", "Beatrun_HUDDynamic")
panel:CheckBox("Display a dot in the center of the screen", "Beatrun_HUDReticle")
panel:CheckBox("Dynamic HUD", "Beatrun_HUDDynamic")
panel:ControlHelp("Hides HUD when moving")
panel:CheckBox("HUD Sway", "Beatrun_HUDSway")
panel:ControlHelp("Toggles HUD swaying")
panel:CheckBox("Dot", "Beatrun_HUDReticle")
panel:ControlHelp("Shows a dot in the center of the screen")
panel:CheckBox("Nametags", "Beatrun_Nametags")
panel:ControlHelp("Toggles nametags above players")
panel:CheckBox("Floating XP", "Beatrun_HUDXP")
panel:ControlHelp("Show total XP near your nickname")
panel:CheckBox("Lower Viewmodel", "Beatrun_MinimalVM")
panel:ControlHelp("Lowers the running viewmodel")
panel:CheckBox("Wind", "Beatrun_Wind")
panel:ControlHelp("Wind noises when running")
panel:NumSlider("FOV", "Beatrun_FOV", 90, 120, 0)
panel:ControlHelp("You need to respawn after changing FOV!")
panel:ControlHelp("You need to respawn after changing the FOV!")
panel:NumSlider("Hide HUD", "Beatrun_HUDHidden", 0, 2, 0)
panel:ControlHelp("0 - Shown\n1 - Gamemode only\n2 - Hidden")
@ -51,17 +90,119 @@ hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function()
panel:AddItem(divider)
panel:Help("HUD Text Color")
local HudTextColor = vgui.Create("DColorMixer", Frame)
local HudTextColor = vgui.Create("DColorMixer", panel)
HudTextColor:Dock(FILL)
HudTextColor:SetPalette(true)
HudTextColor:SetAlphaBar(true)
HudTextColor:SetWangs(true)
HudTextColor:SetColor(string.ToColor(GetConVar("Beatrun_HUDTextColor"):GetString()))
function HudTextColor:ValueChanged(color)
RunConsoleCommand("Beatrun_HUDTextColor", string.FromColor(col))
RunConsoleCommand("Beatrun_HUDTextColor", string.FromColor(color))
end
panel:AddItem(HudTextColor)
panel:Help("HUD Corners Color")
local HudCornerColor = vgui.Create("DColorMixer", panel)
HudCornerColor:Dock(FILL)
HudCornerColor:SetPalette(true)
HudCornerColor:SetAlphaBar(true)
HudCornerColor:SetWangs(true)
HudCornerColor:SetColor(string.ToColor(GetConVar("Beatrun_HUDCornerColor"):GetString()))
function HudCornerColor:ValueChanged(color)
RunConsoleCommand("Beatrun_HUDCornerColor", string.FromColor(color))
end
panel:AddItem(HudCornerColor)
panel:Help("HUD Floating XP Color")
local HudFXPColor = vgui.Create("DColorMixer", panel)
HudFXPColor:Dock(FILL)
HudFXPColor:SetPalette(true)
HudFXPColor:SetAlphaBar(true)
HudFXPColor:SetWangs(true)
HudFXPColor:SetColor(string.ToColor(GetConVar("Beatrun_HUDFloatingXPColor"):GetString()))
function HudFXPColor:ValueChanged(color)
RunConsoleCommand("Beatrun_HUDFloatingXPColor", string.FromColor(color))
end
panel:AddItem(HudFXPColor)
end)
spawnmenu.AddToolMenuOption("Beatrun", "Client", "beatrun_viewbob", "Viewbob", "", "", function(panel)
panel:ClearControls()
panel:SetName("Viewbob Settings")
panel:CheckBox("Viewbob Stabilization", "Beatrun_ViewbobStabilized")
panel:ControlHelp("Turn on to reduce motion sickness by making viewbobbing keep the player's look position centered")
panel:NumSlider("Viewbob Intensity", "Beatrun_ViewbobIntensity", -100, 100, 0)
end)
spawnmenu.AddToolMenuOption("Beatrun", "Client", "beatrun_gameplay", "Gameplay", "", "", function(panel)
panel:ClearControls()
panel:SetName("Gameplaye Settings")
panel:CheckBox("Quickturn", "Beatrun_QuickturnGround")
panel:ControlHelp("Enables quickturning with secondary attack while on the ground")
panel:CheckBox("Purist Mode", "Beatrun_PuristMode")
panel:ControlHelp("Purist mode is a clientside preference that severely weakens the ability to strafe while in the air, which is how Mirror's Edge games handle this.\nDisabled = No restrictions\nEnabled = Reduced move speed in the air")
end)
spawnmenu.AddToolMenuOption("Beatrun", "Server", "beatrun_main", "Main", "", "", function(panel)
panel:ClearControls()
panel:SetName("Misc Settings")
panel:NumSlider("Max Speed", "Beatrun_MaxSpeed", 0, 1000, 0)
panel:ControlHelp("Changes Max Moving Speed")
panel:CheckBox("Prop Spawning", "Beatrun_AllowPropSpawn")
panel:ControlHelp("Allows players without admin rights to spawn props, entities and weapons")
panel:CheckBox("Overdrive in Multiplayer", "Beatrun_AllowOvedriveInMultiplayer")
panel:ControlHelp("Allows Overdrive usage on the server\nDoesn't affect singleplayer")
end)
spawnmenu.AddToolMenuOption("Beatrun", "Server", "beatrun_moves", "Moves", "", "", function(panel)
panel:ClearControls()
panel:SetName("Moves Settings")
panel:Help("You Can Dive with Ctrl + RMB While Midair!\nOverdrive Toggles with E + LMB.")
panel:CheckBox("Force Purist Mode", "Beatrun_PuristModeForce")
panel:ControlHelp("Forces Purist Mode for all players")
panel:CheckBox("\"Realistic\" wallrunning", "Beatrun_PuristWallrun")
panel:ControlHelp("NOTE:\nYou wallrun a bit further")
local divider = vgui.Create("DHorizontalDivider")
panel:AddItem(divider)
panel:CheckBox("Kick-Glitch", "Beatrun_KickGlitch")
panel:ControlHelp("Toggles Kick-Glitch Move\nLMB when Wallrunning and Then Jumping Right After")
panel:CheckBox("Kick-Glitch Version", "Beatrun_OldKickGlitch")
panel:ControlHelp("Enabled - Old Kick-Glitch\nDisabled - New Kick-Glitch\nNew version uses mechanic from Mirror's Edge that spawns a small platform under a player")
panel:CheckBox("Quake Jump", "Beatrun_QuakeJump")
panel:ControlHelp("Toggles Quake Jump Move\nPress RMB Right After Side Step")
panel:CheckBox("Side Step", "Beatrun_SideStep")
panel:ControlHelp("Toggles Side Step Move\nA/D + RMB")
panel:CheckBox("Disarm", "Beatrun_Disarm")
panel:ControlHelp("Toggles Ability to Disarm NPC\nInteract with NPC")
local divider = vgui.Create("DHorizontalDivider")
panel:AddItem(divider)
panel:Help("Dive Settings")
panel:CheckBox("Totsugeki", "Beatrun_Totsugeki")
panel:ControlHelp("Toggles Totsugeki Move\nDive After Quake Jump")
panel:CheckBox("Totsugeki Spam", "Beatrun_TotsugekiSpam")
panel:ControlHelp("Toggles Ability to Spam Totsugeki")
panel:CheckBox("Totsugeki Heading", "Beatrun_TotsugekiHeading")
panel:ControlHelp("Allows to Totsugeki on X axis (up/down)")
panel:CheckBox("Totsugeki Direction", "Beatrun_TotsugekiDir")
panel:ControlHelp("Allows to Totsugeki into Another Direction\nCombined with Spam and Heading Allows You to Fly =)")
end)
end)

View file

@ -125,7 +125,7 @@ local randvector = Vector()
-- local box_mins = Vector(-0.5, -0.5, -0.5)
-- local box_maxs = Vector(0.5, 0.5, 0.5)
local awareness = CreateClientConVar("blindness_awareness", 10000, true, false, "Awareness in hu")
local quality = CreateClientConVar("blindness_highquality", 1, true, false, "Draws quads instead of lines")
local quality = CreateClientConVar("blindness_highquality", 1, true, false, "Draws quads instead of lines", 0, 1)
-- local boxang = Angle()
-- local vanishvec = Vector()
-- local vanishvecrand = Vector()

View file

@ -302,7 +302,7 @@ end)
hook.Add("ShouldCollide", "NoPlayerCollisions", function(ent1, ent2)
if ent1:IsPlayer() and (ent2:IsPlayer() or ent2.NoPlayerCollisions) then
if ent2.BRCollisionFunc then
if ent2.BRCollisionFunc then
return ent2:BRCollisionFunc(ent1)
else
if (ent1.br_Fired and ent2.br_FiredBy == ent1) or (ent2.br_Fired and ent1.br_FiredBy == ent2) then return true end
@ -317,31 +317,41 @@ end)
local function calc_fov(src, dst)
local v_src = src:Forward()
local v_dst = dst:Forward()
local result = math.deg(math.acos(v_dst:Dot(v_src) / v_dst:Length()))
if result != result or (result == math.huge or result == -math.huge) then
if result ~= result or (result == math.huge or result == -math.huge) then
result = 0
end
return result
end
// i was forced
-- i was forced
hook.Add("EntityFireBullets", "thisengineismadebyacrackhead", function(ent, data)
if not IsValid(ent) or not isfunction(ent.GetShootPos) or not ent:IsPlayer() then return end
for i, ply in ipairs(player.GetAll()) do
if ply == ent then continue end
local fov = calc_fov(data.Dir:Angle(), (ply:GetShootPos() - data.Src):Angle())
if fov > 60 then continue end
ply.br_FiredBy = ent
timer.Simple(engine.TickInterval()*3, function() if IsValid(ply) then ply.br_FiredBy = nil end end)
timer.Simple(engine.TickInterval() * 3, function()
if IsValid(ply) then
ply.br_FiredBy = nil
end
end)
end
ent.br_Fired = true
timer.Simple(engine.TickInterval()*3, function() if IsValid(ent) then ent.br_Fired = false end end)
timer.Simple(engine.TickInterval() * 3, function()
if IsValid(ent) then
ent.br_Fired = false
end
end)
end)
hook.Add("PhysgunPickup", "AllowPlayerPickup", function(ply, ent)

View file

@ -65,7 +65,7 @@ function LoadCheckpoints()
end
if CLIENT then
CreateClientConVar("Beatrun_FastStart", "0", true, true, "Faster start countdown")
CreateClientConVar("Beatrun_FastStart", "0", true, true, "Faster start countdown", 0, 1)
net.Receive("Checkpoint_Hit", function()
local timetaken = CurTime() - lastcptime
@ -246,9 +246,11 @@ function CourseHUD()
text = speed .. " km/h"
w, _ = surface.GetTextSize(text)
local r, g, b, a = string.ToColor(GetConVar("Beatrun_HUDTextColor"):GetString())
surface.SetDrawColor(255, 255, 255, 255)
surface.SetFont("BeatrunHUD")
surface.SetTextColor(255, 255, 255, 255)
surface.SetTextColor(r, g, b, a)
surface.SetTextPos(ScrW() * 0.85 - w * 0.5 + vpx, ScrH() * 0.85 + vpz)
surface.DrawText(text)
end

View file

@ -10,6 +10,7 @@ if CLIENT then
local activewep = ply:GetActiveWeapon()
if IsValid(activewep) and activewep:GetClass() ~= "runnerhands" then return end
if ply:GetMoveType() == MOVETYPE_NOCLIP then return end
if GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT) then return end
if not ply.GrappleHUD_tr then
@ -67,7 +68,7 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
local grappled = nil
if not ply:GetGrappling() and ply:GetMelee() == 0 and not ply:OnGround() and ply:GetSafetyRollKeyTime() < CurTime() and ply:GetWallrun() == 0 and usingrh and cmd:GetViewAngles().x <= -15 then
if not ply:GetGrappling() and ply:GetMelee() == 0 and not ply:OnGround() and ply:GetMoveType() ~= MOVETYPE_NOCLIP and ply:GetSafetyRollKeyTime() < CurTime() and ply:GetWallrun() == 0 and usingrh and cmd:GetViewAngles().x <= -15 then
local trout = ply:GetEyeTrace()
local dist = trout.HitPos:DistToSqr(mv:GetOrigin())

View file

@ -1,13 +1,12 @@
GM_INFECTION = 0
Infection_StartTime = 0
Infection_EndTime = 0
local rand = math.random
function table.Shuffle(t)
local n = #t
while n > 1 do
local k = rand(n)
local k = math.random(n)
t[k] = t[n]
t[n] = t[k]
n = n - 1
@ -76,7 +75,7 @@ if SERVER then
timer.Simple(0.01, GiveLastManGun)
if humancount < 1 then
victim:EmitSound("blackout_hit_0" .. rand(1, 3) .. ".wav")
victim:EmitSound("blackout_hit_0" .. math.random(1, 3) .. ".wav")
net.Start("Infection_End")
net.WriteFloat(CurTime())
@ -90,7 +89,7 @@ if SERVER then
end
end)
else
victim:EmitSound("player_damage_tonal_hit_0" .. rand(1, 6) .. ".wav")
victim:EmitSound("player_damage_tonal_hit_0" .. math.random(1, 6) .. ".wav")
end
end
end)
@ -135,7 +134,7 @@ if SERVER then
end
if numinfected == 1 then
local infected = players[rand(#players)]
local infected = players[math.random(#players)]
infected:SetNW2Bool("Infected", true)
net.Start("Infection_XPReward")

View file

@ -285,7 +285,7 @@ hook.Add("SetupMove", "Melee", function(ply, mv, cmd)
pos.z = pos.z - 8
platform:SetModel("models/hunter/plates/plate05x05.mdl")
platform:SetModel("models/hunter/plates/plate1x1.mdl")
platform:SetPos(pos)
platform:SetColor(Color(0,0,0,0))
platform:SetRenderMode(RENDERMODE_TRANSCOLOR)

View file

@ -1,5 +1,5 @@
if CLIENT then
PuristMode = CreateClientConVar("Beatrun_PuristMode", "1", true, true, "Purist mode is a clientside preference that severely weakens the ability to strafe while in the air, which is how Mirror's Edge games handle this.\n0 = No restrictions\n1 = Reduced move speed in the air")
PuristMode = CreateClientConVar("Beatrun_PuristMode", "1", true, true, "Purist mode is a clientside preference that severely weakens the ability to strafe while in the air, which is how Mirror's Edge games handle this.\n0 = No restrictions\n1 = Reduced move speed in the air", 0, 1)
end
local PuristModeForce = CreateConVar("Beatrun_PuristModeForce", 0, {FCVAR_REPLICATED, FCVAR_ARCHIVE}, "Force players to adhere to purist rules", 0, 1)

View file

@ -1,5 +1,5 @@
if CLIENT then
QuickturnGround = CreateClientConVar("Beatrun_QuickturnGround", "0", true, true, "Enables quickturning with secondary attack while on the ground")
QuickturnGround = CreateClientConVar("Beatrun_QuickturnGround", "0", true, true, "Enables quickturning with secondary attack while on the ground", 0, 1)
end
function DoJumpTurn(lookbehind)

View file

@ -121,6 +121,7 @@ local function WallrunningThink(ply, mv, cmd)
ParkourEvent("jumpwallrun", ply)
ply:SetSafetyRollKeyTime(CurTime() + 0.001)
vel.z = 30
vel:Mul(ply:GetOverdriveMult())
@ -153,8 +154,8 @@ local function WallrunningThink(ply, mv, cmd)
mv:SetVelocity(vecvel)
mv:SetForwardSpeed(0)
mv:SetSideSpeed(0)
local tr = ply.WallrunTrace
local trout = ply.WallrunTraceOut
local eyeang = ply.WallrunOrigAng or Angle()
@ -200,6 +201,7 @@ local function WallrunningThink(ply, mv, cmd)
if ovel:Length() > 400 then
ovel:Mul(0.975)
ply:SetWallrunOrigVel(ovel)
end

View file

@ -257,11 +257,11 @@ hook.Add("SetupMove", "MESetupMove", function(ply, mv, cmd)
local MEAng = math.Truncate(ang:Forward().x, 2)
local MEAngDiff = math.abs((MEAng - ply:GetMEAng()) * 100)
local weaponspeed = 150
local weaponspeed = math.floor(max_speed:GetInt() / 1.66)
local activewep = ply:GetActiveWeapon()
if IsValid(activewep) and activewep:GetClass() ~= "runnerhands" then
weaponspeed = 250
weaponspeed = max_speed:GetInt()
end
if (ismoving or ply:GetMantle() ~= 0) and ply:GetMESprintDelay() < CurTime() and (cmd:KeyDown(IN_SPEED) or ply:GetMantle() ~= 0 or not ply:OnGround() or (not ply:OnGround() or ply:GetMantle() ~= 0) and mv:GetVelocity().z > -450) then

View file

@ -0,0 +1,691 @@
--[[N++ Protip: View > Collapse Level 1
More detail on stuff in lua/vmanip/vmanip_baseanims.lua
Please keep in mind that you do not fire events *through vmanip*. Think of it as a fully
clientside animation system. So instead, you request to play an anim, and if the request
went through (true return value), you do your thing
You probably don't need to snoop around this file, but feel free
]]
VManip = {}
VMLegs = {}
local curtime = 0
--Non linear lerping
local function LerpC(t, a, b, powa)
return a + (b - a) * math.pow(t, powa)
end
local properang = Angle(-79.750, 0, -90)
local leftarmbones = {"ValveBiped.Bip01_L_UpperArm", "ValveBiped.Bip01_L_Forearm", "ValveBiped.Bip01_L_Hand", "ValveBiped.Bip01_L_Wrist", "ValveBiped.Bip01_L_Ulna", "ValveBiped.Bip01_L_Finger4", "ValveBiped.Bip01_L_Finger41", "ValveBiped.Bip01_L_Finger42", "ValveBiped.Bip01_L_Finger3", "ValveBiped.Bip01_L_Finger31", "ValveBiped.Bip01_L_Finger32", "ValveBiped.Bip01_L_Finger2", "ValveBiped.Bip01_L_Finger21", "ValveBiped.Bip01_L_Finger22", "ValveBiped.Bip01_L_Finger1", "ValveBiped.Bip01_L_Finger11", "ValveBiped.Bip01_L_Finger12", "ValveBiped.Bip01_L_Finger0", "ValveBiped.Bip01_L_Finger01", "ValveBiped.Bip01_L_Finger02"}
local playermodelbonesupper = {"ValveBiped.Bip01_L_Forearm", "ValveBiped.Bip01_L_UpperArm", "ValveBiped.Bip01_L_Clavicle", "ValveBiped.Bip01_L_Hand", "ValveBiped.Bip01_Spine4", "ValveBiped.Bip01_Neck1", "ValveBiped.Bip01_Head1", "ValveBiped.Bip01_L_Finger4", "ValveBiped.Bip01_L_Finger41", "ValveBiped.Bip01_L_Finger42", "ValveBiped.Bip01_L_Finger3", "ValveBiped.Bip01_L_Finger31", "ValveBiped.Bip01_L_Finger32", "ValveBiped.Bip01_L_Finger2", "ValveBiped.Bip01_L_Finger21", "ValveBiped.Bip01_L_Finger22", "ValveBiped.Bip01_L_Finger1", "ValveBiped.Bip01_L_Finger11", "ValveBiped.Bip01_L_Finger12", "ValveBiped.Bip01_L_Finger0", "ValveBiped.Bip01_L_Finger01", "ValveBiped.Bip01_L_Finger02", "ValveBiped.Bip01_R_Forearm", "ValveBiped.Bip01_R_UpperArm", "ValveBiped.Bip01_R_Clavicle", "ValveBiped.Bip01_R_Hand", "ValveBiped.Bip01_R_Finger4", "ValveBiped.Bip01_R_Finger41", "ValveBiped.Bip01_R_Finger42", "ValveBiped.Bip01_R_Finger3", "ValveBiped.Bip01_R_Finger31", "ValveBiped.Bip01_R_Finger32", "ValveBiped.Bip01_R_Finger2", "ValveBiped.Bip01_R_Finger21", "ValveBiped.Bip01_R_Finger22", "ValveBiped.Bip01_R_Finger1", "ValveBiped.Bip01_R_Finger11", "ValveBiped.Bip01_R_Finger12", "ValveBiped.Bip01_R_Finger0", "ValveBiped.Bip01_R_Finger01"}
local tableintensity = {1, 1, 1}
VManip.Reset = function()
VManip.Anims = {}
VManip.VMGesture = nil
VManip.AssurePos = false
VManip.LockToPly = false
VManip.LockZ = 0
VManip.VMCam = nil
VManip.Cam_Ang = properang
VManip.Cam_AngInt = nil
VManip.StartCycle = 0
VManip.Cycle = 0
VManip.CurGesture = nil
VManip.CurGestureData = nil
VManip.GestureMatrix = nil
VManip.Lerp_Peak = nil
VManip.Lerp_Speed_In = nil
VManip.Lerp_Speed_Out = nil
VManip.Lerp_Curve = nil
VManip.Duration = 0
VManip.HoldTime = nil
VManip.HoldQuit = false
VManip.PreventQuit = false
VManip.QueuedAnim = nil
VManip.Segmented = false
VManip.SegmentFinished = false
VManip.CurSegment = nil
VManip.LastSegment = false
VManip.SegmentCount = 0
VManip.CurSegmentSequence = nil
VManip.GesturePastHold = false
VManip.GestureOnHold = false
VManip.Attachment = nil
end
VManip.Remove = function()
if VManip:IsActive() then
hook.Run("VManipPreRemove", VManip:GetCurrentAnim())
end
if IsValid(VManip.VMGesture) then
VManip.VMGesture:Remove()
end
if IsValid(VManip.VMCam) then
VManip.VMCam:Remove()
end
VManip.VMGesture = nil
VManip.AssurePos = false
VManip.LockToPly = false
VManip.LockZ = 0
VManip.VMCam = nil
VManip.Cam_Ang = properang
VManip.Cam_AngInt = nil
VManip.Cycle = 0
VManip.StartCycle = 0
VManip.Attachment = nil
VManip.CurGesture = nil
VManip.CurGestureData = nil
VManip.GestureMatrix = nil
VManip.Lerp_Peak = nil
VManip.Lerp_Speed_In = nil
VManip.Lerp_Speed_Out = nil
VManip.Duration = 0
VManip.HoldTime = nil
VManip.HoldQuit = false
VManip.PreventQuit = false
VManip.QueuedAnim = nil
VManip.Segmented = false
VManip.SegmentFinished = false
VManip.CurSegment = nil
VManip.LastSegment = false
VManip.SegmentCount = 0
VManip.CurSegmentSequence = nil
VManip.GesturePastHold = false
VManip.GestureOnHold = false
hook.Run("VManipRemove")
end
VManip:Reset()
VManip.RegisterAnim = function(self, name, tbl)
self.Anims[name] = tbl
end
VManip.GetAnim = function(self, name) return self.Anims[name] end
VManip.IsActive = function(self) return IsValid(self.VMGesture) end
VManip.GetVMGesture = function(self) return self.VMGesture end
VManip.GetCurrentAnim = function(self) return self.CurGesture end
VManip.GetCurrentSegment = function(self) return self.CurSegment end
VManip.GetCycle = function(self) return self.Cycle end
VManip.SetCycle = function(self, newcycle)
self.Cycle = newcycle
end
VManip.IsSegmented = function(self) return self.Segmented end
VManip.GetSegmentCount = function(self) return self.SegmentCount end
local function PlayVMPSound(ent, sound, anim)
if VManip:GetCurrentAnim() == anim and ent:Alive() then
ent:EmitSound(sound)
end
end
local function PlaySoundsInTable(tbl, animname)
local ply = LocalPlayer()
for k, v in pairs(tbl) do
timer.Simple(v, function()
PlayVMPSound(ply, k, animname)
end)
end
end
VManip.PlaySegment = function(self, sequence, lastsegment, soundtable)
if self:IsActive() and self:IsSegmented() and self.SegmentFinished and not self.LastSegment then
if self:GetVMGesture():LookupSequence(sequence) ~= -1 then
if hook.Run("VManipPrePlaySegment", self:GetCurrentAnim(), sequence, lastsegment) == false then return end
self:GetVMGesture():ResetSequence(sequence)
VManip.CurSegment = sequence
self:SetCycle(0)
VManip.SegmentFinished = false
self.SegmentCount = self.SegmentCount + 1
if lastsegment then
self.LastSegment = true
VManip.Lerp_Peak = curtime + VManip.CurGestureData["lerp_peak"]
end
if soundtable then
PlaySoundsInTable(soundtable, self:GetCurrentAnim())
end
hook.Run("VManipPlaySegment", self:GetCurrentAnim(), sequence, lastsegment)
return true
end
end
return false
end
VManip.IsPreventQuit = function(self) return self.PreventQuit end
VManip.QuitHolding = function(self, animtostop)
if self:IsActive() then
if hook.Run("VManipPreHoldQuit", self:GetCurrentAnim(), animtostop) == false then return end
if (not animtostop and not VManip:IsPreventQuit()) or self:GetCurrentAnim() == animtostop then
self.HoldQuit = true
if self:IsSegmented() then
self.LastSegment = true
end
hook.Run("VManipHoldQuit", self:GetCurrentAnim(), animtostop)
end
if self.QueuedAnim == animtostop then
self.QueuedAnim = nil
end
end
end
--For event related animations that you want to make sure will play no matter what
VManip.QueueAnim = function(self, animtoqueue)
if self:GetAnim(animtoqueue) then
self.QueuedAnim = animtoqueue
end
end
VMLegs.Reset = function()
VMLegs.Anims = {}
VMLegs.LegParent = nil
VMLegs.LegModel = nil
VMLegs.Cycle = 0
VMLegs.StartCycle = 0
VMLegs.SeqID = nil
VMLegs.CurLegs = nil
end
VMLegs.Remove = function()
if IsValid(VMLegs.LegParent) then
VMLegs.LegParent:Remove()
end
if IsValid(VMLegs.LegModel) then
VMLegs.LegModel:Remove()
end
VMLegs.LegParent = nil
VMLegs.LegModel = nil
VMLegs.Cycle = 0
VMLegs.StartCycle = 0
VMLegs.SeqID = nil
VMLegs.CurLegs = nil
end
VMLegs:Reset()
VMLegs.RegisterAnim = function(self, name, tbl)
self.Anims[name] = tbl
end
VMLegs.GetAnim = function(self, name) return self.Anims[name] end
VMLegs.IsActive = function(self) return IsValid(self.LegParent) end
VMLegs.GetCurrentAnim = function(self) return self.CurLegs end
VManip.PlayAnim = function(self, name)
local ply = LocalPlayer()
if ply:GetViewEntity() ~= ply and not self:IsActive() then return end
--doesnt always work
if IsValid(ply:GetActiveWeapon()) then
if ply:GetActiveWeapon():GetHoldType() == "duel" then return false end
else
return false
end
if ply:InVehicle() or not ply:Alive() then return false end
if self:IsActive() then return false end
local vm = ply:GetViewModel()
local bypass = hook.Run("VManipPreActCheck", name, vm)
if not bypass then
if type(ply:GetActiveWeapon().GetStatus) == "function" then
if ply:GetActiveWeapon():GetStatus() == 5 then return false end
end
if vm:GetSequenceActivity(vm:GetSequence()) == ACT_VM_RELOAD then return false end
end
local animtoplay = self:GetAnim(name)
if not animtoplay then
print("Invalid anim", name)
return false
end
if hook.Run("VManipPrePlayAnim", name) == false then return false end
curtime = CurTime()
self.Remove()
self.GesturePastHold = false
self.GestureOnHold = false
self.CurGestureData = animtoplay
self.CurGesture = name
self.Lerp_Peak = curtime + animtoplay["lerp_peak"]
vmatrixpeakinfo = animtoplay["lerp_peak"]
self.Lerp_Speed_In = animtoplay["lerp_speed_in"] or 1
self.Lerp_Speed_Out = animtoplay["lerp_speed_out"] or 1
self.Loop = animtoplay["loop"]
VManip_modelname = animtoplay["model"]
vmanipholdtime = animtoplay["holdtime"]
self.VMGesture = ClientsideModel("models/" .. VManip_modelname, RENDERGROUP_BOTH)
self.VMCam = ClientsideModel("models/" .. VManip_modelname, RENDERGROUP_BOTH) --Saves me the headache of attachment shit
self.Cam_AngInt = animtoplay["cam_angint"] or tableintensity
self.SeqID = self.VMGesture:LookupSequence(name)
if animtoplay["assurepos"] then
self.VMGesture:SetPos(ply:EyePos())
VManip.AssurePos = true
elseif not animtoplay["locktoply"] then
self.VMGesture:SetPos(vm:GetPos())
end
if animtoplay["locktoply"] then
self.LockToPly = true
local eyepos = ply:EyePos()
self.VMGesture:SetAngles(ply:EyeAngles())
self.VMGesture:SetPos(eyepos)
self.LockZ = eyepos.z
else
self.VMGesture:SetAngles(vm:GetAngles())
self.VMGesture:SetParent(vm)
end
self.Cam_Ang = animtoplay["cam_ang"] or properang
self.VMCam:SetPos(vector_origin)
self.VMCam:SetAngles(angle_zero)
self.VMGesture:ResetSequenceInfo()
self.VMGesture:SetPlaybackRate(1)
self.VMGesture:ResetSequence(self.SeqID)
self.VMCam:ResetSequenceInfo()
self.VMCam:SetPlaybackRate(1)
self.VMCam:ResetSequence(self.SeqID)
self.VMatrixlerp = 1
self.Speed = animtoplay["speed"] or 1
self.Lerp_Curve = animtoplay["lerp_curve"] or 1
self.StartCycle = animtoplay["startcycle"] or 0
self.Segmented = animtoplay["segmented"] or false
self.HoldTime = animtoplay["holdtime"] or nil
self.HoldTimeData = self.HoldTime
self.PreventQuit = animtoplay["preventquit"] or false
if self.HoldTime then
self.HoldTime = curtime + self.HoldTime
end
self.Cycle = self.StartCycle
self.VMGesture:SetNoDraw(true)
self.VMCam:SetNoDraw(true)
self.Duration = self.VMGesture:SequenceDuration(self.SeqID)
if animtoplay["sounds"] and animtoplay["sounds"] ~= {} then
PlaySoundsInTable(animtoplay["sounds"], self.CurGesture)
end
hook.Run("VManipPostPlayAnim", name)
return true
end
VMLegs.PlayAnim = function(self, name)
if self:IsActive() then return false end
local animtoplay = self:GetAnim(name)
if not animtoplay then
print("Invalid anim", name)
return false
end
local ply = LocalPlayer()
self.Cycle = 0
self.CurLegs = name
self.Speed = animtoplay["speed"]
self.FBoost = animtoplay["forwardboost"]
self.UBoost = animtoplay["upwardboost"]
self.UBoostCache = Vector(0, 0, self.UBoost)
local model = animtoplay["model"]
local vm = ply:GetViewModel()
local vmang = vm:GetAngles()
local vmpos = vm:GetPos()
self.LegParent = ClientsideModel("models/" .. model, RENDERGROUP_BOTH)
self.LegParent:SetPos(vmpos)
self.LegParent:SetParent(vm)
local legang = vm:GetAngles()
legang = Angle(0, legang.y, 0)
VMLegs.LegParent:SetAngles(legang)
self.LegModel = ClientsideModel(string.Replace(ply:GetModel(), "models/models/", "models/"), RENDERGROUP_TRANSLUCENT)
self.LegModel:SetPos(vmpos)
self.LegModel:SetAngles(vmang)
local plyhands = ply:GetHands()
if IsValid(plyhands) then
self.LegModel.GetPlayerColor = plyhands.GetPlayerColor --yes, this is how you do player color. Fucking lol
end
self.LegModel:SetParent(self.LegParent)
self.LegModel:AddEffects(EF_BONEMERGE)
for i = 0, self.LegModel:GetNumBodyGroups() do
local bodyg = ply:GetBodygroup(i)
self.LegModel:SetBodygroup(i, bodyg)
end
for k, v in pairs(playermodelbonesupper) do
local plybone = self.LegModel:LookupBone(v)
if plybone ~= nil then
self.LegModel:ManipulateBoneScale(plybone, Vector(0, 0, 0))
end
end
self.SeqID = self.LegParent:LookupSequence(name)
self.LegParent:ResetSequenceInfo()
self.LegParent:SetPlaybackRate(1)
self.LegParent:ResetSequence(self.SeqID)
end
--#########################--
local posparentcache
local curtimecheck = 0 --prevents the hook from ever running twice in the same frame
hook.Add("PostDrawViewModel", "VManip", function(vm, ply, weapon)
if VManip:IsActive() then
curtime = CurTime()
if curtime == curtimecheck and not gui.IsGameUIVisible() then return end
curtimecheck = CurTime()
--Some SWEPs have RIDICULOUS offsets
if VManip.AssurePos then
if posparentcache ~= weapon then
posparentcache = weapon
VManip.VMGesture:SetParent(nil)
VManip.VMGesture:SetPos(EyePos())
VManip.VMGesture:SetAngles(vm:GetAngles())
VManip.VMGesture:SetParent(vm)
end
end
--A more cruel version of AssurePos
if VManip.LockToPly then
local eyeang = ply:EyeAngles()
local eyepos = EyePos()
local vmang = vm:GetAngles()
local finang = eyeang - vmang
finang.y = 0 --fucks up on 180
local newang = eyeang + (finang * 0.25)
VManip.VMGesture:SetAngles(newang)
VManip.VMGesture:SetPos(eyepos)
end
--fun fact, this only runs on respawn for an obvious reason
if not ply:Alive() then
VManip:Remove()
return
end
--VManip.VMGesture:FrameAdvance(FrameTime()*VManip.Speed) --shit the bed, don't use this
if VManip.Loop then
if VManip.Cycle >= 1 then
VManip.Lerp_Peak = curtime + VManip.CurGestureData["lerp_peak"]
VManip.Cycle = 0
end
if VManip.HoldQuit then
VManip.Loop = false
end
end
if not VManip.GestureOnHold then
VManip.Cycle = VManip.Cycle + FrameTime() * VManip.Speed
end
VManip.VMGesture:SetCycle(VManip.Cycle)
VManip.VMCam:SetCycle(VManip.Cycle)
if VManip.HoldTime then
if curtime >= VManip.HoldTime and not VManip.GestureOnHold and not VManip.GesturePastHold and not VManip.HoldQuit then
-- local seqdur=VManip.VMGesture:SequenceDuration()
-- VManip.Cycle=(VManip.HoldTimeData)/(seqdur) ply:ChatPrint(seqdur)
-- VManip.VMGesture:SetCycle(VManip.Cycle)
VManip.GestureOnHold = true
elseif VManip.HoldQuit and VManip.GestureOnHold then
VManip.GestureOnHold = false
VManip.GesturePastHold = true
VManip.Lerp_Peak = curtime + VManip.CurGestureData["lerp_peak"] - VManip.CurGestureData["holdtime"]
end
end
if (curtime < VManip.Lerp_Peak or (VManip:IsSegmented() and not VManip.LastSegment)) and (not VManip.GestureOnHold or VManip.GesturePastHold) then
VManip.VMatrixlerp = math.Clamp(VManip.VMatrixlerp - (FrameTime() * 7) * VManip.Lerp_Speed_In, 0, 1)
elseif not VManip.Loop and (not VManip.GestureOnHold or VManip.GesturePastHold) then
if not VManip:IsSegmented() or VManip.LastSegment then
VManip.VMatrixlerp = math.Clamp(VManip.VMatrixlerp + (FrameTime() * 7) * VManip.Lerp_Speed_Out, 0, 1)
end
end
local rigpick2 = leftarmbones
local rigpick = leftarmbones
VManip.VMGesture:SetupBones()
VManip.VMGesture:DrawModel()
--[[The actual manipulation part below]]
for k, v in pairs(rigpick) do
if v == "ValveBiped.Bip01_L_Ulna" then
local lb = VManip.VMGesture:LookupBone("ValveBiped.Bip01_L_Forearm")
if lb then
VManip.GestureMatrix = VManip.VMGesture:GetBoneMatrix(lb)
end
else
local lb = VManip.VMGesture:LookupBone(rigpick2[k])
if lb then
VManip.GestureMatrix = VManip.VMGesture:GetBoneMatrix(lb)
end
end
local VMBone = vm:LookupBone(v)
if VMBone ~= nil then
local VMBoneMatrix = vm:GetBoneMatrix(VMBone)
if VMBoneMatrix then
local VMBoneMatrixCache = VMBoneMatrix:ToTable()
local VMGestureMatrixCache = VManip.GestureMatrix:ToTable()
for k, v in pairs(VMGestureMatrixCache) do
for l, b in pairs(v) do
VMGestureMatrixCache[k][l] = LerpC(VManip.VMatrixlerp, b, VMBoneMatrixCache[k][l], VManip.Lerp_Curve)
end
end
if type(ply:GetActiveWeapon().GetStatus) == "function" then
if ply:GetActiveWeapon():GetStatus() ~= 5 then
vm:SetBoneMatrix(VMBone, Matrix(VMGestureMatrixCache))
end
else
vm:SetBoneMatrix(VMBone, Matrix(VMGestureMatrixCache))
end
end
end
end
if VManip.Cycle >= 1 and not VManip.Loop then
if VManip:IsSegmented() and not VManip.SegmentFinished then
VManip.SegmentFinished = true
hook.Run("VManipSegmentFinish", VManip:GetCurrentAnim(), VManip:GetCurrentSegment(), VManip.LastSegment, VManip:GetSegmentCount())
elseif VManip:IsSegmented() and VManip.LastSegment then
if VManip.VMatrixlerp >= 1 then
VManip:Remove()
end
elseif not VManip:IsSegmented() then
if VManip.CurGestureData["loop"] then
if VManip.VMatrixlerp >= 1 then
VManip:Remove()
end
else
VManip.Remove()
return
end
end
end
elseif VManip.QueuedAnim then
if VManip:PlayAnim(VManip.QueuedAnim) then
VManip.QueuedAnim = nil
end
end
end)
local anglef = Angle(0, 1, 0)
--Very basic stuff, you see
hook.Add("PostDrawViewModel", "VMLegs", function(vm, ply, weapon)
if VMLegs:IsActive() then
-- if ply:GetViewEntity() != ply then
-- VMLegs.LegModel:SetNoDraw(true)
-- else
-- VMLegs.LegModel:SetNoDraw(false)
-- end
local legang = vm:GetAngles()
legang = Angle(0, legang.y, 0)
VMLegs.LegParent:SetAngles(legang)
VMLegs.LegParent:SetPos(vm:GetPos() + (legang:Forward() * VMLegs.FBoost) + VMLegs.UBoostCache)
VMLegs.Cycle = VMLegs.Cycle + FrameTime() * VMLegs.Speed
VMLegs.LegParent:SetCycle(VMLegs.Cycle)
if VMLegs.Cycle >= 1 then
VMLegs.Remove()
return
end
end
end)
concommand.Add("VManip_List", function(ply)
PrintTable(VManip.Anims)
end)
concommand.Add("VManip_ListSimple", function(ply)
for k, v in pairs(VManip.Anims) do
print(k, " | ", v["model"])
end
end)
net.Receive("VManip_SimplePlay", function(len)
local anim = net.ReadString()
VManip:PlayAnim(anim)
end)
--[[Maybe merge these two in one message, using enums]]
net.Receive("VManip_StopHold", function(len)
local anim = net.ReadString()
if anim == "" then
VManip:QuitHolding()
else
VManip:QuitHolding(anim)
end
end)
--CalcView attachments need to be retrieved outside of CalcView
hook.Add("NeedsDepthPass", "VManip_RubatPLZ", function()
--Just gonna slide this in there, yea.
if VManip.QueuedAnim then
local ply = LocalPlayer()
if ply:GetViewEntity() ~= ply or ply:ShouldDrawLocalPlayer() then
VManip.QueuedAnim = nil
end
end
--Good.
if not VManip:IsActive() then return end
if not LocalPlayer():Alive() then
VManip:Remove()
return
end
local allatt = VManip.VMCam:GetAttachments()
if #allatt == 0 then return end
local lookup = allatt[1]["id"]
local att = VManip.VMCam:GetAttachment(lookup)
VManip.Attachment = att
end)
hook.Add("CalcView", "VManip_Cam", function(ply, origin, angles, fov)
if not VManip:IsActive() or not VManip.Attachment then return end
if ply:GetViewEntity() ~= ply or ply:ShouldDrawLocalPlayer() then return end
local view = {}
local camang = VManip.Attachment.Ang - VManip.Cam_Ang
view.angles = angles + Angle(camang.x * VManip.Cam_AngInt[1], camang.y * VManip.Cam_AngInt[2], camang.z * VManip.Cam_AngInt[3])
return view
end)
--ply:ChatPrint(tostring(angles).." | "..tostring(view.angles))
--prevent reload hook
hook.Add("StartCommand", "VManip_PreventReload", function(ply, ucmd)
if VManip:IsActive() then
ucmd:RemoveKey(8192)
end
end)
--prevent reload on tfa hook
hook.Add("TFA_PreReload", "VManip_PreventTFAReload", function(wepom, keyreleased)
if VManip:IsActive() then return "no" end
end)
--Time to load everythin'
local function VManip_FindAndImport()
local path = "vmanip/anims/"
local anims = file.Find(path .. "*.lua", "lcl")
for k, v in pairs(anims) do
include(path .. v)
end
print("VManip loaded with " .. table.Count(VManip.Anims) .. " animations")
end
hook.Add("InitPostEntity", "VManip_ImportAnims", function()
VManip_FindAndImport()
hook.Remove("InitPostEntity", "VManip_ImportAnims")
end)
hook.Add("VManipPreActCheck", "VManipArcCWFix", function(name, vm)
local ply = LocalPlayer()
local activewep = ply:GetActiveWeapon()
if activewep.ArcCW then
if activewep:ShouldDrawCrosshair() or vm:GetCycle() > 0.99 then return true end --crossh check is pretty rudimentary
end
end)
--vm getcycle is fucked for some reason except on some anims, makes me wonder
hook.Add("VManipPrePlayAnim", "VManipArcCWReload", function()
local ply = LocalPlayer()
local activewep = ply:GetActiveWeapon()
if activewep.ArcCW then
if activewep:GetNWBool("reloading") then return false end
end
end)
concommand.Add("VManip_FindAndImport", VManip_FindAndImport)
RunConsoleCommand("VManip_FindAndImport") --Runs it again if this file is refreshed

View file

@ -0,0 +1,18 @@
util.AddNetworkString("VManip_SimplePlay")
util.AddNetworkString("VManip_StopHold")
--VManip_SimplePlay: WriteString of anim to play on client (not guaranteed to play)
--VManip_StopHold: WriteString of anim to stop holding on client
local function VManip_FindAndImport()
local path="vmanip/anims/"
local anims=file.Find(path.."*.lua","lsv")
for k,v in pairs(anims) do
AddCSLuaFile(path..v)
end
end
VManip_FindAndImport()

View file

@ -0,0 +1,104 @@
AddCSLuaFile()
--[[ IN BOTH CASES: NAME SHOULD BE THE ACTUAL SEQUENCE NAME
You don't have to put every value, but some like model are obviously needed
Hands
"model" - path to model
"lerp_peak" - time when the hand should transition back to the weapon
"lerp_speed_in" - speed at which the hand transitions into the anim
"lerp_speed_out" - speed at which the hand transitions out of the anim
"lerp_curve" - power of the curve
"speed" - playback speed
"startcycle" - time to start the anim at
"cam_ang" - angle offset for the camera
"cam_angint" - intensity multiplier of the camera
"sounds" - table of sounds, keys represent the path and their value the time it plays at. do not use past holdtime lmao
"loop" - loop the anim instead of stopping
"segmented" - when anim is over, freezes it and waits for SegmentPlay(sequence,lastanim). Repeat if lastanim is false
^Note: lerp peak and related values are used for the "last segment" instead.
"holdtime" - the time when the anim should be paused
"preventquit" - ONLY accept QuitHolding request if the argument is our anim. Use very cautiously
"assurepos" - for important anims, makes sure the position isn't offset by sweps. Use locktoply it's better
"locktoply" - for when assurepos isn't enough.
Legs
"model" - path to model
"speed" - playback speed
"forwardboost" - forward offset
"upboost" - vertical offset (in actual hammer units)
]]
VManip:RegisterAnim("use",
{
["model"]="c_vmanipinteract.mdl",
["lerp_peak"]=0.4,
["lerp_speed_in"]=1,
["lerp_speed_out"]=0.8,
["lerp_curve"]=2.5,
["speed"]=1,
["startcycle"]=0.1,
["sounds"]={},
["loop"]=false
}
)
VManip:RegisterAnim("vault",
{
["model"]="c_vmanipvault.mdl",
["lerp_peak"]=0.4,
["lerp_speed_in"]=1,
["lerp_speed_out"]=0.5,
["lerp_curve"]=1,
["speed"]=1
}
)
VManip:RegisterAnim("handslide",
{
["model"]="c_vmanipvault.mdl",
["lerp_peak"]=0.2,
["lerp_speed_in"]=1,
["lerp_speed_out"]=0.8,
["lerp_curve"]=2,
["speed"]=1.5,
["holdtime"]=0.25,
}
)
VManip:RegisterAnim("adrenalinestim",
{
["model"]="old/c_vmanip.mdl",
["lerp_peak"]=1.1,
["lerp_speed_in"]=1,
["speed"]=0.7,
["sounds"]={},
["loop"]=false
}
)
VManip:RegisterAnim("thrownade",
{
["model"]="c_vmanipgrenade.mdl",
["lerp_peak"]=0.85,
["lerp_speed_in"]=1.2,
["lerp_speed_out"]=1.2,
["lerp_curve"]=1,
["speed"]=1,
["holdtime"]=0.4,
}
)
--###################################
VMLegs:RegisterAnim("test", --lmao, im not recompiling to change THAT shit
{
["model"]="c_vmaniplegs.mdl",
["speed"]=1.5,
["forwardboost"]=4,
["upwardboost"]=0
})

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.