Cleanup done

Ziplines deletion for Zipline Gun
This commit is contained in:
Jonny_Bro (Nikita) 2023-05-21 16:04:48 +05:00
parent 95792dbc13
commit 71b7b0e879
4 changed files with 341 additions and 277 deletions

View file

@ -1,13 +1,10 @@
# Добавлено мной # Добавлено мной
* Разрешение Overdrive на сервере - *Beatrun_AllowOvedriveInMultiplayer*. * Разрешение Overdrive на сервере - *Beatrun_AllowOvedriveInMultiplayer*.
* Измение цвета худа - *Beatrun_HUDTextColor*, *Beatrun_HUDCornerColor*, *Beatrun_HUDFloatingXPColor*. * Измение цвета худа - *Beatrun_HUDTextColor*, *Beatrun_HUDCornerColor*, *Beatrun_HUDFloatingXPColor*.
* Discord Rich Presence (Нужен модуль из lua/bin) * Discord Rich Presence (Нужны модули из lua/bin)
* Небольшой толчок камеры при нырянии. * Небольшой толчок камеры при нырянии.
* Изменение максимальной скорости - *Beatrun_MaxSpeed* (Спасибо c4nk, я слепой). * Изменение максимальной скорости - *Beatrun_MaxSpeed* (Спасибо c4nk, я слепой).
* Возможность удалять зиплайны от Zipline Gun на ПКМ. (Завтра доделаю) * Возможность удалять зиплайны от Zipline Gun на ПКМ.
# Фиксы с предыдущей версии # Фиксы с предыдущей версии
* Выключил обратно быстрый разворот, хуйня (Чтобы откатить напишите **Beatrun_QuickturnGround 0** в консоль). * Теперь точно починил сохранение курсов.
* Фикс незакрытия меню постройки.
* Фикс сохранения курсов.
* Отключены реплеи до фикса.

View file

