mirror of
https://github.com/JonnyBro/beatrun.git
synced 2025-01-31 03:57:27 +05:00
Fixes upload
This commit is contained in:
parent
34aac5df49
commit
8fb56488b4
55 changed files with 333 additions and 1220 deletions
8
FIXES.md
Normal file
8
FIXES.md
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Сделанные мной фиксы
|
||||||
|
> 1. Фикс трёх букв из-за которых нихуя не работало.
|
||||||
|
> 2. Быстрый поворот на земле (ПКМ пока бежишь/стоишь) включён по умолчанию (Beatrun_QuickturnGround).
|
||||||
|
> 3. Быстрый поворот только с руками бегуна (Фикс поворотов при прицеливании и т.п.).
|
||||||
|
> 4. Убрал ваш SteamID в углу потому что могу.
|
||||||
|
> 5. Фикс ошибки запуска курса.
|
||||||
|
> 6. Фикс использования хука (пробел по стене когда вы в воздухе) и это починило сохранение времени.
|
||||||
|
> 7. Фикс сортировки таблицы лидеров.
|
|
@ -1,4 +1,4 @@
|
||||||
# beatrun
|
# beatrun by datae
|
||||||
Official source code release of beatrun made by datae.
|
Extracted source code from of beatrun's DLL's.
|
||||||
|
|
||||||
https://send.ephemeral.land/download/3585ba725ca36278/#NG_JZtPyTdlF_JXRUko5Ow
|
https://send.ephemeral.land/download/3585ba725ca36278/#NG_JZtPyTdlF_JXRUko5Ow
|
|
@ -10,10 +10,12 @@ welcome.outlinecolor = Color(54, 55, 56)
|
||||||
welcome.alpha = 0.9
|
welcome.alpha = 0.9
|
||||||
welcome.elements = {}
|
welcome.elements = {}
|
||||||
|
|
||||||
|
/*
|
||||||
local function closebutton(self)
|
local function closebutton(self)
|
||||||
LocalPlayer():EmitSound("holygrenade.mp3")
|
LocalPlayer():EmitSound("holygrenade.mp3")
|
||||||
AEUI:Clear()
|
AEUI:Clear()
|
||||||
end
|
end
|
||||||
|
*/
|
||||||
|
|
||||||
local function warnclosebutton(self)
|
local function warnclosebutton(self)
|
||||||
LocalPlayer():EmitSound("holygrenade.mp3")
|
LocalPlayer():EmitSound("holygrenade.mp3")
|
||||||
|
@ -22,17 +24,13 @@ local function warnclosebutton(self)
|
||||||
bigboy = true
|
bigboy = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if not game.SinglePlayer() then
|
if not game.SinglePlayer() then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local addons = 0
|
local addons = 0
|
||||||
local warning = Material("vgui/warning.png")
|
local warning = Material("vgui/warning.png")
|
||||||
local shit = {
|
local shit = {
|
||||||
["378401390"] = true,
|
["378401390"] = true,
|
||||||
["2027577882"] = true,
|
["2027577882"] = true,
|
||||||
["1440226338"] = true,
|
|
||||||
["1418478031"] = true,
|
|
||||||
["1190705063"] = true,
|
["1190705063"] = true,
|
||||||
["123514260"] = true,
|
["123514260"] = true,
|
||||||
["2416989205"] = true,
|
["2416989205"] = true,
|
||||||
|
@ -41,15 +39,12 @@ local shit = {
|
||||||
["2230307188"] = true,
|
["2230307188"] = true,
|
||||||
["2137973704"] = true,
|
["2137973704"] = true,
|
||||||
["577145478"] = true,
|
["577145478"] = true,
|
||||||
["2589006389"] = true,
|
|
||||||
["1632091428"] = true,
|
["1632091428"] = true,
|
||||||
["104548572"] = true,
|
|
||||||
["1622199072"] = true,
|
["1622199072"] = true,
|
||||||
["2840019616"] = true,
|
["2840019616"] = true,
|
||||||
["583517911"] = true,
|
["583517911"] = true,
|
||||||
["2106330193"] = true,
|
["2106330193"] = true,
|
||||||
["2593047682"] = true,
|
["2593047682"] = true,
|
||||||
["2564569716"] = true,
|
|
||||||
["142911907"] = true,
|
["142911907"] = true,
|
||||||
["2316713217"] = true
|
["2316713217"] = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,15 +55,15 @@ deleteonend = true
|
||||||
lockang = false
|
lockang = false
|
||||||
CamAddAng = false
|
CamAddAng = false
|
||||||
CamIgnoreAng = false
|
CamIgnoreAng = false
|
||||||
local BodyAnimPos = Vector(0, 0, 0)
|
-- local BodyAnimPos = Vector(0, 0, 0)
|
||||||
local BodyAnimAngLerp = Angle(0, 0, 0)
|
-- local BodyAnimAngLerp = Angle(0, 0, 0)
|
||||||
local DidDraw = false
|
-- local DidDraw = false
|
||||||
local AnimString = "nil"
|
local AnimString = "nil"
|
||||||
local angclosenuff = false
|
-- local angclosenuff = false
|
||||||
local savedeyeangb = Angle(0, 0, 0)
|
local savedeyeangb = Angle(0, 0, 0)
|
||||||
local bodylockview = false
|
-- local bodylockview = false
|
||||||
local bodyanimdone = false
|
-- local bodyanimdone = false
|
||||||
local holstertime = 0
|
-- local holstertime = 0
|
||||||
local animmodelstring = ""
|
local animmodelstring = ""
|
||||||
local showweapon = false
|
local showweapon = false
|
||||||
local showvm = false
|
local showvm = false
|
||||||
|
@ -94,12 +94,10 @@ local justremoved = false
|
||||||
function RemoveBodyAnim(noang)
|
function RemoveBodyAnim(noang)
|
||||||
local shouldremove = hook.Run("BodyAnimPreRemove")
|
local shouldremove = hook.Run("BodyAnimPreRemove")
|
||||||
|
|
||||||
if shouldremove then
|
if shouldremove then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
local ang = ply:EyeAngles()
|
-- local ang = ply:EyeAngles()
|
||||||
local newang = ply:EyeAngles()
|
local newang = ply:EyeAngles()
|
||||||
local noang = noang or false
|
local noang = noang or false
|
||||||
|
|
||||||
|
@ -142,11 +140,8 @@ function RemoveBodyAnim(noang)
|
||||||
end
|
end
|
||||||
|
|
||||||
BodyAnim:Remove()
|
BodyAnim:Remove()
|
||||||
|
|
||||||
justremoved = true
|
justremoved = true
|
||||||
|
|
||||||
ply:DrawViewModel(true)
|
ply:DrawViewModel(true)
|
||||||
|
|
||||||
DidDraw = false
|
DidDraw = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -158,9 +153,9 @@ function RemoveBodyAnim(noang)
|
||||||
currentwep:PlayViewModelAnimation("Draw")
|
currentwep:PlayViewModelAnimation("Draw")
|
||||||
else
|
else
|
||||||
weapontoidle = currentwep
|
weapontoidle = currentwep
|
||||||
|
|
||||||
currentwep:SendWeaponAnim(ACT_VM_DRAW)
|
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
|
if ply:GetActiveWeapon() == weapontoidle and weapontoidle:GetSequenceActivityName(weapontoidle:GetSequence()) == "ACT_VM_DRAW" then
|
||||||
weapontoidle:GetSequenceActivityName(weapontoidle:GetSequence())
|
weapontoidle:GetSequenceActivityName(weapontoidle:GetSequence())
|
||||||
weapontoidle:SendWeaponAnim(ACT_VM_IDLE)
|
weapontoidle:SendWeaponAnim(ACT_VM_IDLE)
|
||||||
|
@ -223,9 +218,7 @@ armbones = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function CacheBodyAnim()
|
function CacheBodyAnim()
|
||||||
if not IsValid(BodyAnim) then
|
if not IsValid(BodyAnim) then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local pos = LocalPlayer():GetPos()
|
local pos = LocalPlayer():GetPos()
|
||||||
|
|
||||||
|
@ -234,9 +227,7 @@ function CacheBodyAnim()
|
||||||
|
|
||||||
for i = 0, BodyAnim:GetBoneCount() - 1 do
|
for i = 0, BodyAnim:GetBoneCount() - 1 do
|
||||||
local m = BodyAnim:GetBoneMatrix(i)
|
local m = BodyAnim:GetBoneMatrix(i)
|
||||||
|
|
||||||
m:SetTranslation(m:GetTranslation() - pos)
|
m:SetTranslation(m:GetTranslation() - pos)
|
||||||
|
|
||||||
cachebody[i] = m
|
cachebody[i] = m
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -257,37 +248,33 @@ function CacheLerpBodyAnim()
|
||||||
BodyAnimMDL:SetNoDraw(true)
|
BodyAnimMDL:SetNoDraw(true)
|
||||||
|
|
||||||
local pos = LocalPlayer():GetPos()
|
local pos = LocalPlayer():GetPos()
|
||||||
local posdelta = pos - matrixfrompos
|
-- local posdelta = pos - matrixfrompos
|
||||||
local self = BodyAnim
|
local self = BodyAnim
|
||||||
self.m = self.m or Matrix()
|
self.m = self.m or Matrix()
|
||||||
|
|
||||||
local from = matrixfrom
|
local from = matrixfrom
|
||||||
local to = matrixto
|
local to = matrixto
|
||||||
|
|
||||||
for bone = 0, self:GetBoneCount() - 1 do
|
for bone = 0, self:GetBoneCount() - 1 do
|
||||||
if not armbones[BodyAnim:GetBoneName(bone)] then
|
if not armbones[BodyAnim:GetBoneName(bone)] then
|
||||||
if not to[bone] then
|
if not to[bone] then
|
||||||
to[bone] = {
|
to[bone] = {{}, {}, {}}
|
||||||
{},
|
|
||||||
{},
|
|
||||||
{}
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local ModelBoneMatrix = BodyAnim:GetBoneMatrix(bone)
|
local ModelBoneMatrix = BodyAnim:GetBoneMatrix(bone)
|
||||||
|
|
||||||
ModelBoneMatrix:SetTranslation(ModelBoneMatrix:GetTranslation())
|
ModelBoneMatrix:SetTranslation(ModelBoneMatrix:GetTranslation())
|
||||||
|
|
||||||
from[bone] = cachebody[bone]:FastToTable(from[bone]) or from[bone]
|
from[bone] = cachebody[bone]:FastToTable(from[bone]) or from[bone]
|
||||||
to[bone] = to[bone] or ModelBoneMatrix:FastToTable(to[bone])
|
to[bone] = to[bone] or ModelBoneMatrix:FastToTable(to[bone])
|
||||||
|
|
||||||
local bonematrix = self:GetBoneMatrix(bone)
|
local bonematrix = self:GetBoneMatrix(bone)
|
||||||
|
|
||||||
bonematrix:SetTranslation(bonematrix:GetTranslation() - pos)
|
bonematrix:SetTranslation(bonematrix:GetTranslation() - pos)
|
||||||
|
|
||||||
to[bone] = bonematrix:FastToTable(to[bone])
|
to[bone] = bonematrix:FastToTable(to[bone])
|
||||||
|
|
||||||
for i = 1, 3 do
|
for i = 1, 3 do
|
||||||
local from = from[bone][i]
|
local from = from[bone][i]
|
||||||
local v = to[bone][i]
|
local v = to[bone][i]
|
||||||
|
|
||||||
v[1] = LerpL(transitionlerp, from[1], v[1])
|
v[1] = LerpL(transitionlerp, from[1], v[1])
|
||||||
v[2] = LerpL(transitionlerp, from[2], v[2])
|
v[2] = LerpL(transitionlerp, from[2], v[2])
|
||||||
v[3] = LerpL(transitionlerp, from[3], v[3])
|
v[3] = LerpL(transitionlerp, from[3], v[3])
|
||||||
|
@ -301,8 +288,8 @@ function CacheLerpBodyAnim()
|
||||||
local bt1 = bt[1]
|
local bt1 = bt[1]
|
||||||
local bt2 = bt[2]
|
local bt2 = bt[2]
|
||||||
local bt3 = bt[3]
|
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)
|
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
|
end
|
||||||
|
|
||||||
|
@ -321,20 +308,12 @@ end
|
||||||
function StartBodyAnim(animtable)
|
function StartBodyAnim(animtable)
|
||||||
local prestart = hook.Run("BodyAnimPreStart", animtable)
|
local prestart = hook.Run("BodyAnimPreStart", animtable)
|
||||||
|
|
||||||
if prestart then
|
if prestart then return end
|
||||||
return
|
if IsValid(BodyAnim) and not justremoved then return end
|
||||||
end
|
|
||||||
|
|
||||||
if IsValid(BodyAnim) and not justremoved then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
justremoved = false
|
justremoved = false
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
|
if ply:InVehicle() then return end
|
||||||
if ply:InVehicle() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
animmodelstring = animtable.animmodelstring
|
animmodelstring = animtable.animmodelstring
|
||||||
AnimString = animtable.AnimString
|
AnimString = animtable.AnimString
|
||||||
|
@ -356,6 +335,7 @@ function StartBodyAnim(animtable)
|
||||||
customcycle = animtable.customcycle or false
|
customcycle = animtable.customcycle or false
|
||||||
showweapon = animtable.showweapon or false
|
showweapon = animtable.showweapon or false
|
||||||
showvm = animtable.showvm or false
|
showvm = animtable.showvm or false
|
||||||
|
|
||||||
ply.OrigEyeAng = ply:EyeAngles()
|
ply.OrigEyeAng = ply:EyeAngles()
|
||||||
ply.OrigEyeAng.x = 0
|
ply.OrigEyeAng.x = 0
|
||||||
|
|
||||||
|
@ -372,24 +352,18 @@ function StartBodyAnim(animtable)
|
||||||
end
|
end
|
||||||
|
|
||||||
hook.Add("CalcView", "BodyAnimCalcView2", BodyAnimCalcView2)
|
hook.Add("CalcView", "BodyAnimCalcView2", BodyAnimCalcView2)
|
||||||
|
|
||||||
BodyAnimAngLerp = ply:EyeAngles()
|
BodyAnimAngLerp = ply:EyeAngles()
|
||||||
|
|
||||||
if AnimString == nil or not ply:Alive() and not deathanim then
|
if AnimString == nil or not ply:Alive() and not deathanim then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
savedeyeangb = Angle(0, 0, 0)
|
savedeyeangb = Angle(0, 0, 0)
|
||||||
BodyAnim = ClientsideModel("models/" .. tostring(animmodelstring) .. ".mdl", RENDERGROUP_BOTH)
|
BodyAnim = ClientsideModel("models/" .. tostring(animmodelstring) .. ".mdl", RENDERGROUP_BOTH)
|
||||||
|
|
||||||
BodyAnim:SetAngles(Angle(0, ply:EyeAngles().y, 0))
|
BodyAnim:SetAngles(Angle(0, ply:EyeAngles().y, 0))
|
||||||
BodyAnim:SetPos(ply:GetPos())
|
BodyAnim:SetPos(ply:GetPos())
|
||||||
BodyAnim:SetNoDraw(false)
|
BodyAnim:SetNoDraw(false)
|
||||||
BodyAnimStartPos:Set(BodyAnim:GetPos())
|
BodyAnimStartPos:Set(BodyAnim:GetPos())
|
||||||
|
|
||||||
if not IsValid(ply:GetHands()) then
|
if not IsValid(ply:GetHands()) then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local plymodel = ply
|
local plymodel = ply
|
||||||
local playermodel = string.Replace(ply:GetModel(), "models/models/", "models/")
|
local playermodel = string.Replace(ply:GetModel(), "models/models/", "models/")
|
||||||
|
@ -403,7 +377,6 @@ function StartBodyAnim(animtable)
|
||||||
end
|
end
|
||||||
|
|
||||||
BodyAnimMDL:SnatchModelInstance(ply)
|
BodyAnimMDL:SnatchModelInstance(ply)
|
||||||
|
|
||||||
BodyAnimMDLarm = ClientsideModel(handsmodel, RENDERGROUP_BOTH)
|
BodyAnimMDLarm = ClientsideModel(handsmodel, RENDERGROUP_BOTH)
|
||||||
|
|
||||||
function BodyAnimMDLarm.GetPlayerColor()
|
function BodyAnimMDLarm.GetPlayerColor()
|
||||||
|
@ -460,7 +433,6 @@ function StartBodyAnim(animtable)
|
||||||
|
|
||||||
if tobool(showweapon) and IsValid(ply:GetActiveWeapon()) and ply:GetActiveWeapon():GetModel() ~= "" then
|
if tobool(showweapon) and IsValid(ply:GetActiveWeapon()) and ply:GetActiveWeapon():GetModel() ~= "" then
|
||||||
BodyAnimWEPMDL = ClientsideModel(ply:GetActiveWeapon():GetModel(), RENDERGROUP_BOTH)
|
BodyAnimWEPMDL = ClientsideModel(ply:GetActiveWeapon():GetModel(), RENDERGROUP_BOTH)
|
||||||
|
|
||||||
BodyAnimWEPMDL:SetPos(ply:GetPos())
|
BodyAnimWEPMDL:SetPos(ply:GetPos())
|
||||||
BodyAnimWEPMDL:SetAngles(Angle(0, EyeAngles().y, 0))
|
BodyAnimWEPMDL:SetAngles(Angle(0, EyeAngles().y, 0))
|
||||||
BodyAnimWEPMDL:SetParent(BodyAnim)
|
BodyAnimWEPMDL:SetParent(BodyAnim)
|
||||||
|
@ -482,10 +454,8 @@ function StartBodyAnim(animtable)
|
||||||
hook.Run("BodyAnimStart")
|
hook.Run("BodyAnimStart")
|
||||||
end
|
end
|
||||||
|
|
||||||
hook.Add("Think", "BodyAnimThink", function ()
|
hook.Add("Think", "BodyAnimThink", function()
|
||||||
if not IsValid(BodyAnim) then
|
if not IsValid(BodyAnim) then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
|
|
||||||
|
@ -513,7 +483,6 @@ local BodyAnimPosEaseLerp = 1
|
||||||
|
|
||||||
function BodyAnimSetEase(pos)
|
function BodyAnimSetEase(pos)
|
||||||
BodyAnimPosEase:Set(pos)
|
BodyAnimPosEase:Set(pos)
|
||||||
|
|
||||||
BodyAnimPosEaseLerp = 0
|
BodyAnimPosEaseLerp = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -525,7 +494,7 @@ local lerpedpos = Vector()
|
||||||
local lastlockang = false
|
local lastlockang = false
|
||||||
local lastlockangstart = Angle()
|
local lastlockangstart = Angle()
|
||||||
local lasteyeang = Angle()
|
local lasteyeang = Angle()
|
||||||
local lerpedang = Vector()
|
-- local lerpedang = Vector()
|
||||||
|
|
||||||
function BodyAnimCalcView2(ply, pos, angles, fov)
|
function BodyAnimCalcView2(ply, pos, angles, fov)
|
||||||
if ply:InVehicle() then
|
if ply:InVehicle() then
|
||||||
|
@ -600,6 +569,7 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
|
||||||
|
|
||||||
if lerpchangeatt < 1 then
|
if lerpchangeatt < 1 then
|
||||||
local attachId = BodyAnim:LookupAttachment(savedatt)
|
local attachId = BodyAnim:LookupAttachment(savedatt)
|
||||||
|
|
||||||
lastattdata = BodyAnim:GetAttachment(attachId) or attach
|
lastattdata = BodyAnim:GetAttachment(attachId) or attach
|
||||||
lerpedpos = LerpVector(lerpchangeatt, lastattdata.Pos, attach.Pos)
|
lerpedpos = LerpVector(lerpchangeatt, lastattdata.Pos, attach.Pos)
|
||||||
lerpchangeatt = math.Approach(lerpchangeatt, 1, FrameTime() * 5)
|
lerpchangeatt = math.Approach(lerpchangeatt, 1, FrameTime() * 5)
|
||||||
|
@ -651,10 +621,9 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
|
||||||
end
|
end
|
||||||
|
|
||||||
view.angles = ang
|
view.angles = ang
|
||||||
|
|
||||||
view.angles:Add(ViewTiltAngle)
|
view.angles:Add(ViewTiltAngle)
|
||||||
|
|
||||||
allowedangchange = false
|
allowedangchange = false
|
||||||
|
|
||||||
local neweyeang = Angle(view.angles)
|
local neweyeang = Angle(view.angles)
|
||||||
neweyeang.y = BodyAnim:GetAngles().y
|
neweyeang.y = BodyAnim:GetAngles().y
|
||||||
neweyeang.z = 0
|
neweyeang.z = 0
|
||||||
|
@ -682,7 +651,6 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
|
||||||
elseif not IsValid(BodyAnim) and endlerp == 1 then
|
elseif not IsValid(BodyAnim) and endlerp == 1 then
|
||||||
attach = nil
|
attach = nil
|
||||||
endlerp = 0
|
endlerp = 0
|
||||||
|
|
||||||
hook.Remove("CalcView", "BodyAnimCalcView2")
|
hook.Remove("CalcView", "BodyAnimCalcView2")
|
||||||
|
|
||||||
if IsValid(vm) then
|
if IsValid(vm) then
|
||||||
|
@ -697,16 +665,20 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
|
||||||
local FT = RealFrameTime()
|
local FT = RealFrameTime()
|
||||||
ang[1] = 0
|
ang[1] = 0
|
||||||
ang[3] = 0
|
ang[3] = 0
|
||||||
|
|
||||||
local MEAng = math.Truncate(ang.y, 2)
|
local MEAng = math.Truncate(ang.y, 2)
|
||||||
local target = not lockang and MEAng or ply.OrigEyeAng.y
|
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))
|
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
|
local MEAngDiff = math.AngleDifference(viewtiltlerp.y, not lockang and lastangy or ply.OrigEyeAng.y) * 0.15
|
||||||
ViewTiltAngle = Angle(0, 0, MEAngDiff + viewtiltlerp.z)
|
ViewTiltAngle = Angle(0, 0, MEAngDiff + viewtiltlerp.z)
|
||||||
|
|
||||||
view.angles:Add(ViewTiltAngle)
|
view.angles:Add(ViewTiltAngle)
|
||||||
ply:SetNoDraw(false)
|
ply:SetNoDraw(false)
|
||||||
view.angles:Add(ply:GetViewPunchAngles() + ply:GetCLViewPunchAngles())
|
view.angles:Add(ply:GetViewPunchAngles() + ply:GetCLViewPunchAngles())
|
||||||
|
|
||||||
hook.Run("BodyAnimCalcView", view)
|
hook.Run("BodyAnimCalcView", view)
|
||||||
|
|
||||||
pos:Set(view.origin)
|
pos:Set(view.origin)
|
||||||
angles:Set(view.angles)
|
angles:Set(view.angles)
|
||||||
|
|
||||||
|
@ -724,7 +696,6 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
|
||||||
end
|
end
|
||||||
|
|
||||||
lastangy = ang.y
|
lastangy = ang.y
|
||||||
|
|
||||||
hook.Run("CalcViewBA", ply, pos, angles)
|
hook.Run("CalcViewBA", ply, pos, angles)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -735,7 +706,6 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
|
||||||
|
|
||||||
if attach == nil or CurTime() < (mantletimer or 0) then
|
if attach == nil or CurTime() < (mantletimer or 0) then
|
||||||
view.origin = lastattachpos
|
view.origin = lastattachpos
|
||||||
|
|
||||||
pos:Set(lastattachpos)
|
pos:Set(lastattachpos)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -743,22 +713,22 @@ function BodyAnimCalcView2(ply, pos, angles, fov)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
hook.Add("CreateMove", "BodyLimitMove", function (cmd)
|
hook.Add("CreateMove", "BodyLimitMove", function(cmd)
|
||||||
local ply = LocalPlayer()
|
-- local ply = LocalPlayer()
|
||||||
|
|
||||||
if IsValid(BodyAnimMDL) and not allowmove then
|
if IsValid(BodyAnimMDL) and not allowmove then
|
||||||
cmd:ClearButtons()
|
cmd:ClearButtons()
|
||||||
cmd:ClearMovement()
|
cmd:ClearMovement()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
hook.Add("PostDrawOpaqueRenderables", "IgnoreZBodyAnim", function (depth, sky)
|
|
||||||
|
hook.Add("PostDrawOpaqueRenderables", "IgnoreZBodyAnim", function(depth, sky)
|
||||||
if IsValid(BodyAnimMDL) then
|
if IsValid(BodyAnimMDL) then
|
||||||
CacheLerpBodyAnim()
|
CacheLerpBodyAnim()
|
||||||
|
|
||||||
if ignorez then
|
if ignorez then
|
||||||
cam.IgnoreZ(true)
|
cam.IgnoreZ(true)
|
||||||
BodyAnimMDL:DrawModel()
|
BodyAnimMDL:DrawModel()
|
||||||
|
|
||||||
local customarmdraw = hook.Run("BodyAnimDrawArm")
|
local customarmdraw = hook.Run("BodyAnimDrawArm")
|
||||||
|
|
||||||
if not customarmdraw and IsValid(BodyAnimMDLarm) then
|
if not customarmdraw and IsValid(BodyAnimMDLarm) then
|
||||||
|
@ -770,13 +740,13 @@ hook.Add("PostDrawOpaqueRenderables", "IgnoreZBodyAnim", function (depth, sky)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local lasteyeang = Angle()
|
-- local lasteyeang = Angle()
|
||||||
local lastlimitx = 0
|
local lastlimitx = 0
|
||||||
local lastlimity = 0
|
local lastlimity = 0
|
||||||
local pastlimitx = false
|
local pastlimitx = false
|
||||||
local pastlimity = false
|
local pastlimity = false
|
||||||
|
|
||||||
hook.Add("CreateMove", "BodyAnim_Mouse", function (cmd)
|
hook.Add("CreateMove", "BodyAnim_Mouse", function(cmd)
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
|
|
||||||
if not lockang and IsValid(BodyAnim) then
|
if not lockang and IsValid(BodyAnim) then
|
||||||
|
@ -796,7 +766,6 @@ hook.Add("CreateMove", "BodyAnim_Mouse", function (cmd)
|
||||||
|
|
||||||
if BodyAnimLimitEase then
|
if BodyAnimLimitEase then
|
||||||
ply:CLViewPunch(Angle(-0.2, 0, 0))
|
ply:CLViewPunch(Angle(-0.2, 0, 0))
|
||||||
|
|
||||||
ang.x = math.Approach(ang.x, oang.x + limitx, FrameTime() * 125)
|
ang.x = math.Approach(ang.x, oang.x + limitx, FrameTime() * 125)
|
||||||
else
|
else
|
||||||
ang.x = oang.x + limitx
|
ang.x = oang.x + limitx
|
||||||
|
@ -832,7 +801,8 @@ hook.Add("CreateMove", "BodyAnim_Mouse", function (cmd)
|
||||||
lastlimitx = BodyLimitX
|
lastlimitx = BodyLimitX
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
hook.Add("InputMouseApply", "BodyAnim_Mouse", function (cmd)
|
|
||||||
|
hook.Add("InputMouseApply", "BodyAnim_Mouse", function(cmd)
|
||||||
local newvalues = false
|
local newvalues = false
|
||||||
|
|
||||||
if lockang then
|
if lockang then
|
||||||
|
@ -844,17 +814,13 @@ hook.Add("InputMouseApply", "BodyAnim_Mouse", function (cmd)
|
||||||
|
|
||||||
if pastlimitx then
|
if pastlimitx then
|
||||||
cmd:SetMouseY(0)
|
cmd:SetMouseY(0)
|
||||||
|
|
||||||
newvalues = true
|
newvalues = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if pastlimity then
|
if pastlimity then
|
||||||
cmd:SetMouseX(0)
|
cmd:SetMouseX(0)
|
||||||
|
|
||||||
newvalues = true
|
newvalues = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if newvalues then
|
if newvalues then return true end
|
||||||
return true
|
|
||||||
end
|
|
||||||
end)
|
end)
|
|
@ -2,12 +2,10 @@ local stress = 0
|
||||||
local breathin = true
|
local breathin = true
|
||||||
nextbreath = 0
|
nextbreath = 0
|
||||||
|
|
||||||
hook.Add("Tick", "BreathingLogic", function ()
|
hook.Add("Tick", "BreathingLogic", function()
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
|
|
||||||
if not IsValid(ply) or not ply:Alive() or ply:WaterLevel() == 3 then
|
if not IsValid(ply) or not ply:Alive() or ply:WaterLevel() == 3 then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local vel = ply:GetVelocity()
|
local vel = ply:GetVelocity()
|
||||||
local CT = CurTime()
|
local CT = CurTime()
|
||||||
|
@ -24,9 +22,7 @@ hook.Add("Tick", "BreathingLogic", function ()
|
||||||
|
|
||||||
stress = math.Clamp(stress, -50, 150)
|
stress = math.Clamp(stress, -50, 150)
|
||||||
|
|
||||||
if stress == -50 and breathin then
|
if stress == -50 and breathin then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local breathtype = breathin and "In" or "Out"
|
local breathtype = breathin and "In" or "Out"
|
||||||
local breathstring = stress > 50 and "Medium" or "Soft"
|
local breathstring = stress > 50 and "Medium" or "Soft"
|
||||||
|
|
|
@ -48,6 +48,7 @@ local function infostring()
|
||||||
r = math.Round(r)
|
r = math.Round(r)
|
||||||
y = math.Round(y)
|
y = math.Round(y)
|
||||||
p = math.Round(p)
|
p = math.Round(p)
|
||||||
|
|
||||||
local a = "Index: " .. BuildModeIndex .. "\nSelected: " .. table.Count(buildmode_selected) .. "\nAngle: " .. p .. ", " .. y .. ", " .. r
|
local a = "Index: " .. BuildModeIndex .. "\nSelected: " .. table.Count(buildmode_selected) .. "\nAngle: " .. p .. ", " .. y .. ", " .. r
|
||||||
|
|
||||||
return a
|
return a
|
||||||
|
@ -100,11 +101,12 @@ function GenerateBuildModeRT(model)
|
||||||
render.PushFilterMin(TEXFILTER.ANISOTROPIC)
|
render.PushFilterMin(TEXFILTER.ANISOTROPIC)
|
||||||
render.PushRenderTarget(tex, 0, 0, texw, texh)
|
render.PushRenderTarget(tex, 0, 0, texw, texh)
|
||||||
render.SuppressEngineLighting(true)
|
render.SuppressEngineLighting(true)
|
||||||
|
|
||||||
dummy:SetModel(model)
|
dummy:SetModel(model)
|
||||||
|
|
||||||
local sicon = PositionSpawnIcon(dummy, vector_origin)
|
local sicon = PositionSpawnIcon(dummy, vector_origin)
|
||||||
|
|
||||||
cam.Start3D(sicon.origin, sicon.angles, sicon.fov)
|
cam.Start3D(sicon.origin, sicon.angles, sicon.fov)
|
||||||
|
|
||||||
render.Clear(0, 0, 0, 0)
|
render.Clear(0, 0, 0, 0)
|
||||||
render.ClearDepth()
|
render.ClearDepth()
|
||||||
render.SetWriteDepthToDestAlpha(false)
|
render.SetWriteDepthToDestAlpha(false)
|
||||||
|
@ -114,20 +116,23 @@ function GenerateBuildModeRT(model)
|
||||||
render.SetModelLighting(3, 4, 4, 4)
|
render.SetModelLighting(3, 4, 4, 4)
|
||||||
render.SetModelLighting(4, 3, 3, 3)
|
render.SetModelLighting(4, 3, 3, 3)
|
||||||
render.SetModelLighting(5, 4, 4, 4)
|
render.SetModelLighting(5, 4, 4, 4)
|
||||||
|
|
||||||
dummy:DrawModel()
|
dummy:DrawModel()
|
||||||
cam.End3D()
|
cam.End3D()
|
||||||
|
|
||||||
render.PopRenderTarget()
|
render.PopRenderTarget()
|
||||||
render.PopFilterMag()
|
render.PopFilterMag()
|
||||||
render.PopFilterMin()
|
render.PopFilterMin()
|
||||||
render.SuppressEngineLighting(false)
|
render.SuppressEngineLighting(false)
|
||||||
|
|
||||||
rtcache[model] = tex
|
rtcache[model] = tex
|
||||||
|
|
||||||
local mat = CreateMaterial("BM-" .. model, "UnlitGeneric", {
|
local mat = CreateMaterial("BM-" .. model, "UnlitGeneric", {
|
||||||
["$vertexcolor"] = 1,
|
["$vertexcolor"] = 1,
|
||||||
["$translucent"] = 1,
|
["$translucent"] = 1,
|
||||||
["$vertexalpha"] = 1,
|
["$vertexalpha"] = 1,
|
||||||
["$basetexture"] = tex:GetName()
|
["$basetexture"] = tex:GetName()
|
||||||
})
|
})
|
||||||
|
|
||||||
rtmatcache[model] = mat
|
rtmatcache[model] = mat
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -148,7 +153,6 @@ local function BMPropClick(e)
|
||||||
|
|
||||||
BuildModeCreateGhost()
|
BuildModeCreateGhost()
|
||||||
GhostModel:SetModel(buildmode_props[BuildModeIndex] or buildmode_entmodels[BuildModeIndex])
|
GhostModel:SetModel(buildmode_props[BuildModeIndex] or buildmode_entmodels[BuildModeIndex])
|
||||||
|
|
||||||
PlaceStartPos = nil
|
PlaceStartPos = nil
|
||||||
PlaceEndPos = nil
|
PlaceEndPos = nil
|
||||||
PlaceAxisLock = 0
|
PlaceAxisLock = 0
|
||||||
|
@ -191,9 +195,11 @@ local function BuildModeElements()
|
||||||
|
|
||||||
row = 1
|
row = 1
|
||||||
col = 0
|
col = 0
|
||||||
|
|
||||||
local img = AEUI:AddImage(propspanel, Material("vgui/empty.png"), BMPropClick, 0, 0, 64, 64)
|
local img = AEUI:AddImage(propspanel, Material("vgui/empty.png"), BMPropClick, 0, 0, 64, 64)
|
||||||
img.prop = 0
|
img.prop = 0
|
||||||
img.hover = "Select"
|
img.hover = "Select"
|
||||||
|
|
||||||
local buildmode_enticons = {
|
local buildmode_enticons = {
|
||||||
br_swingbar = Material("vgui/editor/swingbar.png"),
|
br_swingbar = Material("vgui/editor/swingbar.png"),
|
||||||
br_swingpipe = Material("vgui/editor/swingpipe.png"),
|
br_swingpipe = Material("vgui/editor/swingpipe.png"),
|
||||||
|
@ -205,15 +211,18 @@ local function BuildModeElements()
|
||||||
br_mat = Material("vgui/editor/mat.png"),
|
br_mat = Material("vgui/editor/mat.png"),
|
||||||
tt_cp = Material("vgui/editor/checkpoint.png")
|
tt_cp = Material("vgui/editor/checkpoint.png")
|
||||||
}
|
}
|
||||||
|
|
||||||
local buildmode_entnames = {
|
local buildmode_entnames = {
|
||||||
br_zipline = "Zipline (SHIFT = 2-Way)"
|
br_zipline = "Zipline (SHIFT = 2-Way)"
|
||||||
}
|
}
|
||||||
|
|
||||||
local obsolete = Material("editor/obsolete")
|
local obsolete = Material("editor/obsolete")
|
||||||
|
|
||||||
for k, v in pairs(buildmode_ents) do
|
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)
|
local img = AEUI:AddImage(propspanel, buildmode_enticons[k] or obsolete, BMPropClick, 64 * row, 64 * col, 64, 64)
|
||||||
img.prop = k
|
img.prop = k
|
||||||
img.hover = buildmode_entnames[k] or scripted_ents.GetMember(k, "PrintName")
|
img.hover = buildmode_entnames[k] or scripted_ents.GetMember(k, "PrintName")
|
||||||
|
|
||||||
row = row + 1
|
row = row + 1
|
||||||
|
|
||||||
if row > 5 then
|
if row > 5 then
|
||||||
|
@ -223,7 +232,6 @@ local function BuildModeElements()
|
||||||
end
|
end
|
||||||
|
|
||||||
propspanel.elements = propspanel_elements
|
propspanel.elements = propspanel_elements
|
||||||
|
|
||||||
hook.Remove("InitPostEntity", "BuildModeElements")
|
hook.Remove("InitPostEntity", "BuildModeElements")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,25 +5,28 @@ local ry = 0
|
||||||
local gy = 0
|
local gy = 0
|
||||||
local by = 0
|
local by = 0
|
||||||
local black = Material("vgui/black")
|
local black = Material("vgui/black")
|
||||||
|
|
||||||
local ca_r = CreateMaterial("ca_r", "UnlitGeneric", {
|
local ca_r = CreateMaterial("ca_r", "UnlitGeneric", {
|
||||||
["$ignorez"] = 1,
|
["$ignorez"] = 1,
|
||||||
["$basetexture"] = "vgui/black",
|
["$basetexture"] = "vgui/black",
|
||||||
["$additive"] = 1,
|
["$additive"] = 1,
|
||||||
["$color2"] = "[1 0 0]"
|
["$color2"] = "[1 0 0]"
|
||||||
})
|
})
|
||||||
|
|
||||||
local ca_g = CreateMaterial("ca_g", "UnlitGeneric", {
|
local ca_g = CreateMaterial("ca_g", "UnlitGeneric", {
|
||||||
["$ignorez"] = 1,
|
["$ignorez"] = 1,
|
||||||
["$basetexture"] = "vgui/black",
|
["$basetexture"] = "vgui/black",
|
||||||
["$additive"] = 1,
|
["$additive"] = 1,
|
||||||
["$color2"] = "[0 1 0]"
|
["$color2"] = "[0 1 0]"
|
||||||
})
|
})
|
||||||
|
|
||||||
local ca_b = CreateMaterial("ca_b", "UnlitGeneric", {
|
local ca_b = CreateMaterial("ca_b", "UnlitGeneric", {
|
||||||
["$ignorez"] = 1,
|
["$ignorez"] = 1,
|
||||||
["$basetexture"] = "vgui/black",
|
["$basetexture"] = "vgui/black",
|
||||||
["$additive"] = 1,
|
["$additive"] = 1,
|
||||||
["$color2"] = "[0 0 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)
|
local function CA(rx, gx, bx, ry, gy, by)
|
||||||
render.UpdateScreenEffectTexture()
|
render.UpdateScreenEffectTexture()
|
||||||
|
@ -33,6 +36,7 @@ local function CA(rx, gx, bx, ry, gy, by)
|
||||||
ca_r:SetTexture("$basetexture", screentx)
|
ca_r:SetTexture("$basetexture", screentx)
|
||||||
ca_g:SetTexture("$basetexture", screentx)
|
ca_g:SetTexture("$basetexture", screentx)
|
||||||
ca_b:SetTexture("$basetexture", screentx)
|
ca_b:SetTexture("$basetexture", screentx)
|
||||||
|
|
||||||
render.SetMaterial(black)
|
render.SetMaterial(black)
|
||||||
render.DrawScreenQuad()
|
render.DrawScreenQuad()
|
||||||
render.SetMaterial(ca_r)
|
render.SetMaterial(ca_r)
|
||||||
|
@ -78,7 +82,7 @@ surface.CreateFont("DaisyHUDSmall", {
|
||||||
})
|
})
|
||||||
|
|
||||||
local deletiontable = {}
|
local deletiontable = {}
|
||||||
local deletiontime = 0
|
-- local deletiontime = 0
|
||||||
local deletiontypetime = 0
|
local deletiontypetime = 0
|
||||||
local deletiontype = 0
|
local deletiontype = 0
|
||||||
deletionentry = 0
|
deletionentry = 0
|
||||||
|
@ -123,7 +127,6 @@ local deletionlen = 0
|
||||||
|
|
||||||
function DrawDeletionText()
|
function DrawDeletionText()
|
||||||
surface.SetFont("DaisyHUDSmall")
|
surface.SetFont("DaisyHUDSmall")
|
||||||
|
|
||||||
local oldgi = GlitchIntensity
|
local oldgi = GlitchIntensity
|
||||||
|
|
||||||
if incredits then
|
if incredits then
|
||||||
|
@ -160,7 +163,6 @@ function DrawDeletionText()
|
||||||
deletionrare = deletionrare
|
deletionrare = deletionrare
|
||||||
deletiontype = 0
|
deletiontype = 0
|
||||||
deletionentry = deletionentry + 1
|
deletionentry = deletionentry + 1
|
||||||
|
|
||||||
table.insert(deletiontable, deletionstringc)
|
table.insert(deletiontable, deletionstringc)
|
||||||
|
|
||||||
if #deletiontable >= 6 then
|
if #deletiontable >= 6 then
|
||||||
|
@ -168,8 +170,7 @@ function DrawDeletionText()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local tw, th = surface.GetTextSize(deletionstringc)
|
local _, th = surface.GetTextSize(deletionstringc)
|
||||||
|
|
||||||
cam.Start2D()
|
cam.Start2D()
|
||||||
|
|
||||||
local num = 0
|
local num = 0
|
||||||
|
@ -180,12 +181,10 @@ function DrawDeletionText()
|
||||||
vp:Add(vpcl)
|
vp:Add(vpcl)
|
||||||
|
|
||||||
local GlitchIntensity = incredits and 2 or GlitchIntensity
|
local GlitchIntensity = incredits and 2 or GlitchIntensity
|
||||||
|
|
||||||
surface.SetTextColor(255, 255, 255, 2.5 * (num + 1) * GlitchIntensity)
|
surface.SetTextColor(255, 255, 255, 2.5 * (num + 1) * GlitchIntensity)
|
||||||
|
|
||||||
for k, v in ipairs(deletiontable) do
|
for k, v in ipairs(deletiontable) do
|
||||||
surface.SetTextColor(255, 255, 255, 2.5 * k * GlitchIntensity)
|
surface.SetTextColor(255, 255, 255, 2.5 * k * GlitchIntensity)
|
||||||
|
|
||||||
local text = v
|
local text = v
|
||||||
|
|
||||||
for i = 1, 4 do
|
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.SetTextPos(ScrW() * 0.01 + vp.x, ScrH() * 0.05 + (k - 1) * th + vp.y)
|
||||||
surface.DrawText(text)
|
surface.DrawText(text)
|
||||||
|
|
||||||
num = k
|
num = k
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -208,6 +206,5 @@ function DrawDeletionText()
|
||||||
end
|
end
|
||||||
|
|
||||||
cam.End2D()
|
cam.End2D()
|
||||||
|
|
||||||
GlitchIntensity = oldgi
|
GlitchIntensity = oldgi
|
||||||
end
|
end
|
|
@ -1,4 +1,4 @@
|
||||||
net.Receive("DeathStopSound", function ()
|
net.Receive("DeathStopSound", function()
|
||||||
if not blinded then
|
if not blinded then
|
||||||
RunConsoleCommand("stopsound")
|
RunConsoleCommand("stopsound")
|
||||||
end
|
end
|
||||||
|
|
|
@ -47,11 +47,7 @@ TraceCount = 0
|
||||||
function TraceLine_d(data)
|
function TraceLine_d(data)
|
||||||
local result = TraceLine_o(data)
|
local result = TraceLine_o(data)
|
||||||
|
|
||||||
table.insert(traces, {
|
table.insert(traces, {Vector(data.start), Vector(data.endpos), result.Hit and color_red or color_white})
|
||||||
Vector(data.start),
|
|
||||||
Vector(data.endpos),
|
|
||||||
result.Hit and color_red or color_white
|
|
||||||
})
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
@ -59,7 +55,7 @@ end
|
||||||
local function DrawDebugInfo()
|
local function DrawDebugInfo()
|
||||||
local sx = ScrW() * startx
|
local sx = ScrW() * startx
|
||||||
local sy = ScrH() * starty
|
local sy = ScrH() * starty
|
||||||
local htw = 0
|
-- local htw = 0
|
||||||
|
|
||||||
surface.SetFont("BeatrunDebug")
|
surface.SetFont("BeatrunDebug")
|
||||||
surface.SetTextPos(sx, sy)
|
surface.SetTextPos(sx, sy)
|
||||||
|
@ -93,15 +89,13 @@ local function RenderTraces()
|
||||||
end
|
end
|
||||||
|
|
||||||
cam.End3D()
|
cam.End3D()
|
||||||
|
|
||||||
TraceCount = #traces
|
TraceCount = #traces
|
||||||
|
|
||||||
table.Empty(traces)
|
table.Empty(traces)
|
||||||
end
|
end
|
||||||
|
|
||||||
local debugging = false
|
local debugging = false
|
||||||
|
|
||||||
concommand.Add("Beatrun_DebugToggle", function ()
|
concommand.Add("Beatrun_DebugToggle", function()
|
||||||
debugging = not debugging
|
debugging = not debugging
|
||||||
|
|
||||||
if debugging then
|
if debugging then
|
||||||
|
@ -115,7 +109,6 @@ concommand.Add("Beatrun_DebugToggle", function ()
|
||||||
else
|
else
|
||||||
hook.Remove("HUDPaint", "DrawDebugInfo")
|
hook.Remove("HUDPaint", "DrawDebugInfo")
|
||||||
hook.Remove("PostRender", "RenderTraces")
|
hook.Remove("PostRender", "RenderTraces")
|
||||||
|
|
||||||
util.TraceLine = TraceLine_o
|
util.TraceLine = TraceLine_o
|
||||||
end
|
end
|
||||||
end)
|
end)
|
|
@ -78,9 +78,7 @@ valvebiped = {
|
||||||
local scalevec = Vector(1, 1, 1)
|
local scalevec = Vector(1, 1, 1)
|
||||||
|
|
||||||
local function Disarm_Render(self)
|
local function Disarm_Render(self)
|
||||||
if not IsValid(self) or not IsValid(self.ModelBM) or not IsValid(self.Victim) then
|
if not IsValid(self) or not IsValid(self.ModelBM) or not IsValid(self.Victim) then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local owner = self.Victim
|
local owner = self.Victim
|
||||||
|
|
||||||
|
@ -112,6 +110,7 @@ local function Disarm_Render(self)
|
||||||
for i = 1, 3 do
|
for i = 1, 3 do
|
||||||
local from = self.bonematrixtablefrom[lookbone][i]
|
local from = self.bonematrixtablefrom[lookbone][i]
|
||||||
local v = self.bonematrixtableto[lookbone][i]
|
local v = self.bonematrixtableto[lookbone][i]
|
||||||
|
|
||||||
v[1] = LerpL(blerpvalue, v[1], from[1])
|
v[1] = LerpL(blerpvalue, v[1], from[1])
|
||||||
v[2] = LerpL(blerpvalue, v[2], from[2])
|
v[2] = LerpL(blerpvalue, v[2], from[2])
|
||||||
v[3] = LerpL(blerpvalue, v[3], from[3])
|
v[3] = LerpL(blerpvalue, v[3], from[3])
|
||||||
|
@ -186,12 +185,9 @@ function Disarm_BlockMove(cmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Disarm_Init(victim)
|
function Disarm_Init(victim)
|
||||||
if not IsValid(victim) then
|
if not IsValid(victim) then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
|
|
||||||
Disarm_CleanUp()
|
Disarm_CleanUp()
|
||||||
|
|
||||||
local eyeang = ply:EyeAngles()
|
local eyeang = ply:EyeAngles()
|
||||||
|
@ -201,19 +197,19 @@ function Disarm_Init(victim)
|
||||||
ParkourEvent("disarmscar", ply, true)
|
ParkourEvent("disarmscar", ply, true)
|
||||||
|
|
||||||
ply.OrigEyeAng = eyeang
|
ply.OrigEyeAng = eyeang
|
||||||
|
|
||||||
BodyAnim:SetAngles(eyeang)
|
BodyAnim:SetAngles(eyeang)
|
||||||
|
|
||||||
victim.InDisarm = true
|
victim.InDisarm = true
|
||||||
|
|
||||||
ply.DisarmForcedEnd = CurTime() + 4
|
ply.DisarmForcedEnd = CurTime() + 4
|
||||||
ply.DisarmVictim = ClientsideModel("models/disarmvictim.mdl")
|
ply.DisarmVictim = ClientsideModel("models/disarmvictim.mdl")
|
||||||
ply.DisarmVictimMDL = ClientsideModel(victim:GetModel())
|
ply.DisarmVictimMDL = ClientsideModel(victim:GetModel())
|
||||||
|
|
||||||
local victimanim = ply.DisarmVictim
|
local victimanim = ply.DisarmVictim
|
||||||
local victimMDL = ply.DisarmVictimMDL
|
local victimMDL = ply.DisarmVictimMDL
|
||||||
|
|
||||||
victimanim.bonelerpvalue = 0
|
victimanim.bonelerpvalue = 0
|
||||||
|
|
||||||
victimanim:SetSequence("snatchscar")
|
victimanim:SetSequence("snatchscar")
|
||||||
|
|
||||||
victimanim.ModelBM = victimMDL
|
victimanim.ModelBM = victimMDL
|
||||||
victimanim.bonematrixtablefrom = {}
|
victimanim.bonematrixtablefrom = {}
|
||||||
victimanim.bonematrixtableto = {}
|
victimanim.bonematrixtableto = {}
|
||||||
|
@ -232,20 +228,19 @@ function Disarm_Init(victim)
|
||||||
|
|
||||||
hook.Add("Think", "Disarm_Think", Disarm_Think)
|
hook.Add("Think", "Disarm_Think", Disarm_Think)
|
||||||
hook.Add("CreateMove", "Disarm_BlockMove", Disarm_BlockMove)
|
hook.Add("CreateMove", "Disarm_BlockMove", Disarm_BlockMove)
|
||||||
|
|
||||||
victimanim.RenderOverride = Disarm_Render
|
victimanim.RenderOverride = Disarm_Render
|
||||||
|
|
||||||
timer.Simple(0.001, function ()
|
timer.Simple(0.001, function()
|
||||||
victim.DisarmNoDraw = true
|
victim.DisarmNoDraw = true
|
||||||
|
|
||||||
victim:SetNoDraw(true)
|
victim:SetNoDraw(true)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
net.Receive("DisarmStart", function ()
|
net.Receive("DisarmStart", function()
|
||||||
Disarm_Init(net.ReadEntity())
|
Disarm_Init(net.ReadEntity())
|
||||||
end)
|
end)
|
||||||
hook.Add("CreateClientsideRagdoll", "Disarm_Ragdoll", function (ent, oldrag)
|
|
||||||
|
hook.Add("CreateClientsideRagdoll", "Disarm_Ragdoll", function(ent, oldrag)
|
||||||
if ent.InDisarm then
|
if ent.InDisarm then
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
local victimanim = ply.DisarmVictim
|
local victimanim = ply.DisarmVictim
|
||||||
|
@ -259,11 +254,10 @@ hook.Add("CreateClientsideRagdoll", "Disarm_Ragdoll", function (ent, oldrag)
|
||||||
|
|
||||||
for i = 0, rag:GetNumBodyGroups() do
|
for i = 0, rag:GetNumBodyGroups() do
|
||||||
local bodyg = oldrag:GetBodygroup(i)
|
local bodyg = oldrag:GetBodygroup(i)
|
||||||
|
|
||||||
rag:SetBodygroup(i, bodyg)
|
rag:SetBodygroup(i, bodyg)
|
||||||
end
|
end
|
||||||
|
|
||||||
local vel = Vector()
|
-- local vel = Vector()
|
||||||
local num = rag:GetPhysicsObjectCount() - 1
|
local num = rag:GetPhysicsObjectCount() - 1
|
||||||
|
|
||||||
for i = 0, num do
|
for i = 0, num do
|
||||||
|
@ -284,12 +278,14 @@ hook.Add("CreateClientsideRagdoll", "Disarm_Ragdoll", function (ent, oldrag)
|
||||||
end
|
end
|
||||||
|
|
||||||
oldrag:Remove()
|
oldrag:Remove()
|
||||||
timer.Simple(30, function ()
|
|
||||||
|
timer.Simple(30, function()
|
||||||
if IsValid(rag) then
|
if IsValid(rag) then
|
||||||
rag:SetSaveValue("m_bFadingOut", true)
|
rag:SetSaveValue("m_bFadingOut", true)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
timer.Simple(0, function ()
|
|
||||||
|
timer.Simple(0, function()
|
||||||
Disarm_CleanUp()
|
Disarm_CleanUp()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,40 +1,45 @@
|
||||||
sound.Add( {
|
sound.Add({
|
||||||
name = "FallStatic",
|
name = "FallStatic",
|
||||||
channel = CHAN_STATIC,
|
channel = CHAN_STATIC,
|
||||||
volume = 1,
|
volume = 1,
|
||||||
level = 80,
|
level = 80,
|
||||||
pitch = 100,
|
pitch = 100,
|
||||||
sound = "MirrorsEdge/FallStatic.wav"
|
sound = "MirrorsEdge/FallStatic.wav"
|
||||||
} )
|
})
|
||||||
|
|
||||||
local zoom = Material("vgui/zoom.vtf")
|
local zoom = Material("vgui/zoom.vtf")
|
||||||
|
|
||||||
local nextbeat = 0
|
local nextbeat = 0
|
||||||
local beatvol = 0.3
|
local beatvol = 0.3
|
||||||
local blurpass = 0
|
local blurpass = 0
|
||||||
|
|
||||||
local vignettealpha = 0
|
local vignettealpha = 0
|
||||||
|
|
||||||
local function FallCheck()
|
local function FallCheck()
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
if !IsValid(ply) then return end
|
if not IsValid(ply) then return end
|
||||||
local speed = ply:GetVelocity().z
|
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:EmitSound("FallStatic")
|
||||||
ply.FallStatic = true
|
ply.FallStatic = true
|
||||||
nextbeat = CurTime()+0.5
|
|
||||||
|
nextbeat = CurTime() + 0.5
|
||||||
beatvol = 0.3
|
beatvol = 0.3
|
||||||
blurpass = 0
|
blurpass = 0
|
||||||
vignettealpha = 0
|
vignettealpha = 0
|
||||||
CamShake = true
|
CamShake = true
|
||||||
CamShakeMult = 0
|
CamShakeMult = 0
|
||||||
if !ply:GetJumpTurn() then
|
|
||||||
|
if not ply:GetJumpTurn() then
|
||||||
ParkourEvent("falluncontrolled", ply, true)
|
ParkourEvent("falluncontrolled", ply, true)
|
||||||
end
|
end
|
||||||
elseif ply.FallStatic and speed > -800 then
|
elseif ply.FallStatic and speed > -800 then
|
||||||
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120))
|
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120))
|
||||||
ply:StopSound("FallStatic")
|
ply:StopSound("FallStatic")
|
||||||
|
|
||||||
ply.FallStatic = false
|
ply.FallStatic = false
|
||||||
CamShake = false
|
CamShake = false
|
||||||
|
|
||||||
ParkourEvent("fallrecover", ply, true)
|
ParkourEvent("fallrecover", ply, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -43,40 +48,46 @@ hook.Add("Tick", "FallCheck", FallCheck)
|
||||||
|
|
||||||
local function FallEffect()
|
local function FallEffect()
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
|
|
||||||
if ply.FallStatic then
|
if ply.FallStatic then
|
||||||
local vel = math.abs(ply:GetVelocity().z)/1400
|
local vel = math.abs(ply:GetVelocity().z) / 1400
|
||||||
local csm = CamShakeMult
|
local csm = CamShakeMult
|
||||||
-- DrawMotionBlur( 0.4, 0.8, 0.015*vel )
|
-- DrawMotionBlur( 0.4, 0.8, 0.015*vel )
|
||||||
CamShakeMult = math.Approach(csm, 3, FrameTime()*1.5)
|
|
||||||
DrawMaterialOverlay( "effects/fall_warp", CamShakeMult*0.025 )
|
CamShakeMult = math.Approach(csm, 3, FrameTime() * 1.5)
|
||||||
if blurpass >= 1 then
|
DrawMaterialOverlay("effects/fall_warp", CamShakeMult * 0.025)
|
||||||
-- DrawToyTown(math.Truncate(blurpass), ScrH()*blurpass)
|
|
||||||
end
|
if blurpass >= 1 then return end -- DrawToyTown(math.Truncate(blurpass), ScrH()*blurpass)
|
||||||
|
|
||||||
if CurTime() > nextbeat then
|
if CurTime() > nextbeat then
|
||||||
nextbeat = CurTime() + math.Clamp(0.5 / vel, 0.3, 0.5)
|
nextbeat = CurTime() + math.Clamp(0.5 / vel, 0.3, 0.5)
|
||||||
ply:EmitSound("heartbeat_beat_0"..math.random(1,8)..".wav", 80, 100, beatvol)
|
ply:EmitSound("heartbeat_beat_0" .. math.random(1, 8) .. ".wav", 80, 100, beatvol)
|
||||||
beatvol = math.min(beatvol+0.05, 1)
|
beatvol = math.min(beatvol + 0.05, 1)
|
||||||
blurpass = math.min(blurpass+0.1, 10)
|
blurpass = math.min(blurpass + 0.1, 10)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
hook.Add("RenderScreenspaceEffects", "FallEffect", FallEffect)
|
hook.Add("RenderScreenspaceEffects", "FallEffect", FallEffect)
|
||||||
|
|
||||||
hook.Add("HUDPaint", "FallVignette", function()
|
hook.Add("HUDPaint", "FallVignette", function()
|
||||||
if !LocalPlayer().FallStatic then return end
|
if not LocalPlayer().FallStatic then return end
|
||||||
vignettealpha = math.min(255, vignettealpha+(FrameTime()*100))
|
|
||||||
|
vignettealpha = math.min(255, vignettealpha + (FrameTime() * 100))
|
||||||
|
|
||||||
surface.SetMaterial(zoom)
|
surface.SetMaterial(zoom)
|
||||||
surface.SetDrawColor(255,255,255,vignettealpha)
|
surface.SetDrawColor(255, 255, 255, vignettealpha)
|
||||||
surface.DrawTexturedRect(0,0,ScrW(),ScrH())
|
surface.DrawTexturedRect(0, 0, ScrW(), ScrH())
|
||||||
surface.DrawTexturedRectRotated(ScrW()*0.5,ScrH()*0.5,ScrW(),ScrH(),180)
|
surface.DrawTexturedRectRotated(ScrW() * 0.5, ScrH() * 0.5, ScrW(), ScrH(), 180)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hook.Add("InputMouseApply", "FallLock", function(cmd, x, y, ang)
|
hook.Add("InputMouseApply", "FallLock", function(cmd, x, y, ang)
|
||||||
if LocalPlayer().FallStatic then
|
if LocalPlayer().FallStatic then
|
||||||
cmd:SetMouseX(0)
|
cmd:SetMouseX(0)
|
||||||
cmd:SetMouseY(0)
|
cmd:SetMouseY(0)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end)
|
end)
|
|
@ -11,6 +11,7 @@ local hide = {
|
||||||
CHudHealth = true,
|
CHudHealth = true,
|
||||||
CHudDamageIndicator = true
|
CHudDamageIndicator = true
|
||||||
}
|
}
|
||||||
|
local inf = math.huge
|
||||||
|
|
||||||
hook.Add("HUDShouldDraw", "BeatrunHUDHide", function (name)
|
hook.Add("HUDShouldDraw", "BeatrunHUDHide", function (name)
|
||||||
if hide[name] then
|
if hide[name] then
|
||||||
|
@ -31,10 +32,8 @@ local tab = {
|
||||||
["$pp_colour_colour"] = color
|
["$pp_colour_colour"] = color
|
||||||
}
|
}
|
||||||
|
|
||||||
hook.Add("RenderScreenspaceEffects", "BeatrunNoclipBW", function ()
|
hook.Add("RenderScreenspaceEffects", "BeatrunNoclipBW", function()
|
||||||
if render.GetDXLevel() < 90 then
|
if render.GetDXLevel() < 90 then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
local inp = color ~= 1
|
local inp = color ~= 1
|
||||||
|
@ -42,7 +41,6 @@ hook.Add("RenderScreenspaceEffects", "BeatrunNoclipBW", function ()
|
||||||
|
|
||||||
if noclipping or inp then
|
if noclipping or inp then
|
||||||
tab["$pp_colour_colour"] = color
|
tab["$pp_colour_colour"] = color
|
||||||
|
|
||||||
DrawColorModify(tab)
|
DrawColorModify(tab)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,10 +52,10 @@ hook.Add("RenderScreenspaceEffects", "BeatrunNoclipBW", function ()
|
||||||
|
|
||||||
if LocalPlayer():Health() < 100 then
|
if LocalPlayer():Health() < 100 then
|
||||||
tab["$pp_colour_colour"] = math.max(LocalPlayer():Health() / LocalPlayer():GetMaxHealth(), 0)
|
tab["$pp_colour_colour"] = math.max(LocalPlayer():Health() / LocalPlayer():GetMaxHealth(), 0)
|
||||||
|
|
||||||
DrawColorModify(tab)
|
DrawColorModify(tab)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
surface.CreateFont("BeatrunHUD", {
|
surface.CreateFont("BeatrunHUD", {
|
||||||
shadow = true,
|
shadow = true,
|
||||||
blursize = 0,
|
blursize = 0,
|
||||||
|
@ -75,6 +73,7 @@ surface.CreateFont("BeatrunHUD", {
|
||||||
weight = 500,
|
weight = 500,
|
||||||
size = ScreenScale(7)
|
size = ScreenScale(7)
|
||||||
})
|
})
|
||||||
|
|
||||||
surface.CreateFont("BeatrunHUDSmall", {
|
surface.CreateFont("BeatrunHUDSmall", {
|
||||||
shadow = true,
|
shadow = true,
|
||||||
blursize = 0,
|
blursize = 0,
|
||||||
|
@ -96,9 +95,7 @@ surface.CreateFont("BeatrunHUDSmall", {
|
||||||
local blur = Material("pp/blurscreen")
|
local blur = Material("pp/blurscreen")
|
||||||
|
|
||||||
local function DrawBlurRect(x, y, w, h, a)
|
local function DrawBlurRect(x, y, w, h, a)
|
||||||
if render.GetDXLevel() < 90 then
|
if render.GetDXLevel() < 90 then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local X = 0
|
local X = 0
|
||||||
local Y = 0
|
local Y = 0
|
||||||
|
@ -125,13 +122,12 @@ local function BeatrunHUD()
|
||||||
|
|
||||||
surface.SetFont("DebugFixedSmall")
|
surface.SetFont("DebugFixedSmall")
|
||||||
|
|
||||||
local vtext = VERSIONGLOBAL
|
-- local vtext = (ply:SteamID() or "?") .. " | " .. VERSIONGLOBAL
|
||||||
local tw, th = surface.GetTextSize(vtext)
|
-- local tw, th = surface.GetTextSize(vtext)
|
||||||
|
-- surface.SetTextColor(255, 255, 255, 15)
|
||||||
surface.SetTextColor(255, 255, 255, 15)
|
-- surface.SetTextPos(scrw - tw, 0)
|
||||||
surface.SetTextPos(scrw - tw, 0)
|
-- surface.DrawText(vtext)
|
||||||
surface.DrawText(vtext)
|
-- surface.SetFont("BeatrunHUD")
|
||||||
surface.SetFont("BeatrunHUD")
|
|
||||||
|
|
||||||
local pl = ply:GetNW2Int("PLoss")
|
local pl = ply:GetNW2Int("PLoss")
|
||||||
local CT = CurTime()
|
local CT = CurTime()
|
||||||
|
@ -151,19 +147,12 @@ local function BeatrunHUD()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if BuildMode then
|
if BuildMode then return end
|
||||||
return
|
if hidden:GetInt() > 1 then return end
|
||||||
end
|
|
||||||
|
|
||||||
if hidden:GetInt() > 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local shoulddraw = hook.Run("BeatrunDrawHUD")
|
local shoulddraw = hook.Run("BeatrunDrawHUD")
|
||||||
|
|
||||||
if shoulddraw == false then
|
if shoulddraw == false then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local vp = ply:GetViewPunchAngles()
|
local vp = ply:GetViewPunchAngles()
|
||||||
|
|
||||||
|
@ -175,7 +164,7 @@ local function BeatrunHUD()
|
||||||
local coursename = nil
|
local coursename = nil
|
||||||
local customname = hook.Run("BeatrunHUDCourse")
|
local customname = hook.Run("BeatrunHUDCourse")
|
||||||
coursename = customname and customname or Course_Name ~= "" and Course_Name or "Freeplay"
|
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
|
local nicktext = nil
|
||||||
|
|
||||||
if showtotalXP:GetBool() then
|
if showtotalXP:GetBool() then
|
||||||
|
@ -185,14 +174,11 @@ local function BeatrunHUD()
|
||||||
end
|
end
|
||||||
|
|
||||||
surface.SetFont("BeatrunHUDSmall")
|
surface.SetFont("BeatrunHUDSmall")
|
||||||
|
|
||||||
local nickw, nickh = surface.GetTextSize(nicktext)
|
local nickw, nickh = surface.GetTextSize(nicktext)
|
||||||
|
|
||||||
surface.SetFont("BeatrunHUD")
|
surface.SetFont("BeatrunHUD")
|
||||||
|
local coursew, _ = surface.GetTextSize(coursename)
|
||||||
local coursew, courseh = surface.GetTextSize(coursename)
|
|
||||||
local bgpadw = nickw
|
local bgpadw = nickw
|
||||||
local bgpadh = nickh
|
-- local bgpadh = nickh
|
||||||
|
|
||||||
if bgpadw < coursew then
|
if bgpadw < coursew then
|
||||||
bgpadw = coursew
|
bgpadw = coursew
|
||||||
|
@ -209,7 +195,9 @@ local function BeatrunHUD()
|
||||||
|
|
||||||
surface.SetDrawColor(20, 20, 20, math.max(150 - hidealpha, 50))
|
surface.SetDrawColor(20, 20, 20, math.max(150 - hidealpha, 50))
|
||||||
surface.DrawRect(-20 + vp.z, scrh * 0.895 + vp.x, 40, SScaleY(85))
|
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))
|
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.SetDrawColor(20, 20, 20, math.max(100 - hidealpha, 50))
|
||||||
surface.DrawOutlinedRect(20 + vp.z, scrh * 0.895 + vp.x, SScaleX(bgpadding), SScaleY(85))
|
surface.DrawOutlinedRect(20 + vp.z, scrh * 0.895 + vp.x, SScaleX(bgpadding), SScaleY(85))
|
||||||
surface.SetFont("BeatrunHUD")
|
surface.SetFont("BeatrunHUD")
|
||||||
|
|
|
@ -4,46 +4,45 @@ local apikey = CreateConVar("beatrun_apikey", "0", true, {
|
||||||
})
|
})
|
||||||
|
|
||||||
function UploadCourse()
|
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
|
||||||
--if Course_Name == "" or Course_ID == "" then
|
print("Can't upload in Freeplay")
|
||||||
-- print("Can't upload in Freeplay")
|
|
||||||
--
|
return
|
||||||
-- -- return
|
end
|
||||||
-- --end
|
|
||||||
--
|
local file = file.Open("beatrun/courses/" .. game.GetMap() .. "/" .. Course_ID .. ".txt", "rb", "DATA")
|
||||||
-- --local file = file.Open("beatrun/courses/" .. game.GetMap() .. "/" .. Course_ID .. ".txt", "rb", "DATA")
|
local filedata = util.Decompress(file:Read(file:Size()))
|
||||||
-- --local filedata = util.Decompress(file:Read(file:Size()))
|
|
||||||
--
|
local function h_failed(reason)
|
||||||
-- --local function h_failed(reason)
|
print("HTTP failed: ", reason)
|
||||||
-- -- print("HTTP failed: ", reason)
|
end
|
||||||
-- --end
|
|
||||||
--
|
local function h_success(code, body, headers)
|
||||||
-- --local function h_success(code, body, headers)
|
print(body)
|
||||||
-- -- print(body)
|
end
|
||||||
-- --end
|
|
||||||
--
|
local h_method = "POST"
|
||||||
-- --local h_method = "POST"
|
local h_url = "https://datae.org/beatrun/upload.php"
|
||||||
-- --local h_url = "https://datae.org/beatrun/upload.php"
|
local h_headers = {
|
||||||
-- --local h_headers = {
|
["Content-Type"] = "text/plain",
|
||||||
-- -- ["Content-Type"] = "text/plain",
|
["Content-Length"] = filedata:len(),
|
||||||
-- -- ["Content-Length"] = filedata:len(),
|
["User-Agent"] = "Beatrun/1.0.0",
|
||||||
-- -- ["User-Agent"] = "Beatrun/1.0.0",
|
["Accept-Encoding"] = "gzip, deflate",
|
||||||
-- -- ["Accept-Encoding"] = "gzip, deflate",
|
Authorization = apikey:GetString(),
|
||||||
-- -- Authorization = apikey:GetString(),
|
["Game-Map"] = game.GetMap()
|
||||||
-- -- ["Game-Map"] = game.GetMap()
|
}
|
||||||
-- --}
|
local h_type = "text/plain"
|
||||||
-- --local h_type = "text/plain"
|
local h_body = filedata
|
||||||
-- --local h_body = filedata
|
|
||||||
--
|
HTTP({
|
||||||
-- --HTTP({
|
failed = h_failed,
|
||||||
-- -- failed = h_failed,
|
success = h_success,
|
||||||
-- -- success = h_success,
|
method = h_method,
|
||||||
-- -- method = h_method,
|
url = h_url,
|
||||||
-- -- url = h_url,
|
headers = h_headers,
|
||||||
-- -- headers = h_headers,
|
type = h_type,
|
||||||
-- -- type = h_type,
|
body = h_body
|
||||||
-- -- body = h_body
|
})
|
||||||
--})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
concommand.Add("Beatrun_UploadCourse", UploadCourse)
|
concommand.Add("Beatrun_UploadCourse", UploadCourse)
|
||||||
|
@ -56,28 +55,27 @@ local GetCourse_Errors = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetCourse(sharecode)
|
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)
|
||||||
--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]
|
||||||
-- local errorcode = GetCourse_Errors[body]
|
|
||||||
--
|
if not errorcode then
|
||||||
-- -- if not errorcode then
|
print("Success | Code:", code, "Length:", length)
|
||||||
-- -- print("Success | Code:", code, "Length:", length)
|
PrintTable(headers)
|
||||||
-- -- PrintTable(headers)
|
LoadCourseRaw(util.Compress(body))
|
||||||
-- -- LoadCourseRaw(util.Compress(body))
|
|
||||||
--
|
return true
|
||||||
-- -- return true
|
else
|
||||||
-- -- else
|
print(errorcode)
|
||||||
-- -- print(errorcode)
|
|
||||||
--
|
return false
|
||||||
-- -- return false
|
end
|
||||||
-- -- end
|
end, function (message)
|
||||||
-- --end, function (message)
|
print("An error occurred.", message)
|
||||||
-- -- print("An error occurred.", message)
|
|
||||||
--
|
return false
|
||||||
-- -- return false
|
end, {
|
||||||
-- --end, {
|
["accept-encoding"] = "gzip, deflate"
|
||||||
-- -- ["accept-encoding"] = "gzip, deflate"
|
})
|
||||||
--})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
concommand.Add("Beatrun_LoadCode", function (ply, cmd, args, argstr)
|
concommand.Add("Beatrun_LoadCode", function (ply, cmd, args, argstr)
|
||||||
|
|
|
@ -4,23 +4,17 @@ local SScaleX_cached = {}
|
||||||
local SScaleY_cached = {}
|
local SScaleY_cached = {}
|
||||||
|
|
||||||
function SScaleX(sizex)
|
function SScaleX(sizex)
|
||||||
local iswide = AEUI.ScrW / AEUI.ScrH > 1.6
|
-- local iswide = AEUI.ScrW / AEUI.ScrH > 1.6
|
||||||
|
|
||||||
if SScaleX_cached[sizex] then
|
|
||||||
return SScaleX_cached[sizex]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
if SScaleX_cached[sizex] then return SScaleX_cached[sizex] end
|
||||||
SScaleX_cached[sizex] = math.ceil(sizex / (1920 / AEUI.ScrW))
|
SScaleX_cached[sizex] = math.ceil(sizex / (1920 / AEUI.ScrW))
|
||||||
|
|
||||||
return SScaleX_cached[sizex]
|
return SScaleX_cached[sizex]
|
||||||
end
|
end
|
||||||
|
|
||||||
function SScaleY(sizey)
|
function SScaleY(sizey)
|
||||||
local iswide = AEUI.ScrW / AEUI.ScrH > 1.6
|
-- local iswide = AEUI.ScrW / AEUI.ScrH > 1.6
|
||||||
|
if SScaleY_cached[sizey] then return SScaleY_cached[sizey] end
|
||||||
if SScaleY_cached[sizey] then
|
|
||||||
return SScaleY_cached[sizey]
|
|
||||||
end
|
|
||||||
|
|
||||||
SScaleY_cached[sizey] = math.ceil(sizey / (1080 / AEUI.ScrH))
|
SScaleY_cached[sizey] = math.ceil(sizey / (1080 / AEUI.ScrH))
|
||||||
|
|
||||||
|
@ -109,9 +103,7 @@ function AEUI:DrawPanel(panel)
|
||||||
end
|
end
|
||||||
|
|
||||||
function AEUI:AddPanel(panel)
|
function AEUI:AddPanel(panel)
|
||||||
if table.HasValue(AEUI.Panels, panel) then
|
if table.HasValue(AEUI.Panels, panel) then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
table.insert(AEUI.Panels, panel)
|
table.insert(AEUI.Panels, panel)
|
||||||
gui.EnableScreenClicker(true)
|
gui.EnableScreenClicker(true)
|
||||||
|
@ -131,6 +123,7 @@ function AEUI:AddText(panel, str, font, x, y, centered, color)
|
||||||
y = y or 0
|
y = y or 0
|
||||||
centered = centered or false
|
centered = centered or false
|
||||||
color = color or color_white
|
color = color or color_white
|
||||||
|
|
||||||
local text = {
|
local text = {
|
||||||
x = x,
|
x = x,
|
||||||
y = y,
|
y = y,
|
||||||
|
@ -152,8 +145,8 @@ function AEUI:AddButton(panel, str, func, font, x, y, centered, color)
|
||||||
y = y or 0
|
y = y or 0
|
||||||
centered = centered or false
|
centered = centered or false
|
||||||
color = color or color_white
|
color = color or color_white
|
||||||
func = func or function ()
|
func = func or function() end
|
||||||
end
|
|
||||||
local button = {
|
local button = {
|
||||||
x = x,
|
x = x,
|
||||||
y = y,
|
y = y,
|
||||||
|
@ -176,8 +169,8 @@ function AEUI:AddImage(panel, mat, func, x, y, w, h, color)
|
||||||
y = y or 0
|
y = y or 0
|
||||||
centered = centered or false
|
centered = centered or false
|
||||||
color = color or color_white
|
color = color or color_white
|
||||||
func = func or function ()
|
func = func or function() end
|
||||||
end
|
|
||||||
local image = {
|
local image = {
|
||||||
x = x,
|
x = x,
|
||||||
y = y,
|
y = y,
|
||||||
|
@ -206,9 +199,7 @@ function AEUI:DrawElement(panel, data)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function AEUIDraw()
|
local function AEUIDraw()
|
||||||
if AEUI.NoDraw then
|
if AEUI.NoDraw then return end
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
for k, v in ipairs(AEUI.Panels) do
|
for k, v in ipairs(AEUI.Panels) do
|
||||||
surface.SetAlphaMultiplier(v.alpha or 1)
|
surface.SetAlphaMultiplier(v.alpha or 1)
|
||||||
|
@ -222,7 +213,6 @@ local function AEUIDraw()
|
||||||
end
|
end
|
||||||
|
|
||||||
render.SetScissorRect(0, 0, 0, 0, false)
|
render.SetScissorRect(0, 0, 0, 0, false)
|
||||||
|
|
||||||
local maxscroll = math.abs(v.maxscroll or 0)
|
local maxscroll = math.abs(v.maxscroll or 0)
|
||||||
|
|
||||||
if (v.maxscroll or 0) > 0 then
|
if (v.maxscroll or 0) > 0 then
|
||||||
|
@ -241,7 +231,6 @@ local function AEUIDraw()
|
||||||
if e.hover then
|
if e.hover then
|
||||||
local mx = AEUI.MX + SScaleX(20)
|
local mx = AEUI.MX + SScaleX(20)
|
||||||
local my = AEUI.MY + SScaleY(20)
|
local my = AEUI.MY + SScaleY(20)
|
||||||
|
|
||||||
surface.SetTextColor(255, 255, 255)
|
surface.SetTextColor(255, 255, 255)
|
||||||
surface.SetFont("AEUIDefault")
|
surface.SetFont("AEUIDefault")
|
||||||
|
|
||||||
|
@ -262,7 +251,7 @@ local function AEUIDraw()
|
||||||
end
|
end
|
||||||
|
|
||||||
hook.Add("HUDPaint", "AEUIDraw", AEUIDraw)
|
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 mx = gui.MouseX()
|
||||||
local my = gui.MouseY()
|
local my = gui.MouseY()
|
||||||
AEUI.MY = my
|
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
|
if v.onclick and click and AEUI.LastClick < CurTime() then
|
||||||
v:onclick()
|
v:onclick()
|
||||||
|
|
||||||
AEUI.LastClick = CurTime() + 0.1
|
AEUI.LastClick = CurTime() + 0.1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -327,7 +315,8 @@ hook.Add("StartCommand", "AEUI_StartCommand", function (ply, cmd)
|
||||||
AEUI.HoveredElement = nil
|
AEUI.HoveredElement = nil
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
hook.Add("OnScreenSizeChanged", "AEUI_ScreenSize", function ()
|
|
||||||
|
hook.Add("OnScreenSizeChanged", "AEUI_ScreenSize", function()
|
||||||
AEUI.ScrH = ScrH()
|
AEUI.ScrH = ScrH()
|
||||||
AEUI.ScrW = ScrW()
|
AEUI.ScrW = ScrW()
|
||||||
|
|
||||||
|
@ -453,9 +442,7 @@ function AEUI.Elements.Button(panel, data)
|
||||||
if data.centered then
|
if data.centered then
|
||||||
datah = th + 4
|
datah = th + 4
|
||||||
dataw = tw + 4
|
dataw = tw + 4
|
||||||
|
|
||||||
surface.DrawOutlinedRect(ox + SScaleX(data.x) - tw * 0.5 - 2, oy + SScaleY(data.y) - th * 0.5 - 2, dataw, datah)
|
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 x = ox + SScaleX(data.x) - tw * 0.5
|
||||||
local y = oy + SScaleY(data.y) - th * 0.5
|
local y = oy + SScaleY(data.y) - th * 0.5
|
||||||
|
|
||||||
|
@ -467,9 +454,7 @@ function AEUI.Elements.Button(panel, data)
|
||||||
else
|
else
|
||||||
datah = th
|
datah = th
|
||||||
dataw = tw
|
dataw = tw
|
||||||
|
|
||||||
surface.DrawOutlinedRect(ox + SScaleX(data.x), oy + SScaleY(data.y), tw, th)
|
surface.DrawOutlinedRect(ox + SScaleX(data.x), oy + SScaleY(data.y), tw, th)
|
||||||
|
|
||||||
local x = ox + SScaleX(data.x)
|
local x = ox + SScaleX(data.x)
|
||||||
local y = oy + SScaleY(data.y)
|
local y = oy + SScaleY(data.y)
|
||||||
|
|
||||||
|
@ -482,9 +467,7 @@ function AEUI.Elements.Button(panel, data)
|
||||||
|
|
||||||
data.h = datah
|
data.h = datah
|
||||||
data.w = dataw
|
data.w = dataw
|
||||||
|
|
||||||
surface.DrawText(v)
|
surface.DrawText(v)
|
||||||
|
|
||||||
posy = posy - oy - SScaleY(panel.h)
|
posy = posy - oy - SScaleY(panel.h)
|
||||||
|
|
||||||
if not panel.maxscroll or panel.maxscroll < posy then
|
if not panel.maxscroll or panel.maxscroll < posy then
|
||||||
|
@ -515,7 +498,7 @@ function AEUI.Elements.Image(panel, data)
|
||||||
end
|
end
|
||||||
|
|
||||||
local posy = 0
|
local posy = 0
|
||||||
local x = ox + SScaleX(data.x)
|
-- local x = ox + SScaleX(data.x)
|
||||||
local y = oy + SScaleY(data.y)
|
local y = oy + SScaleY(data.y)
|
||||||
|
|
||||||
if isgreyed then
|
if isgreyed then
|
||||||
|
|
|
@ -13,9 +13,7 @@ local function push_left(self, x)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function pop_right(self)
|
local function pop_right(self)
|
||||||
if self:is_empty() then
|
if self:is_empty() then return nil end
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local r = self[self.tail]
|
local r = self[self.tail]
|
||||||
self[self.tail] = nil
|
self[self.tail] = nil
|
||||||
|
@ -25,12 +23,11 @@ local function pop_right(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function pop_left(self)
|
local function pop_left(self)
|
||||||
if self:is_empty() then
|
if self:is_empty() then return nil end
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local r = self[self.head + 1]
|
local r = self[self.head + 1]
|
||||||
self.head = self.head + 1
|
self.head = self.head + 1
|
||||||
|
|
||||||
local r = self[self.head]
|
local r = self[self.head]
|
||||||
self[self.head] = nil
|
self[self.head] = nil
|
||||||
|
|
||||||
|
@ -48,7 +45,7 @@ end
|
||||||
local function iter_left(self)
|
local function iter_left(self)
|
||||||
local i = self.head
|
local i = self.head
|
||||||
|
|
||||||
return function ()
|
return function()
|
||||||
if i < self.tail then
|
if i < self.tail then
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
|
@ -60,7 +57,7 @@ end
|
||||||
local function iter_right(self)
|
local function iter_right(self)
|
||||||
local i = self.tail + 1
|
local i = self.tail + 1
|
||||||
|
|
||||||
return function ()
|
return function()
|
||||||
if i > self.head + 1 then
|
if i > self.head + 1 then
|
||||||
i = i - 1
|
i = i - 1
|
||||||
|
|
||||||
|
@ -125,13 +122,13 @@ GlitchIntensity = 0
|
||||||
local tr = {}
|
local tr = {}
|
||||||
local tr_result = {}
|
local tr_result = {}
|
||||||
local randvector = Vector()
|
local randvector = Vector()
|
||||||
local box_mins = 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 box_maxs = Vector(0.5, 0.5, 0.5)
|
||||||
local awareness = CreateClientConVar("blindness_awareness", 10000, true, false, "Awareness in hu")
|
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")
|
||||||
local boxang = Angle()
|
-- local boxang = Angle()
|
||||||
local vanishvec = Vector()
|
-- local vanishvec = Vector()
|
||||||
local vanishvecrand = Vector()
|
-- local vanishvecrand = Vector()
|
||||||
vanishrandx = 0.5
|
vanishrandx = 0.5
|
||||||
vanishrandy = 0.5
|
vanishrandy = 0.5
|
||||||
vanishrandz = 0.5
|
vanishrandz = 0.5
|
||||||
|
@ -172,7 +169,7 @@ local grass = Color(20, 150, 10)
|
||||||
local sand = Color(76, 70, 50)
|
local sand = Color(76, 70, 50)
|
||||||
local glass = Color(10, 20, 150)
|
local glass = Color(10, 20, 150)
|
||||||
local limit = 5400
|
local limit = 5400
|
||||||
local pinged = false
|
-- local pinged = false
|
||||||
local camvector = Vector()
|
local camvector = Vector()
|
||||||
local camang = Angle()
|
local camang = Angle()
|
||||||
local camlerp = 0
|
local camlerp = 0
|
||||||
|
@ -207,7 +204,7 @@ blindcustompoints = {
|
||||||
Vector()
|
Vector()
|
||||||
}
|
}
|
||||||
local blindcustompoints = blindcustompoints
|
local blindcustompoints = blindcustompoints
|
||||||
local sizemult = 1
|
-- local sizemult = 1
|
||||||
|
|
||||||
function InvertColors()
|
function InvertColors()
|
||||||
for k, v in ipairs(colorslist) do
|
for k, v in ipairs(colorslist) do
|
||||||
|
@ -317,9 +314,7 @@ end
|
||||||
local function Echo(t)
|
local function Echo(t)
|
||||||
table.insert(soundpoints, t.Pos)
|
table.insert(soundpoints, t.Pos)
|
||||||
|
|
||||||
if not blindedsounds[t.SoundName] and t.SoundName:Left(3) ~= "te/" then
|
if not blindedsounds[t.SoundName] and t.SoundName:Left(3) ~= "te/" then return false end
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function PopThatMotherfucker()
|
local function PopThatMotherfucker()
|
||||||
|
@ -336,20 +331,19 @@ local meshtbl = meshtbl
|
||||||
pausescan = false
|
pausescan = false
|
||||||
local mathrandom = math.random
|
local mathrandom = math.random
|
||||||
|
|
||||||
|
/*
|
||||||
local function OptimizeMeshes()
|
local function OptimizeMeshes()
|
||||||
local i = 0
|
local i = 0
|
||||||
local vertexcount = 0
|
-- local vertexcount = 0
|
||||||
|
|
||||||
for v in meshtbl:iter_left() do
|
for v in meshtbl:iter_left() do
|
||||||
if i >= 90 then
|
if i >= 90 then break end
|
||||||
break
|
|
||||||
end
|
|
||||||
|
|
||||||
v:Destroy()
|
v:Destroy()
|
||||||
|
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
*/
|
||||||
|
|
||||||
glob_blindangles = Angle()
|
glob_blindangles = Angle()
|
||||||
glob_blindorigin = Vector()
|
glob_blindorigin = Vector()
|
||||||
|
@ -363,13 +357,11 @@ local function Blindness(origin, angles)
|
||||||
local eyeang = angles
|
local eyeang = angles
|
||||||
local FT = FrameTime()
|
local FT = FrameTime()
|
||||||
local quality = quality:GetBool()
|
local quality = quality:GetBool()
|
||||||
|
|
||||||
glob_blindorigin:Set(origin)
|
glob_blindorigin:Set(origin)
|
||||||
glob_blindangles:Set(angles)
|
glob_blindangles:Set(angles)
|
||||||
|
|
||||||
local hitpointscount = nil
|
local hitpointscount = nil
|
||||||
local vel_l = ply:GetVelocity():Length()
|
-- local vel_l = ply:GetVelocity():Length()
|
||||||
local vel = 2.5
|
-- local vel = 2.5
|
||||||
cang = math.pi * 2 / 16 + (ply.offset or 0)
|
cang = math.pi * 2 / 16 + (ply.offset or 0)
|
||||||
cpos = Vector(0, math.cos(cang) * 75, math.sin(cang) * 250)
|
cpos = Vector(0, math.cos(cang) * 75, math.sin(cang) * 250)
|
||||||
ply.offset = (ply.offset or 0) + FrameTime()
|
ply.offset = (ply.offset or 0) + FrameTime()
|
||||||
|
@ -379,7 +371,6 @@ local function Blindness(origin, angles)
|
||||||
end
|
end
|
||||||
|
|
||||||
local randrender = math.Rand(blindrandrendermin, 1)
|
local randrender = math.Rand(blindrandrendermin, 1)
|
||||||
|
|
||||||
render.Clear(blindcolor[1] * randrender, blindcolor[2] * randrender, blindcolor[3] * randrender, 0)
|
render.Clear(blindcolor[1] * randrender, blindcolor[2] * randrender, blindcolor[3] * randrender, 0)
|
||||||
render.ClearDepth()
|
render.ClearDepth()
|
||||||
render.ClearStencil()
|
render.ClearStencil()
|
||||||
|
@ -391,7 +382,6 @@ local function Blindness(origin, angles)
|
||||||
|
|
||||||
if trace.Hit then
|
if trace.Hit then
|
||||||
hitpoints:push_right(trace.HitPos)
|
hitpoints:push_right(trace.HitPos)
|
||||||
|
|
||||||
local invert = mathrandom()
|
local invert = mathrandom()
|
||||||
|
|
||||||
if invert < 0.05 then
|
if invert < 0.05 then
|
||||||
|
@ -399,10 +389,8 @@ local function Blindness(origin, angles)
|
||||||
end
|
end
|
||||||
|
|
||||||
hitnormal:push_right(trace.HitNormal)
|
hitnormal:push_right(trace.HitNormal)
|
||||||
|
|
||||||
local hcol = colors[trace.MatType]
|
local hcol = colors[trace.MatType]
|
||||||
local hcolclass = colorsclass[trace.Entity:GetClass()]
|
local hcolclass = colorsclass[trace.Entity:GetClass()]
|
||||||
|
|
||||||
hitcolor:push_right(hcol or hcolclass or white)
|
hitcolor:push_right(hcol or hcolclass or white)
|
||||||
|
|
||||||
if limit < hitpoints:length() then
|
if limit < hitpoints:length() then
|
||||||
|
@ -425,7 +413,6 @@ local function Blindness(origin, angles)
|
||||||
|
|
||||||
while limit < hitpointscount do
|
while limit < hitpointscount do
|
||||||
soundpoints:pop_left()
|
soundpoints:pop_left()
|
||||||
|
|
||||||
hitpointscount = soundpoints:length()
|
hitpointscount = soundpoints:length()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -445,20 +432,19 @@ local function Blindness(origin, angles)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local lastpos = hitpoints[hitpoints.tail]
|
-- local lastpos = hitpoints[hitpoints.tail]
|
||||||
local f = eyeang:Forward()
|
local f = eyeang:Forward()
|
||||||
local eyediff = Vector()
|
local eyediff = Vector()
|
||||||
local k = limit
|
local k = limit
|
||||||
local k2 = 0
|
local k2 = 0
|
||||||
local vanishlimit = vanishlimit
|
-- local vanishlimit = vanishlimit
|
||||||
local vanishrandx = vanishrandx
|
-- local vanishrandx = vanishrandx
|
||||||
local vanishrandy = vanishrandy
|
-- local vanishrandy = vanishrandy
|
||||||
local vanishrandz = vanishrandz
|
-- local vanishrandz = vanishrandz
|
||||||
local blindrandx = blindrandx
|
-- local blindrandx = blindrandx
|
||||||
local blindrandy = blindrandy
|
-- local blindrandy = blindrandy
|
||||||
local blindrandz = blindrandz
|
-- local blindrandz = blindrandz
|
||||||
local blindrandobeyglitch = blindrandobeyglitch
|
-- local blindrandobeyglitch = blindrandobeyglitch
|
||||||
|
|
||||||
render.SetMaterial(circle)
|
render.SetMaterial(circle)
|
||||||
|
|
||||||
if not customglitch then
|
if not customglitch then
|
||||||
|
@ -482,7 +468,7 @@ local function Blindness(origin, angles)
|
||||||
|
|
||||||
if not pausescan then
|
if not pausescan then
|
||||||
if not curmesh:IsValid() or CurTime() < nextcachecheck then
|
if not curmesh:IsValid() or CurTime() < nextcachecheck then
|
||||||
local dynmesh = nil
|
-- local dynmesh = nil
|
||||||
|
|
||||||
if CurTime() < nextcachecheck then
|
if CurTime() < nextcachecheck then
|
||||||
if curmesh:IsValid() then
|
if curmesh:IsValid() then
|
||||||
|
@ -497,9 +483,7 @@ local function Blindness(origin, angles)
|
||||||
|
|
||||||
for v in hitpoints:iter_right() do
|
for v in hitpoints:iter_right() do
|
||||||
local col = hitcolor[hitcolor.tail - k2] or BlindGetColor()
|
local col = hitcolor[hitcolor.tail - k2] or BlindGetColor()
|
||||||
|
|
||||||
eyediff:Set(v)
|
eyediff:Set(v)
|
||||||
|
|
||||||
local drawindex = hitindex % drawcount + 1
|
local drawindex = hitindex % drawcount + 1
|
||||||
|
|
||||||
if drawindex == 1 then
|
if drawindex == 1 then
|
||||||
|
@ -557,7 +541,7 @@ local function Blindness(origin, angles)
|
||||||
cam.End3D()
|
cam.End3D()
|
||||||
hook.Run("Blind3DPost", origin, angles)
|
hook.Run("Blind3DPost", origin, angles)
|
||||||
|
|
||||||
local ctsin = math.sin(CurTime())
|
-- local ctsin = math.sin(CurTime())
|
||||||
local col = white
|
local col = white
|
||||||
col.a = alpha
|
col.a = alpha
|
||||||
|
|
||||||
|
@ -585,7 +569,8 @@ local function BlindnessPreUI()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local te = "te/metamorphosis/"
|
-- local te = "te/metamorphosis/"
|
||||||
|
/*
|
||||||
local jingles = {
|
local jingles = {
|
||||||
land = te .. "3-linedrop",
|
land = te .. "3-linedrop",
|
||||||
jump = te .. "1-linemove",
|
jump = te .. "1-linemove",
|
||||||
|
@ -608,6 +593,7 @@ local function BlindnessJingles(event)
|
||||||
LocalPlayer():EmitSound(jingles[event] .. math.random(1, jinglescount[event]) .. ".wav")
|
LocalPlayer():EmitSound(jingles[event] .. math.random(1, jinglescount[event]) .. ".wav")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
*/
|
||||||
|
|
||||||
function ToggleBlindness(toggle)
|
function ToggleBlindness(toggle)
|
||||||
blinded = toggle
|
blinded = toggle
|
||||||
|
@ -662,7 +648,6 @@ function ToggleBlindness(toggle)
|
||||||
|
|
||||||
if bgm then
|
if bgm then
|
||||||
bgm:Stop()
|
bgm:Stop()
|
||||||
|
|
||||||
bgm = nil
|
bgm = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -674,15 +659,13 @@ function cool()
|
||||||
local k = limit
|
local k = limit
|
||||||
local k2 = 0
|
local k2 = 0
|
||||||
a = Mesh(circle)
|
a = Mesh(circle)
|
||||||
|
|
||||||
mesh.Begin(a, MATERIAL_QUADS, limit)
|
mesh.Begin(a, MATERIAL_QUADS, limit)
|
||||||
|
|
||||||
local ed = Vector()
|
-- local ed = Vector()
|
||||||
local meshlen = meshtbl:length()
|
-- local meshlen = meshtbl:length()
|
||||||
|
|
||||||
for v in hitpoints:iter_right() do
|
for v in hitpoints:iter_right() do
|
||||||
mesh.QuadEasy(v, hitnormal[hitnormal.tail - k2], 2, 2, hitcolor[hitcolor.tail - k2] or white)
|
mesh.QuadEasy(v, hitnormal[hitnormal.tail - k2], 2, 2, hitcolor[hitcolor.tail - k2] or white)
|
||||||
|
|
||||||
k = k - 1
|
k = k - 1
|
||||||
k2 = k2 + 1
|
k2 = k2 + 1
|
||||||
end
|
end
|
||||||
|
@ -695,20 +678,23 @@ function cool()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
net.Receive("BlindPlayers", function ()
|
net.Receive("BlindPlayers", function()
|
||||||
ToggleBlindness(net.ReadBool())
|
ToggleBlindness(net.ReadBool())
|
||||||
end)
|
end)
|
||||||
net.Receive("BlindNPCKilled", function ()
|
|
||||||
|
net.Receive("BlindNPCKilled", function()
|
||||||
LocalPlayer():EmitSound("bad.wav", 50, 100 + math.random(-5, 2))
|
LocalPlayer():EmitSound("bad.wav", 50, 100 + math.random(-5, 2))
|
||||||
end)
|
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
|
if IsValid(ent) and ent.DrawLOC then
|
||||||
LOCEntities[ent] = true
|
LOCEntities[ent] = true
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
hook.Add("InitPostEntity", "Beatrun_LOC", function ()
|
|
||||||
|
hook.Add("InitPostEntity", "Beatrun_LOC", function()
|
||||||
if GetGlobalBool("LOC") then
|
if GetGlobalBool("LOC") then
|
||||||
ToggleBlindness(true)
|
ToggleBlindness(true)
|
||||||
end
|
end
|
||||||
|
|
|
@ -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)
|
print(v)
|
||||||
include("cl/"..v)
|
include("cl/" .. v)
|
||||||
end
|
end
|
|
@ -1,17 +1,17 @@
|
||||||
AddCSLuaFile( "cl_init.lua" )
|
AddCSLuaFile("cl_init.lua")
|
||||||
AddCSLuaFile( "shared.lua" )
|
AddCSLuaFile("shared.lua")
|
||||||
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
|
||||||
AddCSLuaFile("cl/"..v)
|
AddCSLuaFile("cl/" .. v)
|
||||||
end
|
end
|
||||||
|
|
||||||
for k,v in ipairs(file.Find("beatrun/gamemode/sh/*.lua", "LUA")) do
|
for k, v in ipairs(file.Find("beatrun/gamemode/sh/*.lua", "LUA")) do
|
||||||
print(v)
|
print(v)
|
||||||
include("sh/"..v)
|
include("sh/" .. v)
|
||||||
AddCSLuaFile("sh/"..v)
|
AddCSLuaFile("sh/" .. v)
|
||||||
end
|
end
|
||||||
|
|
||||||
for k,v in ipairs(file.Find("beatrun/gamemode/sv/*.lua", "LUA")) do
|
for k, v in ipairs(file.Find("beatrun/gamemode/sv/*.lua", "LUA")) do
|
||||||
include("sv/"..v)
|
include("sv/" .. v)
|
||||||
end
|
end
|
|
@ -8,7 +8,7 @@ if CLIENT then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not ply:Alive() or Course_Name ~= "" and ply:GetNW2Int("CPNum", 1) ~= -1 then
|
if not ply:Alive() or Course_Name ~= "" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ hook.Add("SetupMove", "Grapple", function (ply, mv, cmd)
|
||||||
return
|
return
|
||||||
end
|
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
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
if CLIENT then
|
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
|
end
|
||||||
|
|
||||||
function DoJumpTurn(lookbehind)
|
function DoJumpTurn(lookbehind)
|
||||||
|
@ -79,7 +79,7 @@ local function Quickturn(ply, mv, cmd)
|
||||||
end
|
end
|
||||||
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
|
if ply:GetWallrun() == 0 and not ply:OnGround() then
|
||||||
local eyedir = cmd:GetViewAngles()
|
local eyedir = cmd:GetViewAngles()
|
||||||
eyedir.x = 0
|
eyedir.x = 0
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
local mousex = 0
|
local mousex = 0
|
||||||
local mousey = 0
|
local mousey = 0
|
||||||
|
local inf = math.huge
|
||||||
buildmode_props = {}
|
buildmode_props = {}
|
||||||
local propmatsblacklist = {}
|
local propmatsblacklist = {}
|
||||||
local blocksdir = "models/hunter/blocks/"
|
local blocksdir = "models/hunter/blocks/"
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
STAR = "★"
|
STAR = "★"
|
||||||
REC = "⚫"
|
REC = "⚫"
|
||||||
VERSIONGLOBAL = "v1.Zero"
|
VERSIONGLOBAL = "v1.Zero"
|
||||||
DeriveGamemode( "sandbox" )
|
DeriveGamemode("sandbox")
|
||||||
GM.Name = "Beatrun"
|
GM.Name = "Beatrun"
|
||||||
GM.Author = "datae"
|
GM.Author = "datae"
|
||||||
GM.Email = "datae@dontemailme.com"
|
GM.Email = "datae@dontemailme.com"
|
||||||
GM.Website = "www.mirrorsedge.com"
|
GM.Website = "www.mirrorsedge.com"
|
||||||
include( 'player_class/player_beatrun.lua' )
|
include("player_class/player_beatrun.lua")
|
||||||
|
|
||||||
for k,v in ipairs(file.Find("beatrun/gamemode/sh/*.lua", "LUA")) do
|
for k, v in ipairs(file.Find("beatrun/gamemode/sh/*.lua", "LUA")) do
|
||||||
AddCSLuaFile("sh/"..v)
|
AddCSLuaFile("sh/" .. v)
|
||||||
include("sh/"..v)
|
include("sh/" .. v)
|
||||||
end
|
end
|
|
@ -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
|
|
|
@ -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()
|
|
|
@ -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.
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.
Loading…
Reference in a new issue