Fixes upload

This commit is contained in:
Jonny_Bro (Nikita) 2023-05-20 12:32:26 +05:00
parent 34aac5df49
commit 8fb56488b4
55 changed files with 333 additions and 1220 deletions

8
FIXES.md Normal file
View file

@ -0,0 +1,8 @@
# Сделанные мной фиксы
> 1. Фикс трёх букв из-за которых нихуя не работало.
> 2. Быстрый поворот на земле (ПКМ пока бежишь/стоишь) включён по умолчанию (Beatrun_QuickturnGround).
> 3. Быстрый поворот только с руками бегуна (Фикс поворотов при прицеливании и т.п.).
> 4. Убрал ваш SteamID в углу потому что могу.
> 5. Фикс ошибки запуска курса.
> 6. Фикс использования хука (пробел по стене когда вы в воздухе) и это починило сохранение времени.
> 7. Фикс сортировки таблицы лидеров.

View file

@ -1,4 +1,4 @@
# beatrun
Official source code release of beatrun made by datae.
# beatrun by datae
Extracted source code from of beatrun's DLL's.
https://send.ephemeral.land/download/3585ba725ca36278/#NG_JZtPyTdlF_JXRUko5Ow

View file

@ -3,13 +3,13 @@ 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")
SWEP.PrintName = "Unarmed"
SWEP.PrintName = "Unarmed"
SWEP.Slot = 0
SWEP.SlotPos = 1
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false
hook.Add("VManipPrePlayAnim", "LOCNoVManip", function()
if LocalPlayer():GetActiveWeapon():GetClass() == "runnerhands" or blinded then
return false
@ -26,14 +26,14 @@ SWEP.BounceWeaponIcon = false
SWEP.DrawWeaponInfoBox = false
SWEP.HoldType = "fist"
SWEP.Spawnable = false
SWEP.AdminSpawnable = false
--[[Just don't draw the hands, we don't need 'em]]
SWEP.UseHands = false
SWEP.ViewModel = "models/runnerhands.mdl"
SWEP.WorldModel = ""
@ -43,7 +43,7 @@ SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
@ -89,7 +89,7 @@ function SWEP:GetViewModelPosition( pos, ang )
if minimalvm:GetBool() then
if !self.posz then self.posz = pos.z end
local seq = self:GetSequence()
if runseq[seq] then
self.posz = Lerp(10*FrameTime(), self.posz, -2)
else
@ -98,7 +98,7 @@ function SWEP:GetViewModelPosition( pos, ang )
pos.z=pos.z + self.posz
end
if oddseq[self:GetSequence()] then return pos, ang end
self.BobScale = 0
ang.x=math.Clamp(ang.x,-10,89)
@ -111,7 +111,7 @@ function SWEP:Deploy()
self.RespawnDelay = 0
self:SetWasOnGround(false)
self:SetBlockAnims(false)
self:SetPunch(1)
RunConsoleCommand("fov_desired", 100)
end
@ -187,8 +187,8 @@ if ply:KeyPressed(IN_JUMP) and self:GetWasOnGround() and !ply:GetJumpTurn() then
ply:ViewPunch(Angle(-2,0,0))
local eyeang = ply:EyeAngles()
eyeang.x = 0
if insidestep and viewmodel:GetCycle() <= 0.1 and GetConVar("Beatrun_QuakeJump"):GetBool() then
if SERVER then
ply:EmitSound("quakejump.mp3", 100, 100, 0.2)
@ -196,7 +196,7 @@ if ply:KeyPressed(IN_JUMP) and self:GetWasOnGround() and !ply:GetJumpTurn() then
ply.QuakeJumping = true
self:SetQuakeJumping(true)
end
if !ismoving and !ply:Crouching() then
ParkourEvent("jumpstill",ply)
elseif !ply:Crouching() then
@ -262,11 +262,11 @@ if CLIENT then
self.RunWind1 = CreateSound(self, "clotheswind.wav")
self.RunWind2 = CreateSound(self, "runwind.wav")
end
if velocity>250 and cvarwindsound:GetBool() then
self.RunWind1:Play()
self.RunWind2:Play()
self.RunWindVolume = math.Clamp(self.RunWindVolume + (0.5*FrameTime()), 0, 1)
self.RunWind1:ChangeVolume(self.RunWindVolume)
self.RunWind2:ChangeVolume(self.RunWindVolume)
@ -351,7 +351,7 @@ local tr = {}
local tr_result = {}
function SWEP:PrimaryAttack()
local ply = self.Owner
if ply:KeyDown(IN_USE) and game.SinglePlayer() then
local mult = (ply:InOverdrive() and 1) or 1.25
local fovmult = (mult == 1 and 1) or 1.1
@ -360,16 +360,16 @@ function SWEP:PrimaryAttack()
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120)*fovmult, 0.125)
return
end
if !ply:OnGround() or ply:Crouching() or ply:GetSliding() or ply:GetGrappling() or ply:GetWallrun() != 0 then
return
end
local curseq = self:GetSequence()
local infall = curseq==19
if infall then return end
if CurTime() > self:GetPunchReset() then
self:SetPunch(1)
end
@ -383,27 +383,27 @@ function SWEP:PrimaryAttack()
ply:ViewPunch(self.punchangles[punch])
self:SetNextPrimaryFire(CurTime()+self.punchdelays[punch])
self:SetPunchReset(CurTime()+0.5)
tr.start = ply:GetShootPos()
tr.endpos = ply:GetShootPos() + ply:GetAimVector() * 50
tr.filter = ply
tr.mins = Vector( -8 , -8 , -8 )
tr.maxs = Vector( 8 , 8 , 8 )
tr.output = tr_result
if ply:IsPlayer() then
ply:LagCompensation( true )
self:SetHoldType( "fist" )
ply:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_HL2MP_GESTURE_RANGE_ATTACK_FIST, true)
end
util.TraceHull( tr )
self:EmitSound("mirrorsedge/Melee/armswoosh"..math.random(1, 6)..".wav")
if ply:IsPlayer() then
ply:LagCompensation( false )
end
if tr_result.Hit then
self:EmitSound("mirrorsedge/Melee/fist"..math.random(1, 5)..".wav")
local ent = tr_result.Entity
@ -416,7 +416,7 @@ function SWEP:PrimaryAttack()
d:SetDamageType( DMG_CLUB )
d:SetDamagePosition(tr.start)
d:SetDamageForce(ply:EyeAngles():Forward()*7000)
ent:TakeDamageInfo( d )
if ent:IsNPC() then
ent:SetActivity(ACT_FLINCH_HEAD)
@ -433,7 +433,7 @@ function SWEP:PrimaryAttack()
self:SetPunch(1)
end
end
function SWEP:SecondaryAttack()

View file

@ -10,10 +10,12 @@ welcome.outlinecolor = Color(54, 55, 56)
welcome.alpha = 0.9
welcome.elements = {}
/*
local function closebutton(self)
LocalPlayer():EmitSound("holygrenade.mp3")
AEUI:Clear()
end
*/
local function warnclosebutton(self)
LocalPlayer():EmitSound("holygrenade.mp3")
@ -22,17 +24,13 @@ local function warnclosebutton(self)
bigboy = true
end
if not game.SinglePlayer() then
return
end
if not game.SinglePlayer() then return end
local addons = 0
local warning = Material("vgui/warning.png")
local shit = {
["378401390"] = true,
["2027577882"] = true,
["1440226338"] = true,
["1418478031"] = true,
["1190705063"] = true,
["123514260"] = true,
["2416989205"] = true,
@ -41,15 +39,12 @@ local shit = {
["2230307188"] = true,
["2137973704"] = true,
["577145478"] = true,
["2589006389"] = true,
["1632091428"] = true,
["104548572"] = true,
["1622199072"] = true,
["2840019616"] = true,
["583517911"] = true,
["2106330193"] = true,
["2593047682"] = true,
["2564569716"] = true,
["142911907"] = true,
["2316713217"] = true
}
@ -211,4 +206,4 @@ if conflictlist.string ~= "" then
AEUI:AddPanel(warnpanel)
AEUI:AddPanel(conflictpanel)
end)
end
end

View file