@ -1,19 +1,18 @@
local cvarwindsound local cvarwindsound
local minimalvm local minimalvm
if CLIENT then if CLIENT then
minimalvm = CreateClientConVar("Beatrun_MinimalVM", 1, true, true, "Lowers the running viewmodel", 0, 1) minimalvm = CreateClientConVar("Beatrun_MinimalVM", 1, true, true, "Lowers the running viewmodel", 0, 1)
cvarwindsound = CreateClientConVar("Beatrun_Wind", 1, true, false, "Wind noises") cvarwindsound = CreateClientConVar("Beatrun_Wind", 1, true, false, "Wind noises")
SWEP.PrintName = "Unarmed" SWEP.PrintName = "Unarmed"
SWEP.Slot = 0 SWEP.Slot = 0
SWEP.SlotPos = 1 SWEP.SlotPos = 1
SWEP.DrawAmmo = false SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false SWEP.DrawCrosshair = false
hook.Add("VManipPrePlayAnim", "LOCNoVManip", function() hook.Add("VManipPrePlayAnim", "LOCNoVManip", function()
if LocalPlayer():GetActiveWeapon():GetClass() == "runnerhands" or blinded then if LocalPlayer():GetActiveWeapon():GetClass() == "runnerhands" or blinded then return false end
return false
end
end) end)
end end
@ -37,7 +36,7 @@ SWEP.UseHands = false
SWEP.ViewModel = "models/runnerhands.mdl" SWEP.ViewModel = "models/runnerhands.mdl"
SWEP.WorldModel = "" SWEP.WorldModel = ""
SWEP.ViewModelFOV=75 --65 75 SWEP.ViewModelFOV = 75 --65 75
SWEP.Primary.ClipSize = -1 SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1 SWEP.Primary.DefaultClip = -1
@ -49,70 +48,76 @@ SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none" SWEP.Secondary.Ammo = "none"
SWEP.wepvelocity=0 SWEP.wepvelocity = 0
SWEP.lastpunch = 1 --1 right 2 left 3 both
SWEP.lastpunch=1 --1 right 2 left 3 both SWEP.lastanimenum = 0
SWEP.lastanimenum=0 SWEP.spamcount = 0
SWEP.spamcount=0 SWEP.spamlast = 0
SWEP.spamlast=0
SWEP.punchanims = {ACT_DOD_PRIMARYATTACK_PRONE, ACT_DOD_SECONDARYATTACK_PRONE, ACT_DOD_PRIMARYATTACK_KNIFE} SWEP.punchanims = {ACT_DOD_PRIMARYATTACK_PRONE, ACT_DOD_SECONDARYATTACK_PRONE, ACT_DOD_PRIMARYATTACK_KNIFE}
SWEP.punchanimsfb = {"punchright", "punchleft", "punchmid"} SWEP.punchanimsfb = {"punchright", "punchleft", "punchmid"}
SWEP.punchangles = {Angle(2,1,-2), Angle(2,-1,2), Angle(2.5,0,0)} SWEP.punchangles = {Angle(2, 1, -2), Angle(2, -1, 2), Angle(2.5, 0, 0)}
SWEP.punchdelays = {0.165, 0.175, 0.5} SWEP.punchdelays = {0.165, 0.175, 0.5}
SWEP.lastpunchtimer=0 SWEP.lastpunchtimer = 0
SWEP.punching=false SWEP.punching = false
SWEP.doublepunch=false SWEP.doublepunch = false
function SWEP:SetupDataTables() function SWEP:SetupDataTables()
self:NetworkVar( "Bool", 0, "SideStep" ) self:NetworkVar("Bool", 0, "SideStep")
self:NetworkVar( "Bool", 1, "BlockAnims" ) self:NetworkVar("Bool", 1, "BlockAnims")
self:NetworkVar( "Bool", 2, "WasOnGround" ) self:NetworkVar("Bool", 2, "WasOnGround")
self:NetworkVar( "Bool", 3, "QuakeJumping" ) self:NetworkVar("Bool", 3, "QuakeJumping")
self:NetworkVar( "Float", 0, "OwnerVelocity" ) self:NetworkVar("Float", 0, "OwnerVelocity")
self:NetworkVar( "Float", 1, "WeaponVelocity" ) self:NetworkVar("Float", 1, "WeaponVelocity")
self:NetworkVar( "Int", 0, "Punch" ) self:NetworkVar("Int", 0, "Punch")
self:NetworkVar( "Float", 2, "PunchReset" ) self:NetworkVar("Float", 2, "PunchReset")
end end
local runseq = { local runseq = {
[6] = true, [6] = true,
[7] = true [7] = true
} }
local oddseq = { local oddseq = {
[8] = true, [8] = true,
[9] = true, [9] = true,
[10] = true, [10] = true,
[19] = true, [19] = true,
} }
function SWEP:GetViewModelPosition( pos, ang )
function SWEP:GetViewModelPosition(pos, ang)
if minimalvm:GetBool() then if minimalvm:GetBool() then
if !self.posz then self.posz = pos.z end if not self.posz then
self.posz = pos.z
end
local seq = self:GetSequence() local seq = self:GetSequence()
if runseq[seq] then if runseq[seq] then
self.posz = Lerp(10*FrameTime(), self.posz, -2) self.posz = Lerp(10 * FrameTime(), self.posz, -2)
else else
self.posz = Lerp(10*FrameTime(), self.posz, 0) self.posz = Lerp(10 * FrameTime(), self.posz, 0)
end end
pos.z=pos.z + self.posz
pos.z = pos.z + self.posz
end end
if oddseq[self:GetSequence()] then return pos, ang end if oddseq[self:GetSequence()] then return pos, ang end
self.BobScale = 0 self.BobScale = 0
ang.x=math.Clamp(ang.x,-10,89) ang.x = math.Clamp(ang.x, -10, 89)
return pos, ang return pos, ang
end end
function SWEP:Deploy() function SWEP:Deploy()
self:SetHoldType( "normal" ) self:SetHoldType("normal")
self:SendWeaponAnim(ACT_VM_DRAW) self:SendWeaponAnim(ACT_VM_DRAW)
self.RespawnDelay = 0 self.RespawnDelay = 0
self:SetWasOnGround(false) self:SetWasOnGround(false)
self:SetBlockAnims(false) self:SetBlockAnims(false)
self:SetPunch(1) self:SetPunch(1)
RunConsoleCommand("fov_desired", 100) RunConsoleCommand("fov_desired", 100)
end end
@ -126,195 +131,239 @@ function SWEP:Initialize()
self:SetBlockAnims(false) self:SetBlockAnims(false)
end end
local jumpseq = { local jumpseq = {ACT_VM_HAULBACK, ACT_VM_SWINGHARD}
ACT_VM_HAULBACK,
ACT_VM_SWINGHARD -- local jumptr, jumptrout = {}, {}
} -- local jumpvec = Vector(0, 0, -50)
local jumptr, jumptrout = {}, {}
local jumpvec = Vector(0,0,-50)
local fallang = Angle() local fallang = Angle()
local infall local infall
local fallct = 0 local fallct = 0
function SWEP:Think() function SWEP:Think()
local ply = self:GetOwner()
local viewmodel = ply:GetViewModel()
if not IsValid(viewmodel) then return end
local ply=self.Owner if self:GetHoldType() == "fist" and CurTime() > self:GetPunchReset() then
local viewmodel=ply:GetViewModel()
if !IsValid(viewmodel) then return end
if self:GetHoldType() == "fist" and CurTime() > self:GetPunchReset() then
self:SetHoldType("normal") self:SetHoldType("normal")
end end
if self:GetBlockAnims() then ply:GetViewModel():SetPlaybackRate(1) return end if self:GetBlockAnims() then
local curseq=self:GetSequence() ply:GetViewModel():SetPlaybackRate(1)
local onground=ply:OnGround()
local vel = ply:GetVelocity() return
vel.z = 0 end
local ismoving = vel:Length()>100 and !ply:KeyDown(IN_BACK) and ply:IsSprinting() and !ply:Crouching() and !ply:KeyDown(IN_DUCK)
local injump = curseq==13 or curseq == 14 or curseq == 17 or curseq == -1 or curseq == 1 local curseq = self:GetSequence()
infall = curseq==19 local onground = ply:OnGround()
self:SetSideStep((curseq==15 or curseq==16) and GetConVar("Beatrun_SideStep"):GetBool()) local vel = ply:GetVelocity()
local insidestep = self:GetSideStep() vel.z = 0
local spvel = ply:GetVelocity()
local ang = ply:EyeAngles() local ismoving = vel:Length() > 100 and not ply:KeyDown(IN_BACK) and ply:IsSprinting() and not ply:Crouching() and not ply:KeyDown(IN_DUCK)
if spvel.z < -800 and ply:GetMoveType() != MOVETYPE_NOCLIP then local injump = curseq == 13 or curseq == 14 or curseq == 17 or curseq == -1 or curseq == 1
if !infall then infall = curseq == 19
self:SetSideStep((curseq == 15 or curseq == 16) and GetConVar("Beatrun_SideStep"):GetBool())
local insidestep = self:GetSideStep()
local spvel = ply:GetVelocity()
local ang = ply:EyeAngles()
if spvel.z < -800 and ply:GetMoveType() ~= MOVETYPE_NOCLIP then
if not infall then
-- if CLIENT then -- if CLIENT then
-- RemoveBodyAnim() -- RemoveBodyAnim()
-- elseif game.SinglePlayer() then -- elseif game.SinglePlayer() then
-- self.Owner:SendLua("RemoveBodyAnim()") -- self:GetOwner():SendLua("RemoveBodyAnim()")
-- end -- end
self:SendWeaponAnim(ACT_RUN_ON_FIRE) self:SendWeaponAnim(ACT_RUN_ON_FIRE)
end end
if CLIENT and fallct != CurTime() then
local vel = math.min(math.abs(spvel.z)/2500, 1) if CLIENT and fallct ~= CurTime() then
local vel = math.min(math.abs(spvel.z) / 2500, 1)
local mult = 20 local mult = 20
fallang:SetUnpacked(2*vel*FrameTime()*mult, 1.25*vel*FrameTime()*mult, 1.5*vel*FrameTime()*mult)
fallang:SetUnpacked(2 * vel * FrameTime() * mult, 1.25 * vel * FrameTime() * mult, 1.5 * vel * FrameTime() * mult)
fallang:Add(ang) fallang:Add(ang)
fallct = CurTime() fallct = CurTime()
end end
return return
elseif infall then elseif infall then
self:SendWeaponAnim(ACT_VM_DRAW) self:SendWeaponAnim(ACT_VM_DRAW)
ang.z = 0 ang.z = 0
ply:SetEyeAngles(ang) ply:SetEyeAngles(ang)
end end
spvel.z = 0
local velocity = self:GetOwnerVelocity() spvel.z = 0
self.punching = curseq==8 or curseq==9 or curseq==10 or curseq==11
if ply:KeyPressed(IN_JUMP) and self:GetWasOnGround() and !ply:GetJumpTurn() then local velocity = self:GetOwnerVelocity()
ply:ViewPunch(Angle(-2,0,0))
self.punching = curseq == 8 or curseq == 9 or curseq == 10 or curseq == 11
if ply:KeyPressed(IN_JUMP) and self:GetWasOnGround() and not ply:GetJumpTurn() then
ply:ViewPunch(Angle(-2, 0, 0))
local eyeang = ply:EyeAngles() local eyeang = ply:EyeAngles()
eyeang.x = 0 eyeang.x = 0
if insidestep and viewmodel:GetCycle() <= 0.1 and GetConVar("Beatrun_QuakeJump"):GetBool() then if insidestep and viewmodel:GetCycle() <= 0.1 and GetConVar("Beatrun_QuakeJump"):GetBool() then
if SERVER then if SERVER then
ply:EmitSound("quakejump.mp3", 100, 100, 0.2) ply:EmitSound("quakejump.mp3", 100, 100, 0.2)
end end
ply.QuakeJumping = true ply.QuakeJumping = true
self:SetQuakeJumping(true) self:SetQuakeJumping(true)
end end
if !ismoving and !ply:Crouching() then if not ismoving and not ply:Crouching() then
ParkourEvent("jumpstill",ply) ParkourEvent("jumpstill", ply)
elseif !ply:Crouching() then elseif not ply:Crouching() then
if !util.QuickTrace(ply:GetPos()+eyeang:Forward()*200, Vector(0,0,-100), ply).Hit then if not util.QuickTrace(ply:GetPos() + eyeang:Forward() * 200, Vector(0, 0, -100), ply).Hit then
self:SendWeaponAnim(jumpseq[1]) self:SendWeaponAnim(jumpseq[1])
ParkourEvent("jumpfar",ply)
ParkourEvent("jumpfar", ply)
else else
self:SendWeaponAnim(jumpseq[2]) self:SendWeaponAnim(jumpseq[2])
ParkourEvent("jump",ply)
end
end
return
end
if onground then ParkourEvent("jump", ply)
end
end
return
end
if onground then
self:SetQuakeJumping(false) self:SetQuakeJumping(false)
end end
if ply:GetSliding() or ply:GetSlidingDelay()-0.15 > CurTime() then if ply:GetSliding() or ply:GetSlidingDelay() - 0.15 > CurTime() then
self:SendWeaponAnim(ACT_VM_DRAW) self:SendWeaponAnim(ACT_VM_DRAW)
return return
end end
if (self.punching) and viewmodel:GetCycle()>=1 then if self.punching and viewmodel:GetCycle() >= 1 then
self:SendWeaponAnim(ACT_VM_DRAW) self:SendWeaponAnim(ACT_VM_DRAW)
end end
if injump and (viewmodel:GetCycle()>=1 or (ply:GetMantle() != 0 and ply:KeyDown(IN_JUMP)) or ply:GetWallrun() > 1) then if injump and (viewmodel:GetCycle() >= 1 or (ply:GetMantle() ~= 0 and ply:KeyDown(IN_JUMP)) or ply:GetWallrun() > 1) then
self:SendWeaponAnim(ACT_VM_DRAW) self:SendWeaponAnim(ACT_VM_DRAW)
end end
self:SetWeaponVelocity(Lerp(5*FrameTime(),self:GetWeaponVelocity(),velocity)) self:SetWeaponVelocity(Lerp(5 * FrameTime(), self:GetWeaponVelocity(), velocity))
if !ismoving then
if not ismoving then
self:SetWeaponVelocity(velocity) self:SetWeaponVelocity(velocity)
end end
if !self.punching and !insidestep then
if onground and ismoving and curseq!=6 and velocity<=350 then if not self.punching and not insidestep then
if onground and ismoving and curseq ~= 6 and velocity <= 350 then
self:SendWeaponAnim(ACT_RUN) self:SendWeaponAnim(ACT_RUN)
elseif onground and ismoving and curseq!=7 and velocity>350 then elseif onground and ismoving and curseq ~= 7 and velocity > 350 then
local cycle = self:GetCycle() local cycle = self:GetCycle()
self:SendWeaponAnim(ACT_RUN_PROTECTED) self:SendWeaponAnim(ACT_RUN_PROTECTED)
self:SetCycle(cycle) self:SetCycle(cycle)
elseif (curseq==6 or curseq==7) and (velocity<50 or !ismoving or !onground) and curseq!=13 then elseif (curseq == 6 or curseq == 7) and (velocity < 50 or not ismoving or not onground) and curseq ~= 13 then
self:SendWeaponAnim(ACT_VM_DRAW) self:SendWeaponAnim(ACT_VM_DRAW)
if !onground and ply:GetSafetyRollKeyTime() <= CurTime() and ply:GetSafetyRollTime() <= CurTime() then
ParkourEvent("fall", self.Owner)
end
end
end
curseq = self:GetSequence() if not onground and ply:GetSafetyRollKeyTime() <= CurTime() and ply:GetSafetyRollTime() <= CurTime() then
if (curseq==6 or curseq==7) and ismoving then ParkourEvent("fall", self:GetOwner())
local rate = (curseq==7 and 1.2) or 0.75 end
if rate != ply:GetViewModel():GetPlaybackRate() then end
end
curseq = self:GetSequence()
if (curseq == 6 or curseq == 7) and ismoving then
local rate = (curseq == 7 and 1.2) or 0.75
if rate ~= ply:GetViewModel():GetPlaybackRate() then
ply:GetViewModel():SetPlaybackRate(rate) ply:GetViewModel():SetPlaybackRate(rate)
end end
else else
ply:GetViewModel():SetPlaybackRate(1) ply:GetViewModel():SetPlaybackRate(1)
end end
if CLIENT then if CLIENT then
if !self.RunWind1 or !self.RunWind1.Play then if not self.RunWind1 or not self.RunWind1.Play then
self.RunWind1 = CreateSound(self, "clotheswind.wav") self.RunWind1 = CreateSound(self, "clotheswind.wav")
self.RunWind2 = CreateSound(self, "runwind.wav") self.RunWind2 = CreateSound(self, "runwind.wav")
end end
if velocity>250 and cvarwindsound:GetBool() then if velocity > 250 and cvarwindsound:GetBool() then
self.RunWind1:Play() self.RunWind1:Play()
self.RunWind2:Play() self.RunWind2:Play()
self.RunWindVolume = math.Clamp(self.RunWindVolume + (0.5*FrameTime()), 0, 1) self.RunWindVolume = math.Clamp(self.RunWindVolume + (0.5 * FrameTime()), 0, 1)
self.RunWind1:ChangeVolume(self.RunWindVolume) self.RunWind1:ChangeVolume(self.RunWindVolume)
self.RunWind2:ChangeVolume(self.RunWindVolume) self.RunWind2:ChangeVolume(self.RunWindVolume)
else else
self.RunWindVolume = math.Clamp(self.RunWindVolume - (2.5*FrameTime()), 0, 1) self.RunWindVolume = math.Clamp(self.RunWindVolume - (2.5 * FrameTime()), 0, 1)
self.RunWind1:ChangeVolume(self.RunWindVolume) self.RunWind1:ChangeVolume(self.RunWindVolume)
self.RunWind2:ChangeVolume(self.RunWindVolume) self.RunWind2:ChangeVolume(self.RunWindVolume)
end end
end end
if blinded then if blinded then
self.RunWind1:ChangeVolume(0) self.RunWind1:ChangeVolume(0)
self.RunWind2:ChangeVolume(0) self.RunWind2:ChangeVolume(0)
end end
if insidestep and viewmodel:GetCycle()>=1 then if insidestep and viewmodel:GetCycle() >= 1 then
local mult = (ply:InOverdrive() and 1.25) or 1 local mult = (ply:InOverdrive() and 1.25) or 1
self:SendWeaponAnim(ACT_VM_DRAW) self:SendWeaponAnim(ACT_VM_DRAW)
ply:SetMEMoveLimit(350*mult)
ply:SetMESprintDelay(CurTime())
elseif insidestep then
local mult = (ply:InOverdrive() and 1.25) or 1
ply:SetMEMoveLimit(350*mult)
ply:SetMESprintDelay(CurTime())
end
self:SetWasOnGround(ply:OnGround())
ply:SetMEMoveLimit(350 * mult)
ply:SetMESprintDelay(CurTime())
elseif insidestep then
local mult = (ply:InOverdrive() and 1.25) or 1
ply:SetMEMoveLimit(350 * mult)
ply:SetMESprintDelay(CurTime())
end
self:SetWasOnGround(ply:OnGround())
end end
if CLIENT then if CLIENT then
local didfallang = false local didfallang = false
local mouseang = Angle() local mouseang = Angle()
hook.Add("InputMouseApply", "FallView", function(cmd, x, y, ang)
hook.Add("InputMouseApply", "FallView", function(cmd, x, y, ang)
local ply = LocalPlayer() local ply = LocalPlayer()
if infall and !BodyAnimArmCopy and ply:Alive() and ply:GetMoveType()!=MOVETYPE_NOCLIP then
mouseang.x, mouseang.y = y*0.01, x*-0.01 if infall and not BodyAnimArmCopy and ply:Alive() and ply:GetMoveType() ~= MOVETYPE_NOCLIP then
mouseang.x, mouseang.y = y * 0.01, x * -0.01
fallang:Add(mouseang) fallang:Add(mouseang)
cmd:SetViewAngles(fallang) cmd:SetViewAngles(fallang)
didfallang = true didfallang = true
util.ScreenShake( vector_origin, 5*(math.abs(ply:GetVelocity().z)/1000), 5, 0.05, 5000 )
util.ScreenShake(vector_origin, 5 * (math.abs(ply:GetVelocity().z) / 1000), 5, 0.05, 5000)
return true return true
elseif didfallang then elseif didfallang then
fallang.z = 0 fallang.z = 0
fallang.x = math.Clamp(fallang.x, -89, 89) fallang.x = math.Clamp(fallang.x, -89, 89)
if ply:Alive() then cmd:SetViewAngles(fallang) end
if ply:Alive() then
cmd:SetViewAngles(fallang)
end
didfallang = false didfallang = false
end end
end) end)
end end
function SWEP:Holster() function SWEP:Holster()
@ -322,6 +371,7 @@ function SWEP:Holster()
self.RunWind1:Stop() self.RunWind1:Stop()
self.RunWind2:Stop() self.RunWind2:Stop()
end end
return true return true
end end
@ -334,15 +384,18 @@ end
function SWEP:Reload() function SWEP:Reload()
if GetGlobalBool(GM_DATATHEFT) then return end if GetGlobalBool(GM_DATATHEFT) then return end
if !TUTORIALMODE and CurTime() > self.RespawnDelay and self.Owner:GetClimbing() == 0 and !IsValid(self.Owner:GetSwingbar()) and !self.Owner.BuildMode then
self.Owner:Spawn() if not TUTORIALMODE and CurTime() > self.RespawnDelay and self:GetOwner():GetClimbing() == 0 and not IsValid(self:GetOwner():GetSwingbar()) and not self:GetOwner().BuildMode then
if self.Owner:KeyDown(IN_USE) then self:GetOwner():Spawn()
if self:GetOwner():KeyDown(IN_USE) then
if game.SinglePlayer() then if game.SinglePlayer() then
RunConsoleCommand("toggleblindness") RunConsoleCommand("toggleblindness")
elseif CLIENT then elseif CLIENT then
ToggleBlindness(!blinded) ToggleBlindness(not blinded)
end end
end end
self.RespawnDelay = CurTime() + 0.5 self.RespawnDelay = CurTime() + 0.5
end end
end end
@ -353,91 +406,100 @@ local tr_result = {}
local allow_overdrive = CreateConVar("Beatrun_AllowOvedriveInMultiplayer", 0, {FCVAR_REPLICATED, FCVAR_ARCHIVE}) local allow_overdrive = CreateConVar("Beatrun_AllowOvedriveInMultiplayer", 0, {FCVAR_REPLICATED, FCVAR_ARCHIVE})
function SWEP:PrimaryAttack() function SWEP:PrimaryAttack()
local ply = self.Owner local ply = self:GetOwner()
if ply:KeyDown(IN_USE) and (game.SinglePlayer() or allow_overdrive:GetBool()) then if ply:KeyDown(IN_USE) and (game.SinglePlayer() or allow_overdrive:GetBool()) then
local mult = (ply:InOverdrive() and 1) or 1.25 local mult = (ply:InOverdrive() and 1) or 1.25
local fovmult = (mult == 1 and 1) or 1.1 local fovmult = (mult == 1 and 1) or 1.1
ply:SetMEMoveLimit(ply:GetMEMoveLimit()*0.75)
ply:SetMEMoveLimit(ply:GetMEMoveLimit() * 0.75)
ply:SetOverdriveMult(mult) ply:SetOverdriveMult(mult)
ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120)*fovmult, 0.125) ply:SetFOV(ply:GetInfoNum("Beatrun_FOV", 120) * fovmult, 0.125)
return
end
if !ply:OnGround() or ply:Crouching() or ply:GetSliding() or ply:GetGrappling() or ply:GetWallrun() != 0 then
return return
end end
if not ply:OnGround() or ply:Crouching() or ply:GetSliding() or ply:GetGrappling() or ply:GetWallrun() ~= 0 then return end
local curseq = self:GetSequence() local curseq = self:GetSequence()
local infall = curseq==19 local infall = curseq == 19
if infall then return end if infall then return end
if CurTime() > self:GetPunchReset() then if CurTime() > self:GetPunchReset() then
self:SetPunch(1) self:SetPunch(1)
end end
local punch = self:GetPunch() local punch = self:GetPunch()
self:SendWeaponAnim(self.punchanims[punch]) self:SendWeaponAnim(self.punchanims[punch])
if CLIENT and IsFirstTimePredicted() then if CLIENT and IsFirstTimePredicted() then
ArmInterrupt(self.punchanimsfb[punch]) ArmInterrupt(self.punchanimsfb[punch])
elseif game.SinglePlayer() then elseif game.SinglePlayer() then
ply:SendLua("ArmInterrupt('"..self.punchanimsfb[punch].."')") ply:SendLua("ArmInterrupt('" .. self.punchanimsfb[punch] .. "')")
end end
ply:ViewPunch(self.punchangles[punch]) ply:ViewPunch(self.punchangles[punch])
self:SetNextPrimaryFire(CurTime()+self.punchdelays[punch])
self:SetPunchReset(CurTime()+0.5) self:SetNextPrimaryFire(CurTime() + self.punchdelays[punch])
self:SetPunchReset(CurTime() + 0.5)
tr.start = ply:GetShootPos() tr.start = ply:GetShootPos()
tr.endpos = ply:GetShootPos() + ply:GetAimVector() * 50 tr.endpos = ply:GetShootPos() + ply:GetAimVector() * 50
tr.filter = ply tr.filter = ply
tr.mins = Vector( -8 , -8 , -8 ) tr.mins = Vector(-8, -8, -8)
tr.maxs = Vector( 8 , 8 , 8 ) tr.maxs = Vector(8, 8, 8)
tr.output = tr_result tr.output = tr_result
if ply:IsPlayer() then if ply:IsPlayer() then
ply:LagCompensation( true ) ply:LagCompensation(true)
self:SetHoldType( "fist" )
self:SetHoldType("fist")
ply:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_HL2MP_GESTURE_RANGE_ATTACK_FIST, true) ply:AnimRestartGesture(GESTURE_SLOT_ATTACK_AND_RELOAD, ACT_HL2MP_GESTURE_RANGE_ATTACK_FIST, true)
end end
util.TraceHull( tr ) util.TraceHull(tr)
self:EmitSound("mirrorsedge/Melee/armswoosh"..math.random(1, 6)..".wav")
self:EmitSound("mirrorsedge/Melee/armswoosh" .. math.random(1, 6) .. ".wav")
if ply:IsPlayer() then if ply:IsPlayer() then
ply:LagCompensation( false ) ply:LagCompensation(false)
end end
if tr_result.Hit then if tr_result.Hit then
self:EmitSound("mirrorsedge/Melee/fist"..math.random(1, 5)..".wav") self:EmitSound("mirrorsedge/Melee/fist" .. math.random(1, 5) .. ".wav")
local ent = tr_result.Entity
if SERVER and IsValid(ent) then local ent = tr_result.Entity
if !ply:IsPlayer() or (Course_Name == "" and !GetGlobalBool(GM_INFECTION)) then
local d = DamageInfo() if SERVER and IsValid(ent) then
d:SetDamage( (punch != 3 and 10) or 20 ) if not ply:IsPlayer() or (Course_Name == "" and not GetGlobalBool(GM_INFECTION)) then
d:SetAttacker( ply ) local d = DamageInfo()
d:SetInflictor( self ) d:SetDamage((punch ~= 3 and 10) or 20)
d:SetDamageType( DMG_CLUB ) d:SetAttacker(ply)
d:SetDamagePosition(tr.start) d:SetInflictor(self)
d:SetDamageForce(ply:EyeAngles():Forward()*7000) d:SetDamageType(DMG_CLUB)
d:SetDamagePosition(tr.start)
d:SetDamageForce(ply:EyeAngles():Forward() * 7000)
ent:TakeDamageInfo(d)
ent:TakeDamageInfo( d )
if ent:IsNPC() then if ent:IsNPC() then
ent:SetActivity(ACT_FLINCH_HEAD) ent:SetActivity(ACT_FLINCH_HEAD)
end end
end end
end end
if game.SinglePlayer() or (CLIENT and IsFirstTimePredicted()) then if game.SinglePlayer() or (CLIENT and IsFirstTimePredicted()) then
util.ScreenShake( Vector(0, 0, 0), 2.5, 10, 0.25, 0 ) util.ScreenShake(Vector(0, 0, 0), 2.5, 10, 0.25, 0)
end end
end end
self:SetPunch(punch+1) self:SetPunch(punch + 1)
if punch+1 > 3 then
if punch + 1 > 3 then
self:SetPunch(1) self:SetPunch(1)
end end
end end
function SWEP:SecondaryAttack() function SWEP:SecondaryAttack()
end end