@ -55,15 +55,15 @@ deleteonend = true
lockang = false
CamAddAng = false
CamIgnoreAng = false
local BodyAnimPos = Vector(0, 0, 0)
local BodyAnimAngLerp = Angle(0, 0, 0)
local DidDraw = false
-- local BodyAnimPos = Vector(0, 0, 0)
-- local BodyAnimAngLerp = Angle(0, 0, 0)
-- local DidDraw = false
local AnimString = "nil"
local angclosenuff = false
-- local angclosenuff = false
local savedeyeangb = Angle(0, 0, 0)
local bodylockview = false
local bodyanimdone = false
local holstertime = 0
-- local bodylockview = false
-- local bodyanimdone = false
-- local holstertime = 0
local animmodelstring = ""
local showweapon = false
local showvm = false
@ -94,12 +94,10 @@ local justremoved = false
function RemoveBodyAnim(noang)
local shouldremove = hook.Run("BodyAnimPreRemove")
if shouldremove then
return
end
if shouldremove then return end
local ply = LocalPlayer()
local ang = ply:EyeAngles()
-- local ang = ply:EyeAngles()
local newang = ply:EyeAngles()
local noang = noang or false
@ -142,11 +140,8 @@ function RemoveBodyAnim(noang)
end
BodyAnim:Remove()
justremoved = true
ply:DrawViewModel(true)
DidDraw = false
end
@ -158,9 +153,9 @@ function RemoveBodyAnim(noang)
currentwep:PlayViewModelAnimation("Draw")
else
weapontoidle = currentwep
currentwep:SendWeaponAnim(ACT_VM_DRAW)
timer.Simple(vm:SequenceDuration(vm:SelectWeightedSequence(ACT_VM_DRAW)), function ()
timer.Simple(vm:SequenceDuration(vm:SelectWeightedSequence(ACT_VM_DRAW)), function()
if ply:GetActiveWeapon() == weapontoidle and weapontoidle:GetSequenceActivityName(weapontoidle:GetSequence()) == "ACT_VM_DRAW" then
weapontoidle:GetSequenceActivityName(weapontoidle:GetSequence())
weapontoidle:SendWeaponAnim(ACT_VM_IDLE)
@ -223,9 +218,7 @@ armbones = {
}
function CacheBodyAnim()
if not IsValid(BodyAnim) then
return
end
if not IsValid(BodyAnim) then return end
local pos = LocalPlayer():GetPos()
@ -234,9 +227,7 @@ function CacheBodyAnim()
for i = 0, BodyAnim:GetBoneCount() - 1 do
local m = BodyAnim:GetBoneMatrix(i)
m:SetTranslation(m:GetTranslation() - pos)
cachebody[i] = m
end
@ -257,37 +248,33 @@ function CacheLerpBodyAnim()
BodyAnimMDL:SetNoDraw(true)
local pos = LocalPlayer():GetPos()
local posdelta = pos - matrixfrompos
-- local posdelta = pos - matrixfrompos
local self = BodyAnim
self.m = self.m or Matrix()
local from = matrixfrom
local to = matrixto
for bone = 0, self:GetBoneCount() - 1 do
if not armbones[BodyAnim:GetBoneName(bone)] then
if not to[bone] then
to[bone] = {
{},
{},
{}
}
to[bone] = {{}, {}, {}}
end
local ModelBoneMatrix = BodyAnim:GetBoneMatrix(bone)
ModelBoneMatrix:SetTranslation(ModelBoneMatrix:GetTranslation())
from[bone] = cachebody[bone]:FastToTable(from[bone]) or from[bone]
to[bone] = to[bone] or ModelBoneMatrix:FastToTable(to[bone])
local bonematrix = self:GetBoneMatrix(bone)
bonematrix:SetTranslation(bonematrix:GetTranslation() - pos)
to[bone] = bonematrix:FastToTable(to[bone])
for i = 1, 3 do
local from = from[bone][i]
local v = to[bone][i]
v[1] = LerpL(transitionlerp, from[1], v[1])
v[2] = LerpL(transitionlerp, from[2], v[2])
v[3] = LerpL(transitionlerp, from[3], v[3])
@ -301,8 +288,8 @@ function CacheLerpBodyAnim()
local bt1 = bt[1]
local bt2 = bt[2]
local bt3 = bt[3]
slot15 = bt[4]
slot15 = bt[4]
self.m:SetUnpacked(bt1[1], bt1[2], bt1[3], bt1[4], bt2[1], bt2[2], bt2[3], bt2[4], bt3[1], bt3[2], bt3[3], bt3[4], 0, 0, 0, 1)
end
@ -321,20 +308,12 @@ end
function StartBodyAnim(animtable)
local prestart = hook.Run("BodyAnimPreStart", animtable)
if prestart then
return
end
if IsValid(BodyAnim) and not justremoved then
return
end
if prestart then return end
if IsValid(BodyAnim) and not justremoved then return end
justremoved = false
local ply = LocalPlayer()
if ply:InVehicle() then
return
end
if ply:InVehicle() then return end
animmodelstring = animtable.animmodelstring
AnimString = animtable.AnimString
@ -356,6 +335,7 @@ function StartBodyAnim(animtable)
customcycle = animtable.customcycle or false
showweapon = animtable.showweapon or false
showvm = animtable.showvm or false
ply.OrigEyeAng = ply:EyeAngles()
ply.OrigEyeAng.x = 0
@ -372,24 +352,18 @@ function StartBodyAnim(animtable)
end
hook.Add("CalcView", "BodyAnimCalcView2", BodyAnimCalcView2)
BodyAnimAngLerp = ply:EyeAngles()
if AnimString == nil or not ply:Alive() and not deathanim then
return
end
if AnimString == nil or not ply:Alive() and not deathanim then return end
savedeyeangb = Angle(0, 0, 0)
BodyAnim = ClientsideModel("models/" .. tostring(animmodelstring) .. ".mdl", RENDERGROUP_BOTH)
BodyAnim:SetAngles(Angle(0, ply:EyeAngles().y, 0))
BodyAnim:SetPos(ply:GetPos())
BodyAnim:SetNoDraw(false)
BodyAnimStartPos:Set(BodyAnim:GetPos())
if not IsValid(ply:GetHands()) then
return
end
if not IsValid(ply:GetHands()) then return end
local plymodel = ply
local playermodel = string.Replace(ply:GetModel(), "models/models/", "models/")
@ -403,7 +377,6 @@ function StartBodyAnim(animtable)
end
BodyAnimMDL:SnatchModelInstance(ply)
BodyAnimMDLarm = ClientsideModel(handsmodel, RENDERGROUP_BOTH)
function BodyAnimMDLarm.GetPlayerColor()
@ -460,7 +433,6 @@ function StartBodyAnim(animtable)
if tobool(showweapon) and IsValid(ply:GetActiveWeapon()) and ply:GetActiveWeapon():GetModel() ~= "" then
BodyAnimWEPMDL = ClientsideModel(ply:GetActiveWeapon():GetModel(), RENDERGROUP_BOTH)
BodyAnimWEPMDL:SetPos(ply:GetPos())
BodyAnimWEPMDL:SetAngles(Angle(0, EyeAngles().y, 0))
BodyAnimWEPMDL:SetParent(BodyAnim)
@ -482,10 +454,8 @@ function StartBodyAnim(animtable)
hook.Run("BodyAnimStart")
end
hook.Add("Think", "BodyAnimThink", function ()
if not IsValid(BodyAnim) then
return
end
hook.Add("Think", "BodyAnimThink", function()
if not IsValid(BodyAnim) then return end
local ply = LocalPlayer()
@ -513,7 +483,6 @@ local BodyAnimPosEaseLerp = 1
function BodyAnimSetEase(pos)
BodyAnimPosEase:Set(pos)
BodyAnimPosEaseLerp = 0
end
@ -525,7 +494,7 @@ local lerpedpos = Vector()
local lastlockang = false
local lastlockangstart = Angle()
local lasteyeang = Angle()
local lerpedang = Vector()
-- local lerpedang = Vector()
function BodyAnimCalcView2(ply, pos, angles, fov)
if ply:InVehicle() then
@ -600,6 +569,7 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
if lerpchangeatt < 1 then
local attachId = BodyAnim:LookupAttachment(savedatt)
lastattdata = BodyAnim:GetAttachment(attachId) or attach
lerpedpos = LerpVector(lerpchangeatt, lastattdata.Pos, attach.Pos)
lerpchangeatt = math.Approach(lerpchangeatt, 1, FrameTime() * 5)
@ -651,10 +621,9 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
end
view.angles = ang
view.angles:Add(ViewTiltAngle)
allowedangchange = false
local neweyeang = Angle(view.angles)
neweyeang.y = BodyAnim:GetAngles().y
neweyeang.z = 0
@ -682,7 +651,6 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
elseif not IsValid(BodyAnim) and endlerp == 1 then
attach = nil
endlerp = 0
hook.Remove("CalcView", "BodyAnimCalcView2")
if IsValid(vm) then
@ -697,16 +665,20 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
local FT = RealFrameTime()
ang[1] = 0
ang[3] = 0
local MEAng = math.Truncate(ang.y, 2)
local target = not lockang and MEAng or ply.OrigEyeAng.y
viewtiltlerp.y = math.ApproachAngle(viewtiltlerp.y, target, FT * (1 + math.abs(math.AngleDifference(viewtiltlerp.y, target)) * 5))
local MEAngDiff = math.AngleDifference(viewtiltlerp.y, not lockang and lastangy or ply.OrigEyeAng.y) * 0.15
ViewTiltAngle = Angle(0, 0, MEAngDiff + viewtiltlerp.z)
view.angles:Add(ViewTiltAngle)
ply:SetNoDraw(false)
view.angles:Add(ply:GetViewPunchAngles() + ply:GetCLViewPunchAngles())
hook.Run("BodyAnimCalcView", view)
pos:Set(view.origin)
angles:Set(view.angles)
@ -724,7 +696,6 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
end
lastangy = ang.y
hook.Run("CalcViewBA", ply, pos, angles)
return
@ -735,7 +706,6 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
if attach == nil or CurTime() < (mantletimer or 0) then
view.origin = lastattachpos
pos:Set(lastattachpos)
return
@ -743,22 +713,22 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
end
end
hook.Add("CreateMove", "BodyLimitMove", function (cmd)
local ply = LocalPlayer()
hook.Add("CreateMove", "BodyLimitMove", function(cmd)
-- local ply = LocalPlayer()
if IsValid(BodyAnimMDL) and not allowmove then
cmd:ClearButtons()
cmd:ClearMovement()
end
end)
hook.Add("PostDrawOpaqueRenderables", "IgnoreZBodyAnim", function (depth, sky)
hook.Add("PostDrawOpaqueRenderables", "IgnoreZBodyAnim", function(depth, sky)
if IsValid(BodyAnimMDL) then
CacheLerpBodyAnim()
if ignorez then
cam.IgnoreZ(true)
BodyAnimMDL:DrawModel()
local customarmdraw = hook.Run("BodyAnimDrawArm")
if not customarmdraw and IsValid(BodyAnimMDLarm) then
@ -770,13 +740,13 @@ hook.Add("PostDrawOpaqueRenderables", "IgnoreZBodyAnim", function (depth, sky)
end
end)
local lasteyeang = Angle()
-- local lasteyeang = Angle()
local lastlimitx = 0
local lastlimity = 0
local pastlimitx = false
local pastlimity = false
hook.Add("CreateMove", "BodyAnim_Mouse", function (cmd)
hook.Add("CreateMove", "BodyAnim_Mouse", function(cmd)
local ply = LocalPlayer()
if not lockang and IsValid(BodyAnim) then
@ -796,7 +766,6 @@ hook.Add("CreateMove", "BodyAnim_Mouse", function (cmd)
if BodyAnimLimitEase then
ply:CLViewPunch(Angle(-0.2, 0, 0))
ang.x = math.Approach(ang.x, oang.x + limitx, FrameTime() * 125)
else
ang.x = oang.x + limitx
@ -832,7 +801,8 @@ hook.Add("CreateMove", "BodyAnim_Mouse", function (cmd)
lastlimitx = BodyLimitX
end
end)
hook.Add("InputMouseApply", "BodyAnim_Mouse", function (cmd)
hook.Add("InputMouseApply", "BodyAnim_Mouse", function(cmd)
local newvalues = false
if lockang then
@ -844,17 +814,13 @@ hook.Add("InputMouseApply", "BodyAnim_Mouse", function (cmd)
if pastlimitx then
cmd:SetMouseY(0)
newvalues = true
end
if pastlimity then
cmd:SetMouseX(0)
newvalues = true
end
if newvalues then
return true
end
end)
if newvalues then return true end
end)

View file

@ -2,12 +2,10 @@ local stress = 0
local breathin = true
nextbreath = 0
hook.Add("Tick", "BreathingLogic", function ()
hook.Add("Tick", "BreathingLogic", function()
local ply = LocalPlayer()
if not IsValid(ply) or not ply:Alive() or ply:WaterLevel() == 3 then
return
end
if not IsValid(ply) or not ply:Alive() or ply:WaterLevel() == 3 then return end
local vel = ply:GetVelocity()
local CT = CurTime()
@ -24,9 +22,7 @@ hook.Add("Tick", "BreathingLogic", function ()
stress = math.Clamp(stress, -50, 150)
if stress == -50 and breathin then
return
end
if stress == -50 and breathin then return end
local breathtype = breathin and "In" or "Out"
local breathstring = stress > 50 and "Medium" or "Soft"
@ -43,4 +39,4 @@ hook.Add("Tick", "BreathingLogic", function ()
nextbreath = CT + (vel > 200 and 0.5 or 1.25 + math.random(0, 0.1)) + extradur
breathin = not breathin
end
end)
end)

View file

@ -48,6 +48,7 @@ local function infostring()
r = math.Round(r)
y = math.Round(y)
p = math.Round(p)
local a = "Index: " .. BuildModeIndex .. "\nSelected: " .. table.Count(buildmode_selected) .. "\nAngle: " .. p .. ", " .. y .. ", " .. r
return a
@ -100,11 +101,12 @@ function GenerateBuildModeRT(model)
render.PushFilterMin(TEXFILTER.ANISOTROPIC)
render.PushRenderTarget(tex, 0, 0, texw, texh)
render.SuppressEngineLighting(true)
dummy:SetModel(model)
local sicon = PositionSpawnIcon(dummy, vector_origin)
cam.Start3D(sicon.origin, sicon.angles, sicon.fov)
render.Clear(0, 0, 0, 0)
render.ClearDepth()
render.SetWriteDepthToDestAlpha(false)
@ -114,20 +116,23 @@ function GenerateBuildModeRT(model)
render.SetModelLighting(3, 4, 4, 4)
render.SetModelLighting(4, 3, 3, 3)
render.SetModelLighting(5, 4, 4, 4)
dummy:DrawModel()
cam.End3D()
render.PopRenderTarget()
render.PopFilterMag()
render.PopFilterMin()
render.SuppressEngineLighting(false)
rtcache[model] = tex
local mat = CreateMaterial("BM-" .. model, "UnlitGeneric", {
["$vertexcolor"] = 1,
["$translucent"] = 1,
["$vertexalpha"] = 1,
["$basetexture"] = tex:GetName()
})
rtmatcache[model] = mat
end
@ -148,7 +153,6 @@ local function BMPropClick(e)
BuildModeCreateGhost()
GhostModel:SetModel(buildmode_props[BuildModeIndex] or buildmode_entmodels[BuildModeIndex])
PlaceStartPos = nil
PlaceEndPos = nil
PlaceAxisLock = 0
@ -191,9 +195,11 @@ local function BuildModeElements()
row = 1
col = 0
local img = AEUI:AddImage(propspanel, Material("vgui/empty.png"), BMPropClick, 0, 0, 64, 64)
img.prop = 0
img.hover = "Select"
local buildmode_enticons = {
br_swingbar = Material("vgui/editor/swingbar.png"),
br_swingpipe = Material("vgui/editor/swingpipe.png"),
@ -205,15 +211,18 @@ local function BuildModeElements()
br_mat = Material("vgui/editor/mat.png"),
tt_cp = Material("vgui/editor/checkpoint.png")
}
local buildmode_entnames = {
br_zipline = "Zipline (SHIFT = 2-Way)"
}
local obsolete = Material("editor/obsolete")
for k, v in pairs(buildmode_ents) do
local img = AEUI:AddImage(propspanel, buildmode_enticons[k] or obsolete, BMPropClick, 64 * row, 64 * col, 64, 64)
img.prop = k
img.hover = buildmode_entnames[k] or scripted_ents.GetMember(k, "PrintName")
row = row + 1
if row > 5 then
@ -223,7 +232,6 @@ local function BuildModeElements()
end
propspanel.elements = propspanel_elements
hook.Remove("InitPostEntity", "BuildModeElements")
end
@ -244,4 +252,4 @@ local function BMPanel(state)
end
end
hook.Add("BuildModeState", "BMPanel", BMPanel)
hook.Add("BuildModeState", "BMPanel", BMPanel)

View file

@ -5,25 +5,28 @@ local ry = 0
local gy = 0
local by = 0
local black = Material("vgui/black")
local ca_r = CreateMaterial("ca_r", "UnlitGeneric", {
["$ignorez"] = 1,
["$basetexture"] = "vgui/black",
["$additive"] = 1,
["$color2"] = "[1 0 0]"
})
local ca_g = CreateMaterial("ca_g", "UnlitGeneric", {
["$ignorez"] = 1,
["$basetexture"] = "vgui/black",
["$additive"] = 1,
["$color2"] = "[0 1 0]"
})
local ca_b = CreateMaterial("ca_b", "UnlitGeneric", {
["$ignorez"] = 1,
["$basetexture"] = "vgui/black",
["$additive"] = 1,
["$color2"] = "[0 0 1]"
})
local zoom = Material("vgui/zoom.vtf")
-- local zoom = Material("vgui/zoom.vtf")
local function CA(rx, gx, bx, ry, gy, by)
render.UpdateScreenEffectTexture()
@ -33,6 +36,7 @@ local function CA(rx, gx, bx, ry, gy, by)
ca_r:SetTexture("$basetexture", screentx)
ca_g:SetTexture("$basetexture", screentx)
ca_b:SetTexture("$basetexture", screentx)
render.SetMaterial(black)
render.DrawScreenQuad()
render.SetMaterial(ca_r)
@ -78,7 +82,7 @@ surface.CreateFont("DaisyHUDSmall", {
})
local deletiontable = {}
local deletiontime = 0
-- local deletiontime = 0
local deletiontypetime = 0
local deletiontype = 0
deletionentry = 0
@ -123,7 +127,6 @@ local deletionlen = 0
function DrawDeletionText()
surface.SetFont("DaisyHUDSmall")
local oldgi = GlitchIntensity
if incredits then
@ -160,7 +163,6 @@ function DrawDeletionText()
deletionrare = deletionrare
deletiontype = 0
deletionentry = deletionentry + 1
table.insert(deletiontable, deletionstringc)
if #deletiontable >= 6 then
@ -168,8 +170,7 @@ function DrawDeletionText()
end
end
local tw, th = surface.GetTextSize(deletionstringc)
local _, th = surface.GetTextSize(deletionstringc)
cam.Start2D()
local num = 0
@ -180,12 +181,10 @@ function DrawDeletionText()
vp:Add(vpcl)
local GlitchIntensity = incredits and 2 or GlitchIntensity
surface.SetTextColor(255, 255, 255, 2.5 * (num + 1) * GlitchIntensity)
for k, v in ipairs(deletiontable) do
surface.SetTextColor(255, 255, 255, 2.5 * k * GlitchIntensity)
local text = v
for i = 1, 4 do
@ -198,7 +197,6 @@ function DrawDeletionText()
surface.SetTextPos(ScrW() * 0.01 + vp.x, ScrH() * 0.05 + (k - 1) * th + vp.y)
surface.DrawText(text)
num = k
end
@ -208,6 +206,5 @@ function DrawDeletionText()
end
cam.End2D()
GlitchIntensity = oldgi
end
end

View file

@ -1,5 +1,5 @@
net.Receive("DeathStopSound", function ()
net.Receive("DeathStopSound", function()
if not blinded then
RunConsoleCommand("stopsound")
end
end)
end)

View file

@ -47,11 +47,7 @@ TraceCount = 0
function TraceLine_d(data)
local result = TraceLine_o(data)
table.insert(traces, {
Vector(data.start),
Vector(data.endpos),
result.Hit and color_red or color_white
})
table.insert(traces, {Vector(data.start), Vector(data.endpos), result.Hit and color_red or color_white})
return result
end
@ -59,7 +55,7 @@ end
local function DrawDebugInfo()
local sx = ScrW() * startx
local sy = ScrH() * starty
local htw = 0
-- local htw = 0
surface.SetFont("BeatrunDebug")
surface.SetTextPos(sx, sy)
@ -93,15 +89,13 @@ local function RenderTraces()
end
cam.End3D()
TraceCount = #traces
table.Empty(traces)
end
local debugging = false
concommand.Add("Beatrun_DebugToggle", function ()
concommand.Add("Beatrun_DebugToggle", function()
debugging = not debugging
if debugging then
@ -115,7 +109,6 @@ concommand.Add("Beatrun_DebugToggle", function ()
else
hook.Remove("HUDPaint", "DrawDebugInfo")
hook.Remove("PostRender", "RenderTraces")
util.TraceLine = TraceLine_o
end
end)
end)

View file

@ -78,9 +78,7 @@ valvebiped = {
local scalevec = Vector(1, 1, 1)
local function Disarm_Render(self)
if not IsValid(self) or not IsValid(self.ModelBM) or not IsValid(self.Victim) then
return
end
if not IsValid(self) or not IsValid(self.ModelBM) or not IsValid(self.Victim) then return end
local owner = self.Victim
@ -112,6 +110,7 @@ local function Disarm_Render(self)
for i = 1, 3 do
local from = self.bonematrixtablefrom[lookbone][i]
local v = self.bonematrixtableto[lookbone][i]
v[1] = LerpL(blerpvalue, v[1], from[1])
v[2] = LerpL(blerpvalue, v[2], from[2])
v[3] = LerpL(blerpvalue, v[3], from[3])
@ -186,12 +185,9 @@ function Disarm_BlockMove(cmd)
end
function Disarm_Init(victim)
if not IsValid(victim) then
return
end
if not IsValid(victim) then return end
local ply = LocalPlayer()
Disarm_CleanUp()
local eyeang = ply:EyeAngles()
@ -201,19 +197,19 @@ function Disarm_Init(victim)
ParkourEvent("disarmscar", ply, true)
ply.OrigEyeAng = eyeang
BodyAnim:SetAngles(eyeang)
victim.InDisarm = true
ply.DisarmForcedEnd = CurTime() + 4
ply.DisarmVictim = ClientsideModel("models/disarmvictim.mdl")
ply.DisarmVictimMDL = ClientsideModel(victim:GetModel())
local victimanim = ply.DisarmVictim
local victimMDL = ply.DisarmVictimMDL
victimanim.bonelerpvalue = 0
victimanim:SetSequence("snatchscar")
victimanim.ModelBM = victimMDL
victimanim.bonematrixtablefrom = {}
victimanim.bonematrixtableto = {}
@ -232,20 +228,19 @@ function Disarm_Init(victim)
hook.Add("Think", "Disarm_Think", Disarm_Think)
hook.Add("CreateMove", "Disarm_BlockMove", Disarm_BlockMove)
victimanim.RenderOverride = Disarm_Render
timer.Simple(0.001, function ()
timer.Simple(0.001, function()
victim.DisarmNoDraw = true
victim:SetNoDraw(true)
end)
end
net.Receive("DisarmStart", function ()
net.Receive("DisarmStart", function()
Disarm_Init(net.ReadEntity())
end)
hook.Add("CreateClientsideRagdoll", "Disarm_Ragdoll", function (ent, oldrag)
hook.Add("CreateClientsideRagdoll", "Disarm_Ragdoll", function(ent, oldrag)
if ent.InDisarm then
local ply = LocalPlayer()
local victimanim = ply.DisarmVictim
@ -259,11 +254,10 @@ hook.Add("CreateClientsideRagdoll", "Disarm_Ragdoll", function (ent, oldrag)
for i = 0, rag:GetNumBodyGroups() do
local bodyg = oldrag:GetBodygroup(i)
rag:SetBodygroup(i, bodyg)
end
local vel = Vector()
-- local vel = Vector()
local num = rag:GetPhysicsObjectCount() - 1
for i = 0, num do
@ -284,13 +278,15 @@ hook.Add("CreateClientsideRagdoll", "Disarm_Ragdoll", function (ent, oldrag)
end
oldrag:Remove()
timer.Simple(30, function ()
timer.Simple(30, function()
if IsValid(rag) then
rag:SetSaveValue("m_bFadingOut", true)
end
end)
timer.Simple(0, function ()
timer.Simple(0, function()
Disarm_CleanUp()
end)
end
end)
end)

View file

@ -1,40 +1,45 @@
sound.Add( {
sound.Add({
name = "FallStatic",
channel = CHAN_STATIC,
volume = 1,
level = 80,
pitch = 100,
sound = "MirrorsEdge/FallStatic.wav"
} )
})
local zoom = Material("vgui/zoom.vtf")
local nextbeat = 0
local beatvol = 0.3
local blurpass = 0
local vignettealpha = 0
local function FallCheck()
local ply = LocalPlayer()
if !IsValid(ply) then return end
if not IsValid(ply) then return end
local speed = ply:GetVelocity().z
if !ply.FallStatic and speed <= -800 and ply:GetMoveType()!=MOVETYPE_NOCLIP then
if not ply.FallStatic and speed <= -800 and ply:GetMoveType() ~= MOVETYPE_NOCLIP then
ply:EmitSound("FallStatic")
ply.FallStatic = true
nextbeat = CurTime()+0.5
nextbeat = CurTime() + 0.5
beatvol = 0.3
blurpass = 0
vignettealpha = 0
CamShake = true
CamShakeMult = 0
if !ply:GetJumpTurn() then
if not ply:GetJumpTurn() then
ParkourEvent("falluncontrolled", ply, true)
end
elseif ply.FallStatic and speed > -800 then
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120))
ply:StopSound("FallStatic")
ply.FallStatic = false
CamShake = false
ParkourEvent("fallrecover", ply, true)
end
end
@ -43,40 +48,46 @@ hook.Add("Tick", "FallCheck", FallCheck)
local function FallEffect()
local ply = LocalPlayer()
if ply.FallStatic then
local vel = math.abs(ply:GetVelocity().z)/1400
local vel = math.abs(ply:GetVelocity().z) / 1400
local csm = CamShakeMult
-- DrawMotionBlur( 0.4, 0.8, 0.015*vel )
CamShakeMult = math.Approach(csm, 3, FrameTime()*1.5)
DrawMaterialOverlay( "effects/fall_warp", CamShakeMult*0.025 )
if blurpass >= 1 then
-- DrawToyTown(math.Truncate(blurpass), ScrH()*blurpass)
end
CamShakeMult = math.Approach(csm, 3, FrameTime() * 1.5)
DrawMaterialOverlay("effects/fall_warp", CamShakeMult * 0.025)
if blurpass >= 1 then return end -- DrawToyTown(math.Truncate(blurpass), ScrH()*blurpass)
if CurTime() > nextbeat then
nextbeat = CurTime() + math.Clamp(0.5 / vel, 0.3, 0.5)
ply:EmitSound("heartbeat_beat_0"..math.random(1,8)..".wav", 80, 100, beatvol)
beatvol = math.min(beatvol+0.05, 1)
blurpass = math.min(blurpass+0.1, 10)
ply:EmitSound("heartbeat_beat_0" .. math.random(1, 8) .. ".wav", 80, 100, beatvol)
beatvol = math.min(beatvol + 0.05, 1)
blurpass = math.min(blurpass + 0.1, 10)
end
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120)+math.Rand(0, CamShakeMult*2.5))
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120) + math.Rand(0, CamShakeMult * 2.5))
end
end
hook.Add("RenderScreenspaceEffects", "FallEffect", FallEffect)
hook.Add("HUDPaint", "FallVignette", function()
if !LocalPlayer().FallStatic then return end
vignettealpha = math.min(255, vignettealpha+(FrameTime()*100))
if not LocalPlayer().FallStatic then return end
vignettealpha = math.min(255, vignettealpha + (FrameTime() * 100))
surface.SetMaterial(zoom)
surface.SetDrawColor(255,255,255,vignettealpha)
surface.DrawTexturedRect(0,0,ScrW(),ScrH())
surface.DrawTexturedRectRotated(ScrW()*0.5,ScrH()*0.5,ScrW(),ScrH(),180)
surface.SetDrawColor(255, 255, 255, vignettealpha)
surface.DrawTexturedRect(0, 0, ScrW(), ScrH())
surface.DrawTexturedRectRotated(ScrW() * 0.5, ScrH() * 0.5, ScrW(), ScrH(), 180)
end)
hook.Add("InputMouseApply", "FallLock", function(cmd, x, y, ang)
if LocalPlayer().FallStatic then
cmd:SetMouseX(0)
cmd:SetMouseY(0)
return true
end
end)

View file

@ -11,6 +11,7 @@ local hide = {
CHudHealth = true,
CHudDamageIndicator = true
}
local inf = math.huge
hook.Add("HUDShouldDraw", "BeatrunHUDHide", function (name)
if hide[name] then
@ -31,10 +32,8 @@ local tab = {
["$pp_colour_colour"] = color
}
hook.Add("RenderScreenspaceEffects", "BeatrunNoclipBW", function ()
if render.GetDXLevel() < 90 then
return
end
hook.Add("RenderScreenspaceEffects", "BeatrunNoclipBW", function()
if render.GetDXLevel() < 90 then return end
local ply = LocalPlayer()
local inp = color ~= 1
@ -42,7 +41,6 @@ hook.Add("RenderScreenspaceEffects", "BeatrunNoclipBW", function ()
if noclipping or inp then
tab["$pp_colour_colour"] = color
DrawColorModify(tab)
end
@ -54,10 +52,10 @@ hook.Add("RenderScreenspaceEffects", "BeatrunNoclipBW", function ()
if LocalPlayer():Health() < 100 then
tab["$pp_colour_colour"] = math.max(LocalPlayer():Health() / LocalPlayer():GetMaxHealth(), 0)
DrawColorModify(tab)
end
end)
surface.CreateFont("BeatrunHUD", {
shadow = true,
blursize = 0,
@ -75,6 +73,7 @@ surface.CreateFont("BeatrunHUD", {
weight = 500,
size = ScreenScale(7)
})
surface.CreateFont("BeatrunHUDSmall", {
shadow = true,
blursize = 0,
@ -96,9 +95,7 @@ surface.CreateFont("BeatrunHUDSmall", {
local blur = Material("pp/blurscreen")
local function DrawBlurRect(x, y, w, h, a)
if render.GetDXLevel() < 90 then
return
end
if render.GetDXLevel() < 90 then return end
local X = 0
local Y = 0
@ -125,13 +122,12 @@ local function BeatrunHUD()
surface.SetFont("DebugFixedSmall")
local vtext = VERSIONGLOBAL
local tw, th = surface.GetTextSize(vtext)
surface.SetTextColor(255, 255, 255, 15)
surface.SetTextPos(scrw - tw, 0)
surface.DrawText(vtext)
surface.SetFont("BeatrunHUD")
-- local vtext = (ply:SteamID() or "?") .. " | " .. VERSIONGLOBAL
-- local tw, th = surface.GetTextSize(vtext)
-- surface.SetTextColor(255, 255, 255, 15)
-- surface.SetTextPos(scrw - tw, 0)
-- surface.DrawText(vtext)
-- surface.SetFont("BeatrunHUD")
local pl = ply:GetNW2Int("PLoss")
local CT = CurTime()
@ -151,19 +147,12 @@ local function BeatrunHUD()
end
end
if BuildMode then
return
end
if hidden:GetInt() > 1 then
return
end
if BuildMode then return end
if hidden:GetInt() > 1 then return end
local shoulddraw = hook.Run("BeatrunDrawHUD")
if shoulddraw == false then
return
end
if shoulddraw == false then return end
local vp = ply:GetViewPunchAngles()
@ -175,7 +164,7 @@ local function BeatrunHUD()
local coursename = nil
local customname = hook.Run("BeatrunHUDCourse")
coursename = customname and customname or Course_Name ~= "" and Course_Name or "Freeplay"
local lastxp = ply.LastXP or 0
-- local lastxp = ply.LastXP or 0
local nicktext = nil
if showtotalXP:GetBool() then
@ -185,14 +174,11 @@ local function BeatrunHUD()
end
surface.SetFont("BeatrunHUDSmall")
local nickw, nickh = surface.GetTextSize(nicktext)
surface.SetFont("BeatrunHUD")
local coursew, courseh = surface.GetTextSize(coursename)
local coursew, _ = surface.GetTextSize(coursename)
local bgpadw = nickw
local bgpadh = nickh
-- local bgpadh = nickh
if bgpadw < coursew then
bgpadw = coursew
@ -209,7 +195,9 @@ local function BeatrunHUD()
surface.SetDrawColor(20, 20, 20, math.max(150 - hidealpha, 50))
surface.DrawRect(-20 + vp.z, scrh * 0.895 + vp.x, 40, SScaleY(85))
DrawBlurRect(20 + vp.z, scrh * 0.895 + vp.x, SScaleX(bgpadding), SScaleY(85), math.max(255 - hidealpha, 2))
surface.SetDrawColor(20, 20, 20, math.max(100 - hidealpha, 50))
surface.DrawOutlinedRect(20 + vp.z, scrh * 0.895 + vp.x, SScaleX(bgpadding), SScaleY(85))
surface.SetFont("BeatrunHUD")

View file

@ -4,46 +4,45 @@ local apikey = CreateConVar("beatrun_apikey", "0", true, {
})
function UploadCourse()
print("This is dangerous as you'd be connecting to a potentionally malicious site. If you wish to reenable this functionality, find this string in the beatrun folder and uncomment some stuff.")
--if Course_Name == "" or Course_ID == "" then
-- print("Can't upload in Freeplay")
--
-- -- return
-- --end
--
-- --local file = file.Open("beatrun/courses/" .. game.GetMap() .. "/" .. Course_ID .. ".txt", "rb", "DATA")
-- --local filedata = util.Decompress(file:Read(file:Size()))
--
-- --local function h_failed(reason)
-- -- print("HTTP failed: ", reason)
-- --end
--
-- --local function h_success(code, body, headers)
-- -- print(body)
-- --end
--
-- --local h_method = "POST"
-- --local h_url = "https://datae.org/beatrun/upload.php"
-- --local h_headers = {
-- -- ["Content-Type"] = "text/plain",
-- -- ["Content-Length"] = filedata:len(),
-- -- ["User-Agent"] = "Beatrun/1.0.0",
-- -- ["Accept-Encoding"] = "gzip, deflate",
-- -- Authorization = apikey:GetString(),
-- -- ["Game-Map"] = game.GetMap()
-- --}
-- --local h_type = "text/plain"
-- --local h_body = filedata
--
-- --HTTP({
-- -- failed = h_failed,
-- -- success = h_success,
-- -- method = h_method,
-- -- url = h_url,
-- -- headers = h_headers,
-- -- type = h_type,
-- -- body = h_body
--})
if Course_Name == "" or Course_ID == "" then
print("Can't upload in Freeplay")
return
end
local file = file.Open("beatrun/courses/" .. game.GetMap() .. "/" .. Course_ID .. ".txt", "rb", "DATA")
local filedata = util.Decompress(file:Read(file:Size()))
local function h_failed(reason)
print("HTTP failed: ", reason)
end
local function h_success(code, body, headers)
print(body)
end
local h_method = "POST"
local h_url = "https://datae.org/beatrun/upload.php"
local h_headers = {
["Content-Type"] = "text/plain",
["Content-Length"] = filedata:len(),
["User-Agent"] = "Beatrun/1.0.0",
["Accept-Encoding"] = "gzip, deflate",
Authorization = apikey:GetString(),
["Game-Map"] = game.GetMap()
}
local h_type = "text/plain"
local h_body = filedata
HTTP({
failed = h_failed,
success = h_success,
method = h_method,
url = h_url,
headers = h_headers,
type = h_type,
body = h_body
})
end
concommand.Add("Beatrun_UploadCourse", UploadCourse)
@ -56,28 +55,27 @@ local GetCourse_Errors = {
}
function GetCourse(sharecode)
print("This is dangerous as you'd be connecting to a potentionally malicious site. If you wish to reenable this functionality, find this string in the beatrun folder and uncomment some stuff.")
--http.Fetch("https://datae.org/beatrun/getcourse.php?sharecode=" .. sharecode .. "&map=" .. game.GetMap() .. "&key=" .. apikey:GetString(), function (body, length, headers, code)
-- local errorcode = GetCourse_Errors[body]
--
-- -- if not errorcode then
-- -- print("Success | Code:", code, "Length:", length)
-- -- PrintTable(headers)
-- -- LoadCourseRaw(util.Compress(body))
--
-- -- return true
-- -- else
-- -- print(errorcode)
--
-- -- return false
-- -- end
-- --end, function (message)
-- -- print("An error occurred.", message)
--
-- -- return false
-- --end, {
-- -- ["accept-encoding"] = "gzip, deflate"
--})
http.Fetch("https://datae.org/beatrun/getcourse.php?sharecode=" .. sharecode .. "&map=" .. game.GetMap() .. "&key=" .. apikey:GetString(), function (body, length, headers, code)
local errorcode = GetCourse_Errors[body]
if not errorcode then
print("Success | Code:", code, "Length:", length)
PrintTable(headers)
LoadCourseRaw(util.Compress(body))
return true
else
print(errorcode)
return false
end
end, function (message)
print("An error occurred.", message)
return false
end, {
["accept-encoding"] = "gzip, deflate"
})
end
concommand.Add("Beatrun_LoadCode", function (ply, cmd, args, argstr)

View file

@ -4,23 +4,17 @@ local SScaleX_cached = {}
local SScaleY_cached = {}
function SScaleX(sizex)
local iswide = AEUI.ScrW / AEUI.ScrH > 1.6
if SScaleX_cached[sizex] then
return SScaleX_cached[sizex]
end
-- local iswide = AEUI.ScrW / AEUI.ScrH > 1.6
if SScaleX_cached[sizex] then return SScaleX_cached[sizex] end
SScaleX_cached[sizex] = math.ceil(sizex / (1920 / AEUI.ScrW))
return SScaleX_cached[sizex]
end
function SScaleY(sizey)
local iswide = AEUI.ScrW / AEUI.ScrH > 1.6
if SScaleY_cached[sizey] then
return SScaleY_cached[sizey]
end
-- local iswide = AEUI.ScrW / AEUI.ScrH > 1.6
if SScaleY_cached[sizey] then return SScaleY_cached[sizey] end
SScaleY_cached[sizey] = math.ceil(sizey / (1080 / AEUI.ScrH))
@ -109,9 +103,7 @@ function AEUI:DrawPanel(panel)
end
function AEUI:AddPanel(panel)
if table.HasValue(AEUI.Panels, panel) then
return
end
if table.HasValue(AEUI.Panels, panel) then return end
table.insert(AEUI.Panels, panel)
gui.EnableScreenClicker(true)
@ -131,6 +123,7 @@ function AEUI:AddText(panel, str, font, x, y, centered, color)
y = y or 0
centered = centered or false
color = color or color_white
local text = {
x = x,
y = y,
@ -152,8 +145,8 @@ function AEUI:AddButton(panel, str, func, font, x, y, centered, color)
y = y or 0
centered = centered or false
color = color or color_white
func = func or function ()
end
func = func or function() end
local button = {
x = x,
y = y,
@ -176,8 +169,8 @@ function AEUI:AddImage(panel, mat, func, x, y, w, h, color)
y = y or 0
centered = centered or false
color = color or color_white
func = func or function ()
end
func = func or function() end
local image = {
x = x,
y = y,
@ -206,9 +199,7 @@ function AEUI:DrawElement(panel, data)
end
local function AEUIDraw()
if AEUI.NoDraw then
return
end
if AEUI.NoDraw then return end
for k, v in ipairs(AEUI.Panels) do
surface.SetAlphaMultiplier(v.alpha or 1)
@ -222,7 +213,6 @@ local function AEUIDraw()
end
render.SetScissorRect(0, 0, 0, 0, false)
local maxscroll = math.abs(v.maxscroll or 0)
if (v.maxscroll or 0) > 0 then
@ -241,7 +231,6 @@ local function AEUIDraw()
if e.hover then
local mx = AEUI.MX + SScaleX(20)
local my = AEUI.MY + SScaleY(20)
surface.SetTextColor(255, 255, 255)
surface.SetFont("AEUIDefault")
@ -262,7 +251,7 @@ local function AEUIDraw()
end
hook.Add("HUDPaint", "AEUIDraw", AEUIDraw)
hook.Add("StartCommand", "AEUI_StartCommand", function (ply, cmd)
hook.Add("StartCommand", "AEUI_StartCommand", function(ply, cmd)
local mx = gui.MouseX()
local my = gui.MouseY()
AEUI.MY = my
@ -313,7 +302,6 @@ hook.Add("StartCommand", "AEUI_StartCommand", function (ply, cmd)
if v.onclick and click and AEUI.LastClick < CurTime() then
v:onclick()
AEUI.LastClick = CurTime() + 0.1
end
@ -327,7 +315,8 @@ hook.Add("StartCommand", "AEUI_StartCommand", function (ply, cmd)
AEUI.HoveredElement = nil
end
end)
hook.Add("OnScreenSizeChanged", "AEUI_ScreenSize", function ()
hook.Add("OnScreenSizeChanged", "AEUI_ScreenSize", function()
AEUI.ScrH = ScrH()
AEUI.ScrW = ScrW()
@ -453,9 +442,7 @@ function AEUI.Elements.Button(panel, data)
if data.centered then
datah = th + 4
dataw = tw + 4
surface.DrawOutlinedRect(ox + SScaleX(data.x) - tw * 0.5 - 2, oy + SScaleY(data.y) - th * 0.5 - 2, dataw, datah)
local x = ox + SScaleX(data.x) - tw * 0.5
local y = oy + SScaleY(data.y) - th * 0.5
@ -467,9 +454,7 @@ function AEUI.Elements.Button(panel, data)
else
datah = th
dataw = tw
surface.DrawOutlinedRect(ox + SScaleX(data.x), oy + SScaleY(data.y), tw, th)
local x = ox + SScaleX(data.x)
local y = oy + SScaleY(data.y)
@ -482,9 +467,7 @@ function AEUI.Elements.Button(panel, data)
data.h = datah
data.w = dataw
surface.DrawText(v)
posy = posy - oy - SScaleY(panel.h)
if not panel.maxscroll or panel.maxscroll < posy then
@ -515,7 +498,7 @@ function AEUI.Elements.Image(panel, data)
end
local posy = 0
local x = ox + SScaleX(data.x)
-- local x = ox + SScaleX(data.x)
local y = oy + SScaleY(data.y)
if isgreyed then
@ -541,4 +524,4 @@ function AEUI.Elements.Image(panel, data)
if not panel.maxscroll or panel.maxscroll < posy then
panel.maxscroll = posy
end
end
end

View file

@ -13,9 +13,7 @@ local function push_left(self, x)
end
local function pop_right(self)
if self:is_empty() then
return nil
end
if self:is_empty() then return nil end
local r = self[self.tail]
self[self.tail] = nil
@ -25,12 +23,11 @@ local function pop_right(self)
end
local function pop_left(self)
if self:is_empty() then
return nil
end
if self:is_empty() then return nil end
local r = self[self.head + 1]
self.head = self.head + 1
local r = self[self.head]
self[self.head] = nil
@ -48,7 +45,7 @@ end
local function iter_left(self)
local i = self.head
return function ()
return function()
if i < self.tail then
i = i + 1
@ -60,7 +57,7 @@ end
local function iter_right(self)
local i = self.tail + 1
return function ()
return function()
if i > self.head + 1 then
i = i - 1
@ -125,13 +122,13 @@ GlitchIntensity = 0
local tr = {}
local tr_result = {}
local randvector = Vector()
local box_mins = Vector(-0.5, -0.5, -0.5)
local box_maxs = Vector(0.5, 0.5, 0.5)
-- 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 boxang = Angle()
local vanishvec = Vector()
local vanishvecrand = Vector()
-- local boxang = Angle()
-- local vanishvec = Vector()
-- local vanishvecrand = Vector()
vanishrandx = 0.5
vanishrandy = 0.5
vanishrandz = 0.5
@ -172,7 +169,7 @@ local grass = Color(20, 150, 10)
local sand = Color(76, 70, 50)
local glass = Color(10, 20, 150)
local limit = 5400
local pinged = false
-- local pinged = false
local camvector = Vector()
local camang = Angle()
local camlerp = 0
@ -207,7 +204,7 @@ blindcustompoints = {
Vector()
}
local blindcustompoints = blindcustompoints
local sizemult = 1
-- local sizemult = 1
function InvertColors()
for k, v in ipairs(colorslist) do
@ -317,9 +314,7 @@ end
local function Echo(t)
table.insert(soundpoints, t.Pos)
if not blindedsounds[t.SoundName] and t.SoundName:Left(3) ~= "te/" then
return false
end
if not blindedsounds[t.SoundName] and t.SoundName:Left(3) ~= "te/" then return false end
end
local function PopThatMotherfucker()
@ -336,20 +331,19 @@ local meshtbl = meshtbl
pausescan = false
local mathrandom = math.random
/*
local function OptimizeMeshes()
local i = 0
local vertexcount = 0
-- local vertexcount = 0
for v in meshtbl:iter_left() do
if i >= 90 then
break
end
if i >= 90 then break end
v:Destroy()
i = i + 1
end
end
*/
glob_blindangles = Angle()
glob_blindorigin = Vector()
@ -363,13 +357,11 @@ local function Blindness(origin, angles)
local eyeang = angles
local FT = FrameTime()
local quality = quality:GetBool()
glob_blindorigin:Set(origin)
glob_blindangles:Set(angles)
local hitpointscount = nil
local vel_l = ply:GetVelocity():Length()
local vel = 2.5
-- local vel_l = ply:GetVelocity():Length()
-- local vel = 2.5
cang = math.pi * 2 / 16 + (ply.offset or 0)
cpos = Vector(0, math.cos(cang) * 75, math.sin(cang) * 250)
ply.offset = (ply.offset or 0) + FrameTime()
@ -379,7 +371,6 @@ local function Blindness(origin, angles)
end
local randrender = math.Rand(blindrandrendermin, 1)
render.Clear(blindcolor[1] * randrender, blindcolor[2] * randrender, blindcolor[3] * randrender, 0)
render.ClearDepth()
render.ClearStencil()
@ -391,7 +382,6 @@ local function Blindness(origin, angles)
if trace.Hit then
hitpoints:push_right(trace.HitPos)
local invert = mathrandom()
if invert < 0.05 then
@ -399,10 +389,8 @@ local function Blindness(origin, angles)
end
hitnormal:push_right(trace.HitNormal)
local hcol = colors[trace.MatType]
local hcolclass = colorsclass[trace.Entity:GetClass()]
hitcolor:push_right(hcol or hcolclass or white)
if limit < hitpoints:length() then
@ -425,7 +413,6 @@ local function Blindness(origin, angles)
while limit < hitpointscount do
soundpoints:pop_left()
hitpointscount = soundpoints:length()
end
@ -445,20 +432,19 @@ local function Blindness(origin, angles)
end
end
local lastpos = hitpoints[hitpoints.tail]
-- local lastpos = hitpoints[hitpoints.tail]
local f = eyeang:Forward()
local eyediff = Vector()
local k = limit
local k2 = 0
local vanishlimit = vanishlimit
local vanishrandx = vanishrandx
local vanishrandy = vanishrandy
local vanishrandz = vanishrandz
local blindrandx = blindrandx
local blindrandy = blindrandy
local blindrandz = blindrandz
local blindrandobeyglitch = blindrandobeyglitch
-- local vanishlimit = vanishlimit
-- local vanishrandx = vanishrandx
-- local vanishrandy = vanishrandy
-- local vanishrandz = vanishrandz
-- local blindrandx = blindrandx
-- local blindrandy = blindrandy
-- local blindrandz = blindrandz
-- local blindrandobeyglitch = blindrandobeyglitch
render.SetMaterial(circle)
if not customglitch then
@ -482,7 +468,7 @@ local function Blindness(origin, angles)
if not pausescan then
if not curmesh:IsValid() or CurTime() < nextcachecheck then
local dynmesh = nil
-- local dynmesh = nil
if CurTime() < nextcachecheck then
if curmesh:IsValid() then
@ -497,9 +483,7 @@ local function Blindness(origin, angles)
for v in hitpoints:iter_right() do
local col = hitcolor[hitcolor.tail - k2] or BlindGetColor()
eyediff:Set(v)
local drawindex = hitindex % drawcount + 1
if drawindex == 1 then
@ -557,7 +541,7 @@ local function Blindness(origin, angles)
cam.End3D()
hook.Run("Blind3DPost", origin, angles)
local ctsin = math.sin(CurTime())
-- local ctsin = math.sin(CurTime())
local col = white
col.a = alpha
@ -585,7 +569,8 @@ local function BlindnessPreUI()
end
end
local te = "te/metamorphosis/"
-- local te = "te/metamorphosis/"
/*
local jingles = {
land = te .. "3-linedrop",
jump = te .. "1-linemove",
@ -608,6 +593,7 @@ local function BlindnessJingles(event)
LocalPlayer():EmitSound(jingles[event] .. math.random(1, jinglescount[event]) .. ".wav")
end
end
*/
function ToggleBlindness(toggle)
blinded = toggle
@ -662,7 +648,6 @@ function ToggleBlindness(toggle)
if bgm then
bgm:Stop()
bgm = nil
end
@ -674,15 +659,13 @@ function cool()
local k = limit
local k2 = 0
a = Mesh(circle)
mesh.Begin(a, MATERIAL_QUADS, limit)
local ed = Vector()
local meshlen = meshtbl:length()
-- local ed = Vector()
-- local meshlen = meshtbl:length()
for v in hitpoints:iter_right() do
mesh.QuadEasy(v, hitnormal[hitnormal.tail - k2], 2, 2, hitcolor[hitcolor.tail - k2] or white)
k = k - 1
k2 = k2 + 1
end
@ -695,24 +678,27 @@ function cool()
end
end
net.Receive("BlindPlayers", function ()
net.Receive("BlindPlayers", function()
ToggleBlindness(net.ReadBool())
end)
net.Receive("BlindNPCKilled", function ()
net.Receive("BlindNPCKilled", function()
LocalPlayer():EmitSound("bad.wav", 50, 100 + math.random(-5, 2))
end)
hook.Add("OnEntityCreated", "BlindnessEntities", function (ent)
timer.Simple(0.5, function ()
hook.Add("OnEntityCreated", "BlindnessEntities", function(ent)
timer.Simple(0.5, function()
if IsValid(ent) and ent.DrawLOC then
LOCEntities[ent] = true
end
end)
end)
hook.Add("InitPostEntity", "Beatrun_LOC", function ()
hook.Add("InitPostEntity", "Beatrun_LOC", function()
if GetGlobalBool("LOC") then
ToggleBlindness(true)
end
hook.Remove("EntityEmitSound", "zzz_TFA_EntityEmitSound")
hook.Remove("InitPostEntity", "Beatrun_LOC")
end)
end)

View file

@ -1,6 +1,6 @@
include( "shared.lua" )
include("shared.lua")
for k,v in ipairs(file.Find("beatrun/gamemode/cl/*.lua", "LUA")) do
for k, v in ipairs(file.Find("beatrun/gamemode/cl/*.lua", "LUA")) do
print(v)
include("cl/"..v)
include("cl/" .. v)
end

View file

@ -1,17 +1,17 @@
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include( "shared.lua" )
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
for k,v in ipairs(file.Find("beatrun/gamemode/cl/*.lua", "LUA")) do
AddCSLuaFile("cl/"..v)
end
for k, v in ipairs(file.Find("beatrun/gamemode/cl/*.lua", "LUA")) do
AddCSLuaFile("cl/" .. v)
end
for k,v in ipairs(file.Find("beatrun/gamemode/sh/*.lua", "LUA")) do
print(v)
include("sh/"..v)
AddCSLuaFile("sh/"..v)
end
for k, v in ipairs(file.Find("beatrun/gamemode/sh/*.lua", "LUA")) do
print(v)
include("sh/" .. v)
AddCSLuaFile("sh/" .. v)
end
for k,v in ipairs(file.Find("beatrun/gamemode/sv/*.lua", "LUA")) do
include("sv/"..v)
for k, v in ipairs(file.Find("beatrun/gamemode/sv/*.lua", "LUA")) do
include("sv/" .. v)
end

View file

@ -8,7 +8,7 @@ if CLIENT then
return
end
if not ply:Alive() or Course_Name ~= "" and ply:GetNW2Int("CPNum", 1) ~= -1 then
if not ply:Alive() or Course_Name ~= "" then
return
end
@ -69,7 +69,7 @@ hook.Add("SetupMove", "Grapple", function (ply, mv, cmd)
return
end
if not ply:Alive() or Course_Name ~= "" and ply:GetNW2Int("CPNum", 1) ~= -1 and not ply:GetNW2Entity("Swingrope") then
if not ply:Alive() or Course_Name ~= "" then
return
end

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", "1", true, true, "Enables quickturning with secondary attack while on the ground")
end
function DoJumpTurn(lookbehind)
@ -79,7 +79,7 @@ local function Quickturn(ply, mv, cmd)
end
end
if not ply:GetQuickturn() and not ply:GetJumpTurn() and not ply:GetCrouchJump() and not ply:GetGrappling() and keypressed and not mv:KeyDown(IN_MOVELEFT) and not mv:KeyDown(IN_MOVERIGHT) and (ply:GetWallrun() > 0 or not ply:OnGround() or ply:GetInfoNum("Beatrun_QuickturnGround", 0) == 1 and not ply:Crouching()) then
if not ply:GetQuickturn() and not ply:GetJumpTurn() and not ply:GetCrouchJump() and not ply:GetGrappling() and keypressed and not mv:KeyDown(IN_MOVELEFT) and not mv:KeyDown(IN_MOVERIGHT) and (ply:GetWallrun() > 0 or not ply:OnGround() or ply:GetInfoNum("Beatrun_QuickturnGround", 0) == 1 and not ply:Crouching() and ply:GetActiveWeapon():GetClass() == "runnerhands") then
if ply:GetWallrun() == 0 and not ply:OnGround() then
local eyedir = cmd:GetViewAngles()
eyedir.x = 0

View file

@ -1,5 +1,6 @@
local mousex = 0
local mousey = 0
local inf = math.huge
buildmode_props = {}
local propmatsblacklist = {}
local blocksdir = "models/hunter/blocks/"

View file

@ -1,14 +1,14 @@
STAR = ""
REC = ""
VERSIONGLOBAL = "v1.Zero"
DeriveGamemode( "sandbox" )
GM.Name = "Beatrun"
GM.Author = "datae"
GM.Email = "datae@dontemailme.com"
GM.Website = "www.mirrorsedge.com"
include( 'player_class/player_beatrun.lua' )
DeriveGamemode("sandbox")
GM.Name = "Beatrun"
GM.Author = "datae"
GM.Email = "datae@dontemailme.com"
GM.Website = "www.mirrorsedge.com"
include("player_class/player_beatrun.lua")
for k,v in ipairs(file.Find("beatrun/gamemode/sh/*.lua", "LUA")) do
AddCSLuaFile("sh/"..v)
include("sh/"..v)
for k, v in ipairs(file.Find("beatrun/gamemode/sh/*.lua", "LUA")) do
AddCSLuaFile("sh/" .. v)
include("sh/" .. v)
end

View file

@ -1,691 +0,0 @@
--[[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

@ -1,18 +0,0 @@
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

@ -1,104 +0,0 @@
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.