View file

@ -23,7 +23,7 @@ SWEP.UseHands = true
SWEP.ViewModel = "models/weapons/c_crossbow.mdl" SWEP.ViewModel = "models/weapons/c_crossbow.mdl"
SWEP.WorldModel = "models/weapons/w_crossbow.mdl" SWEP.WorldModel = "models/weapons/w_crossbow.mdl"
SWEP.ViewModelFOV = 75 -- 65 SWEP.ViewModelFOV = 55 -- 75
SWEP.Primary.ClipSize = -1 SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1 SWEP.Primary.DefaultClip = -1
@ -35,6 +35,8 @@ SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none" SWEP.Secondary.Ammo = "none"
local ziplines = {}
function SWEP:SetupDataTables() function SWEP:SetupDataTables()
end end
@ -63,12 +65,16 @@ function SWEP:PrimaryAttack()
local ply = self:GetOwner() local ply = self:GetOwner()
if SERVER then if SERVER then
CreateZipline(ply:EyePos(), ply:GetEyeTrace().HitPos) local zip = CreateZipline(ply:EyePos(), ply:GetEyeTrace().HitPos)
table.insert(ziplines, zip)
end end
end end
function SWEP:SecondaryAttack() function SWEP:SecondaryAttack()
-- for k, v in pairs(ziplines) do for k, v in pairs(ziplines) do
-- v:Remove() v:Remove()
-- end end
table.Empty(ziplines)
end end

View file

@ -891,10 +891,8 @@ if CLIENT then
local save = {{}, {}, Course_StartPos, Course_StartAng, name or "Unnamed", {}} local save = {{}, {}, Course_StartPos, Course_StartAng, name or "Unnamed", {}}
for k, v in pairs(buildmode_placed) do for k, v in pairs(buildmode_placed) do
if not IsValid(v) then if not IsValid(v) then -- Nothing
return
elseif v:GetNW2Bool("BRProtected") then elseif v:GetNW2Bool("BRProtected") then
-- Nothing
print("ignoring protected ent") print("ignoring protected ent")
else else
local class = v:GetClass() local class = v:GetClass()
@ -936,7 +934,8 @@ if CLIENT then
local jsonsave = util.TableToJSON(save) local jsonsave = util.TableToJSON(save)
local crc = util.CRC(jsonsave) local crc = util.CRC(jsonsave)
local dir = "beatrun/courses/" .. game.GetMap() .. "/" local dir = "beatrun/courses/" .. game.GetMap() .. "/"
compress = compress or true
if compress == nil then compress = true end
file.CreateDir(dir) file.CreateDir(dir)
@ -946,16 +945,16 @@ if CLIENT then
file.Write(dir .. crc .. ".txt", jsonsave) file.Write(dir .. crc .. ".txt", jsonsave)
end end
print("Save created:", crc) print("Save created: " .. crc .. ".txt")
end end
concommand.Add("Beatrun_SaveCourse", function(ply, cmd, args, argstr) concommand.Add("Beatrun_SaveCourse", function(ply, cmd, args, argstr)
local name = args[1] or "Unnamed" local name = args[1] or "Unnamed"
local compress = not args[2] -- local compress = not args[2]
print(compress) print(args[2])
SaveCourse(name, compress) SaveCourse(name, args[2])
end) end)
function LoadCourse(id) function LoadCourse(id)