Merge branch 'JonnyBro-main' of https://github.com/losttrackpad/beatrun-forked into JonnyBro-main

This commit is contained in:
LostTrackpad 2024-08-17 17:07:56 +07:00
commit 775924d899
51 changed files with 218 additions and 3073 deletions

3
.gitignore vendored
View file

@ -1,3 +0,0 @@
BeatrunAnimInstaller_Source/.vs
BeatrunAnimInstaller_Source/obj
BeatrunAnimInstaller_Source/bin

View file

@ -1,7 +1,11 @@
# Beatrun | Community edition
* [Русский](./README_ru.md)\
*(If you can read English: This isn't maintained, I don't speak Russian)*
[![forthebadge](https://forthebadge.com/images/featured/featured-powered-by-electricity.svg)](https://forthebadge.com)
[![forthebadge](https://forthebadge.com/images/badges/powered-by-black-magic.svg)](https://forthebadge.com)
[Click to join our Discord!](https://discord.gg/93Psubbgsg)
* [Русский](./README.ru.md)
**PLEASE READ EVERYTHING BEFORE ASKING QUESTIONS ON OUR SERVER!**

View file

@ -1,5 +1,8 @@
# Beatrun | Community edition
[![forthebadge](https://forthebadge.com/images/featured/featured-powered-by-electricity.svg)](https://forthebadge.com)
[![forthebadge](https://forthebadge.com/images/badges/powered-by-black-magic.svg)](https://forthebadge.com)
[Нажми чтобы присоединиться к нашему Discord серверу!](https://discord.gg/93Psubbgsg)
* [English](./README.md)
@ -41,7 +44,7 @@ irm https://beatrun.jonnybro.ru/install | iex
1. **[Скачайте проект](https://github.com/JonnyBro/beatrun/archive/refs/heads/master.zip)**.
2. **Удалите папку `beatrun` по пути *путь_к_игре/garrysmod/addons* если присутствует.**
3. Извлеките папку `beatrun-main/beatrun` по пути *путь_к_игре/garrysmod/addons*.
4. Если вы хотите показ статусов в Discord Steam:
4. Если вы хотите показ статусов в Discord и Steam:
* Извлеките папку `beatrun-main/lua` по пути *путь_к_игре/garrysmod*.
5. Выберите режим `Beatrun` в правом нижнем углу.

View file

@ -102,9 +102,6 @@ beatrun.toolsmenu.hud.dynamicdesc=Hides HUD when moving
beatrun.toolsmenu.hud.sway=HUD Sway
beatrun.toolsmenu.hud.swaydesc=Toggles HUD swaying
beatrun.toolsmenu.hud.reticle=Show Reticle
beatrun.toolsmenu.hud.reticledesc=Shows a dot in the center of the screen
beatrun.toolsmenu.hud.nametags=Show Nametags
beatrun.toolsmenu.hud.nametagsdesc=Toggles nametags above players

View file

@ -99,9 +99,6 @@ beatrun.toolsmenu.hud.dynamicdesc=Nasconde l'HUD durante lo spostamento
beatrun.toolsmenu.hud.sway=Oscillazione dell'HUD
beatrun.toolsmenu.hud.swaydesc=Attiva/disattiva l'oscillazione dell'HUD
beatrun.toolsmenu.hud.reticle=Mostra reticolo
beatrun.toolsmenu.hud.reticledesc=Mostra un punto al centro dello schermo
beatrun.toolsmenu.hud.nametags=Show Nametags
beatrun.toolsmenu.hud.nametagsdesc=Attiva/disattiva i nametag sopra i giocatori

View file

@ -100,9 +100,6 @@ beatrun.toolsmenu.hud.dynamicdesc=Ukrywa interfejs w ruchu
beatrun.toolsmenu.hud.sway=Kołysanie interfejsu
beatrun.toolsmenu.hud.swaydesc=Włącz/Wyłącz kołysanie interfejsu
beatrun.toolsmenu.hud.reticle=Pokaż kropkę
beatrun.toolsmenu.hud.reticledesc=Wyświetla kropkę na środku ekranu
beatrun.toolsmenu.hud.nametags=Pokaż identyfikatory
beatrun.toolsmenu.hud.nametagsdesc=Włącz/Wyłącz wyświetlanie identyfikatorów nad graczami
@ -133,17 +130,23 @@ beatrun.toolsmenu.camera.fovdesc=Zmienia pole widzenia
beatrun.toolsmenu.gameplay.name=Rozgrywka
beatrun.toolsmenu.gameplay.desc=Ustawienia rozgrywki
beatrun.toolsmenu.gameplay.oldanims=Stare animacje
beatrun.toolsmenu.gameplay.oldanimsdesc=Włącz/Wyłącz animacje z oryginalnej wersji moda
beatrun.toolsmenu.gameplay.quickturnground=Szybki obrót na ziemi
beatrun.toolsmenu.gameplay.quickturngrounddesc=Umożliwia szybki obrót za pomocą ataku drugorzędnego na ziemi
beatrun.toolsmenu.gameplay.quickturnhandsonly=Szybki obrót tylko z rękami
beatrun.toolsmenu.gameplay.quickturnhandsonlydesc=Umożliwia szybki obrót tylko w trybie "Rąk biegacza"
beatrun.toolsmenu.gameplay.puristmode=Tryb purysty
beatrun.toolsmenu.gameplay.puristmode=Tryb Purysty
beatrun.toolsmenu.gameplay.puristmodedesc=Tryb purystyczny to opcja po stronie klienta, która poważnie ogranicza zdolność do strafe'owania w powietrzu, tak jak w grach z serii ME.\nWył. = Brak ograniczeń\nWł. = Zmniejszona prędkość ruchu w powietrzu.
beatrun.toolsmenu.gameplay.disablegrapple=Wyłącza zdolność używania tyrolki
beatrun.toolsmenu.gameplay.disablegrappledesc=Wyłącz zdolność używania tyrolki
beatrun.toolsmenu.gameplay.disablegrapple=Wyłącz zdolność używania tyrolki
beatrun.toolsmenu.gameplay.disablegrappledesc=Wyłącza zdolność używania tyrolki
beatrun.toolsmenu.gameplay.rollspeedloss=Utrata prędkości przy przewrocie
beatrun.toolsmenu.gameplay.rollspeedlossdesc=Włącz/Wyłącz utratę prędkości przy przewrocie na końcu upadku
# Tools Menu Misc Section
beatrun.toolsmenu.misc.name=Inne
@ -166,7 +169,7 @@ beatrun.toolsmenu.moves.help=Możesz nurkować, używając Ctrl + PPM w powietrz
beatrun.toolsmenu.moves.speedlimit=Limit prędkości
beatrun.toolsmenu.moves.speedlimitdesc=Zmienia limit prędkości gracza\nDomyślnie: 325
beatrun.toolsmenu.moves.forcepuristmode=Wymuś tryb purysty
beatrun.toolsmenu.moves.forcepuristmode=Wymuś Tryb Purysty
beatrun.toolsmenu.moves.forcepuristmodedesc=Wymusza tryb purystyczny na wszystkich graczach na serwerze.
beatrun.toolsmenu.moves.realisticwallrunning="Realistyczne" bieganie po ścianach
@ -201,6 +204,9 @@ beatrun.toolsmenu.moves.totsugekiheadingdesc=Umożliwia używanie ruchu "Totsuge
beatrun.toolsmenu.moves.totsugekidirection=Kierunek ruchu Totsugeki
beatrun.toolsmenu.moves.totsugekidirectiondesc=Umożliwia wykonanie ruchu "Totsugeki" w innym kierunku\nW połączeniu z opcją "Spamowania" oraz "Poruszania", sprawi, że odlecisz =)
beatrun.toolsmenu.moves.totsugekiaudio=Głos Totsugekiego
beatrun.toolsmenu.moves.totsugekiaudiodesc=Włącz/Wyłącz głos "Totsugekiego"
# Tools Menu Gamemodes Section
beatrun.toolsmenu.gamemodes.name=Tryby gry
beatrun.toolsmenu.gamemodes.desc=Ustawienia trybów gry
@ -213,6 +219,16 @@ beatrun.toolsmenu.gamemodes.infectiontime=Czas w sekundach
beatrun.toolsmenu.gamemodes.datatheft=Włącz/Wyłącz tryb gry "Kradzież danych"
beatrun.toolsmenu.gamemodes.deathmatch=Włącz/Wyłącz tryb gry "Pojedynek"
# Tools Menu Extra Section
beatrun.toolsmenu.extra.name=Dodatkowe
beatrun.toolsmenu.extra.desc=Dodatkowe ustawienia dla naczaśników/spoceńców
beatrun.toolsmenu.extra.stats=Dodatkowe statystyki
beatrun.toolsmenu.extra.statsdesc=Wyświetla dodatkowe statystyki oprócz prędkościomierza, aby zapewnić więcej informacji pomocnych przy trudniejszych trikach
beatrun.toolsmenu.extra.speedrunsverif=Statystyki weryfikacji naczasu
beatrun.toolsmenu.extra.speedrunsverifdesc=Pokazuje informacje o twoich ustawieniach (Tryb Purysty, "Realistyczne" bieganie po ścianach oraz wersja Kick Glitch'a)
# Checkpoints
beatrun.checkpoints.countdown1=Gotowy
beatrun.checkpoints.countdown2=Do startu
@ -238,3 +254,7 @@ beatrun.infection.infectedby=zainfekował
beatrun.infection.award=Nagrodzono cię 200-ma PD za przetrwanie!
beatrun.infection.awardinfected=Nagrodzono cię 100-ma PD za odrodzenie się jako zainfekowany!
beatrun.infection.end=Rozgrywka zakończkona!\nPrzetrwańcy: %s\nReset za 15s
# Server ConVars
beatrun.randommwloadouts=Losowe uzbrojenie MW Base
beatrun.randommwloadoutsdesc=Włącz/Wyłącz losowe uzbrojenie MW Base w trybach Pojedynku i Kradzieży danych

View file

@ -100,9 +100,6 @@ beatrun.toolsmenu.hud.dynamicdesc=Esconder a HUD enquanto estiver movendo
beatrun.toolsmenu.hud.sway=Balanceamento da HUD
beatrun.toolsmenu.hud.swaydesc=Ativar o Balanceamento da HUD
beatrun.toolsmenu.hud.reticle=Mostrar Retículo
beatrun.toolsmenu.hud.reticledesc=Mostra um ponto no centro da tela
beatrun.toolsmenu.hud.nametags=Mostrar crachás
beatrun.toolsmenu.hud.nametagsdesc=Mostrar crachás acima dos nomes de jogadores

View file

@ -102,9 +102,6 @@ beatrun.toolsmenu.hud.dynamicdesc=Прячет HUD во время движен
beatrun.toolsmenu.hud.sway=Покачивание HUD
beatrun.toolsmenu.hud.swaydesc=Покачивает HUD при разнообразных действиях
beatrun.toolsmenu.hud.reticle=Показать Точку
beatrun.toolsmenu.hud.reticledesc=Показывает точку по середине экрана
beatrun.toolsmenu.hud.nametags=Показать Ники
beatrun.toolsmenu.hud.nametagsdesc=Показывает ники над игроками

View file

@ -100,9 +100,6 @@ beatrun.toolsmenu.hud.dynamicdesc=Hareket ederken arayüzü gizler
beatrun.toolsmenu.hud.sway=Arayüz Sarsıntısı
beatrun.toolsmenu.hud.swaydesc=Arayüz sallanmayı açar/kapatır
beatrun.toolsmenu.hud.reticle=Nişangahı Göster
beatrun.toolsmenu.hud.reticledesc=Ekranın ortasında bir nokta gösterir
beatrun.toolsmenu.hud.nametags=Ad Etiketlerini Göster
beatrun.toolsmenu.hud.nametagsdesc=Oyuncuların üzerindeki ad etiketlerini açar

View file

@ -101,9 +101,6 @@ beatrun.toolsmenu.hud.dynamicdesc=Пряче HUD під час руху
beatrun.toolsmenu.hud.sway=Погойдування HUD
beatrun.toolsmenu.hud.swaydesc=Погойдує HUD під час різноманітних дій
beatrun.toolsmenu.hud.reticle=Показати Точку
beatrun.toolsmenu.hud.reticledesc=Показує точку по середині екрана
beatrun.toolsmenu.hud.nametags=Показати Ніки
beatrun.toolsmenu.hud.nametagsdesc=Показує ніки над гравцями

View file

@ -1,266 +0,0 @@
ENT.Type = "anim"
ENT.Base = "base_entity"
ENT.PrintName = "Rabbitfrog"
ENT.Author = ""
ENT.Category = "Beatrun"
ENT.Information = ""
ENT.Spawnable = true
ENT.RenderGroup = RENDERGROUP_OPAQUE
AddCSLuaFile()
ENT.Model = "models/nt/props_vehicles/rabbitfrog_dynamic.mdl"
ENT.AutomaticFrameAdvance = true
function ENT:SetupDataTables()
self:NetworkVar("Entity", 0, "Passenger1")
self:NetworkVar("Entity", 1, "Passenger2")
self:NetworkVar("Entity", 2, "Passenger3")
self:NetworkVar("Entity", 3, "Passenger4")
self:NetworkVar("Vector", 0, "DestinationPos")
self:NetworkVar("Angle", 1, "DestinationAngle")
end
-- local mins, maxs = Vector(-64, -64, 0), Vector(64, 64, 154)
function ENT:Initialize()
self:SetModel(self.Model)
-- self:SetMoveType(MOVETYPE_NONE)
-- self:SetSolid(SOLID_BBOX)
-- self:SetCollisionBounds(mins, maxs)
if SERVER then
self:PhysicsInit(SOLID_VPHYSICS)
end
self:SetMoveType(MOVETYPE_VPHYSICS)
self:ResetSequence(1)
if SERVER then
self:SetUseType(SIMPLE_USE)
end
end
function ENT:OnRemove()
end
function ENT:UpdateTransmitState()
return TRANSMIT_ALWAYS
end
function ENT:Think()
self:NextThink(CurTime())
return true
end
local blur = Material("pp/blurscreen")
local function draw_blur(a, d)
surface.SetDrawColor(255, 255, 255)
surface.SetMaterial(blur)
for i = 1, d do
blur:SetFloat("$blur", (i / d) * a)
blur:Recompute()
render.UpdateScreenEffectTexture()
surface.DrawTexturedRect(0, 0, ScrW(), ScrH())
end
end
local blurint = 4
-- local rabbitpos, rabbitang = Vector(), Angle()
local landseq = {
[1] = true,
[4] = true
}
-- local initseq = 1
-- local offset = Vector(-30, 5, 0)
-- local offsetdraw = Vector(0, 70, 0)
-- local angoffset = Angle(0, 90, 90)
-- local lastpos = Vector()
-- local lastang = Angle()
-- local endlerp = 0
-- local endlerppos = Vector()
-- local neweye = false
-- local fx = false
local diff = 1
local function IsLanding(ent)
return landseq[ent:GetSequence()] or false
end
local introalpha = 255
local function LandingHUDPaint()
introalpha = introalpha - (FrameTime() * 50)
surface.SetDrawColor(0, 0, 0, introalpha)
surface.DrawRect(0, 0, ScrW(), ScrH())
if introalpha <= 0 then
hook.Remove("HUDPaint", "LandingHUDPaint")
end
end
local function LandingHUDIntro()
introalpha = 255
hook.Add("HUDPaint", "LandingHUDPaint", LandingHUDPaint)
end
local function LandingIntro()
fx = false
neweye = false
endlerp = 0
surface.PlaySound("hopperland.mp3")
LandingHUDIntro()
end
function ENT:Draw()
-- Reset everything to known good
render.SetStencilWriteMask(0xFF)
render.SetStencilTestMask(0xFF)
render.SetStencilReferenceValue(0)
-- render.SetStencilCompareFunction( STENCIL_ALWAYS )
render.SetStencilPassOperation(STENCIL_KEEP)
-- render.SetStencilFailOperation( STENCIL_KEEP )
render.SetStencilZFailOperation(STENCIL_KEEP)
render.ClearStencil()
render.SetStencilEnable(true) -- Enable stencils
render.SetStencilReferenceValue(1) -- Set the reference value to 1. This is what the compare function tests against
render.SetStencilCompareFunction(STENCIL_NEVER) -- Force everything to fail
render.SetStencilFailOperation(STENCIL_REPLACE) -- Save all the things we don't draw
self:DrawModel() -- Fail to draw our entities.
render.SetStencilCompareFunction(STENCIL_EQUAL) -- Render all pixels that don't have their stencil value as 1
render.SetStencilFailOperation(STENCIL_KEEP) -- Don't modify the stencil buffer when things fail
-- for _, ent in pairs( ents.FindByClass( "sent_stencil_test_big" ) ) do
render.PushFilterMag(TEXFILTER.ANISOTROPIC) -- Draw our big entities. They will have holes in them wherever the smaller entities were
render.PushFilterMin(TEXFILTER.ANISOTROPIC)
self:DrawModel()
cam.Start2D(vector_origin, angle_zero)
draw_blur(math.max(blurint * -diff, 0), 5)
-- DrawBokehDOF(5,0.99,8)
render.PopFilterMag()
render.PopFilterMin()
cam.End2D()
-- end
render.SetStencilEnable(false) -- Let everything render normally again
end
local function RabbitCalcView(ply, origin, ang)
local rabbit = ply:GetRabbit()
if IsValid(rabbit) and rabbit:GetCycle() < 1 and IsLanding(rabbit) then
if rabbit:GetCycle() < 1 then
util.ScreenShake(vector_origin, 1, 100, 0.5, 0)
end
local matrix = rabbit:GetBoneMatrix(0)
local pos = matrix:GetTranslation()
local angles = matrix:GetAngles()
local npos, _ = LocalToWorld(offset, angles, pos, angles)
angles:Sub(angoffset)
angles.x = -angles.x
angles.y = angles.y - 90
angles.z = angles.x
local oldangx = ang.x
ang.x = 0
diff = ang:Forward():Dot(angles:Right())
local absdiff = math.abs(diff)
ang.x = oldangx
angles.z = angles.z * absdiff
-- angles.x = angles.x * absdiff
-- angles.x = angles.x*ang:Forward():Dot(ang:Forward())
-- angles.z = angles.z*math.abs(ang:Forward():Dot(ang:Forward()))
pos:Set(npos)
origin:Set(pos)
ang:Add(angles)
lastpos:Set(origin)
lastang:Set(ang)
elseif endlerp < 1 then
if not neweye then
lastang.z = 0
ang:Set(lastang)
ply:SetEyeAngles(lastang)
neweye = true
ply:CLViewPunch(Angle(12, 0, 0))
if VManip then
VManip:PlayAnim("vault")
end
end
origin:Set(LerpVector(endlerp, lastpos, origin))
endlerp = endlerp + (FrameTime() * 4)
endlerppos:Set(origin)
end
end
local function RabbitVM(wep, vm, oldpos, oldang, pos, ang)
local rabbit = LocalPlayer():GetRabbit()
local diffpos = pos - oldpos
local diffang = ang - oldang
if IsValid(rabbit) and rabbit:GetCycle() < 1 and IsLanding(rabbit) then
pos:Set(lastpos)
ang:Set(lastang)
pos:Sub(diffpos)
ang:Sub(diffang)
elseif endlerp < 1 then
pos:Set(endlerppos)
end
end
-- hook.Add("CalcViewModelView", "RabbitVM", RabbitVM)
-- hook.Add("BeatrunDrawHUD", "Rabbit", function()
-- if IsValid(rabbit) and rabbit:GetCycle() < 1 and IsLanding(rabbit) then return false end
-- end)
function ENT:Use(ply, caller, usetype, value)
if not ply:IsPlayer() then return end
print("hi")
ply:SetRabbit(self)
ply:SetRabbitSeat(1)
end
-- hook.Add("CalcViewModelView", "RabbitVM", RabbitVM)
-- hook.Add("CalcView", "RabbitCalcView", RabbitCalcView)
local function RabbitPlayerMove(ply, mv, cmd)
local rabbit = ply:GetRabbit()
if IsValid(rabbit) then
local matrix = rabbit:GetBoneMatrix(0)
local pos = matrix:GetTranslation() - ply:GetViewOffset()
local angles = matrix:GetAngles()
local npos, _ = LocalToWorld(offset, angles, pos, angles)
ply:SetMoveType(MOVETYPE_NOCLIP)
mv:SetOrigin(npos)
end
end
-- hook.Add("SetupMove", "RabbitPlayerMove", RabbitPlayerMove)

View file

@ -1,394 +0,0 @@
SWEP.ViewModel = "models/weapons/c_357.mdl"
SWEP.WorldModel = "models/weapons/w_357.mdl"
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Slot = 1
SWEP.SlotPos = 2
SWEP.DrawAmmo = true
SWEP.DrawCrosshair = true
SWEP.Primary.ClipSize = 6
SWEP.Primary.DefaultClip = 0
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "357"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.UseHands = true
SWEP.Spawnable = false
SWEP.BobScale = 0
SWEP.SwayScale = 0
SWEP.ViewModelFOV = 70
SWEP.PrintName = "357"
SWEP.Author = "datae"
SWEP.Instructions = ""
SWEP.Category = "Beatrun"
SWEP.BulletData = {}
SWEP.Damage = 150
SWEP.Force = 1
SWEP.Distance = 56756
SWEP.ReloadTime = 0
SWEP.VMPos = Vector()
SWEP.VMAng = Angle()
SWEP.VMPosOffset = Vector()
SWEP.VMAngOffset = Angle()
SWEP.VMPosOffset_Lerp = Vector()
SWEP.VMAngOffset_Lerp = Angle()
SWEP.VMLookLerp = Angle()
SWEP.StepBob = 0
SWEP.StepBobLerp = 0
SWEP.StepRandomX = 1
SWEP.StepRandomY = 1
SWEP.LastEyeAng = Angle()
SWEP.SmoothEyeAng = Angle()
SWEP.LastVelocity = Vector()
SWEP.Velocity_Lerp = Vector()
SWEP.VelocityLastDiff = 0
SWEP.Breath_Intensity = 1
SWEP.Breath_Rate = 1
-- SWEP.OffsetPos = Vector(10,-10,0) --NT
SWEP.OffsetPos = Vector(0,0,-2)
SWEP.OffsetAng = Angle()
local coolswayCT = 0
local function LerpC(t, a, b, powa)
return a + (b - a) * math.pow(t, powa)
end
function SWEP:Move_Process(EyePos, EyeAng, velocity)
local VMPos, VMAng = self.VMPos, self.VMAng
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
local VMPosOffset_Lerp, VMAngOffset_Lerp = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
local FT = FrameTime()
local sightedmult = 1
VMPos:Set(vector_origin)
VMAng:Set(angle_zero)
VMPosOffset.x = self:GetOwner():GetVelocity().z * 0.0015 * sightedmult
VMPosOffset.y = math.Clamp(velocity.y * -0.004, -1, 1) * sightedmult
VMPosOffset_Lerp.x = Lerp(8 * FT, VMPosOffset_Lerp.x, VMPosOffset.x)
VMPosOffset_Lerp.y = Lerp(8 * FT, VMPosOffset_Lerp.y, VMPosOffset.y)
VMAngOffset.x = math.Clamp(VMPosOffset.x * 8, -4, 4)
VMAngOffset.y = VMPosOffset.y * 5
VMAngOffset.z = VMPosOffset.y * 0.5 + (VMPosOffset.x * -5)
VMAngOffset_Lerp.x = LerpC(10 * FT, VMAngOffset_Lerp.x, VMAngOffset.x, 0.75)
VMAngOffset_Lerp.y = LerpC(5 * FT, VMAngOffset_Lerp.y, VMAngOffset.y, 0.6)
VMAngOffset_Lerp.z = Lerp(25 * FT, VMAngOffset_Lerp.z, VMAngOffset.z)
VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x)
VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y)
VMAng:Add(VMAngOffset_Lerp)
end
local stepend = math.pi * 4
function SWEP:Step_Process(EyePos, EyeAng, velocity)
local CT = CurTime()
if CT > coolswayCT then
coolswayCT = CT
else
return
end
local VMPos, VMAng = self.VMPos, self.VMAng
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
local VMPosOffset_Lerp, _ = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
velocity = math.min(velocity:Length(), 500)
local delta = math.abs(self.StepBob * 2 / stepend - 1)
local FT = FrameTime()
local FTMult = 300 * FT
local sightedmult = 1
-- local sprintmult = 1
local onground = self:GetOwner():OnGround()
self.StepBob = self.StepBob + (velocity * 0.00015 + (math.pow(delta, 0.01) * 0.03)) * FTMult
if self.StepBob >= stepend then
self.StepBob = 0
self.StepRandomX = math.Rand(1, 1.5)
self.StepRandomY = math.Rand(1, 1.5)
end
if velocity == 0 then
self.StepBob = 0
end
if onground then
VMPosOffset.x = (math.sin(self.StepBob) * velocity * 0.000375 * sightedmult) * self.StepRandomX
VMPosOffset.y = (math.sin(self.StepBob * 0.5) * velocity * 0.0005 * sightedmult) * self.StepRandomY
VMPosOffset.z = math.sin(self.StepBob * 0.75) * velocity * 0.002 * sightedmult
end
VMPosOffset_Lerp.x = Lerp(16 * FT, VMPosOffset_Lerp.x, VMPosOffset.x)
VMPosOffset_Lerp.y = Lerp(4 * FT, VMPosOffset_Lerp.y, VMPosOffset.y)
VMPosOffset_Lerp.z = Lerp(2 * FT, VMPosOffset_Lerp.z, VMPosOffset.z)
VMAngOffset.x = VMPosOffset_Lerp.x * 2
VMAngOffset.y = VMPosOffset_Lerp.y * -7.5
VMAngOffset.z = VMPosOffset_Lerp.y * 5
VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x)
VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y)
VMPos:Add(VMAng:Forward() * VMPosOffset_Lerp.z)
VMAng:Add(VMAngOffset)
end
function SWEP:Breath_Health()
local owner = self:GetOwner()
if not IsValid(owner) then return end
local health = owner:Health()
local maxhealth = owner:GetMaxHealth()
self.Breath_Intensity = math.Clamp(maxhealth / health, 0, 2)
self.Breath_Rate = math.Clamp((maxhealth * 0.5) / health, 1, 1.5)
end
function SWEP:Breath_StateMult()
local owner = self:GetOwner()
if not IsValid(owner) then return end
local sightedmult = 1
self.Breath_Intensity = self.Breath_Intensity * sightedmult
end
function SWEP:Breath_Process(EyePos, EyeAng)
local VMPos, VMAng = self.VMPos, self.VMAng
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
self:Breath_Health()
self:Breath_StateMult()
VMPosOffset.x = (math.sin(CurTime() * 2 * self.Breath_Rate) * 0.1) * self.Breath_Intensity
VMPosOffset.y = (math.sin(CurTime() * 2.5 * self.Breath_Rate) * 0.025) * self.Breath_Intensity
VMAngOffset.x = VMPosOffset.x * 1.5
VMAngOffset.y = VMPosOffset.y * 2
VMPos:Add(VMAng:Up() * VMPosOffset.x)
VMPos:Add(VMAng:Right() * VMPosOffset.y)
VMAng:Add(VMAngOffset)
end
function SWEP:Look_Process(EyePos, EyeAng)
local VMPos, VMAng = self.VMPos, self.VMAng
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
local FT = FrameTime()
local sightedmult = 1
self.SmoothEyeAng = LerpAngle(0.05, self.SmoothEyeAng, EyeAng - self.LastEyeAng)
VMPosOffset.x = -self.SmoothEyeAng.x * -1 * sightedmult
VMPosOffset.y = self.SmoothEyeAng.y * 0.5 * sightedmult
VMAngOffset.x = VMPosOffset.x * 2.5
VMAngOffset.y = VMPosOffset.y * 1.25
VMAngOffset.z = VMPosOffset.y * 2
self.VMLookLerp.y = Lerp(FT * 10, self.VMLookLerp.y, VMAngOffset.y * 1.5 + self.SmoothEyeAng.y)
VMAng.y = VMAng.y - self.VMLookLerp.y
VMPos:Add(VMAng:Up() * VMPosOffset.x)
VMPos:Add(VMAng:Right() * VMPosOffset.y)
VMAng:Add(VMAngOffset)
end
function SWEP:GetVMPosition(EyePos, EyeAng)
return self.VMPos, self.VMAng
end
function SWEP:GetViewModelPosition(eyepos, eyeang)
return self:GetVMPosition(eyepos, eyeang)
end
function SWEP:Deploy()
self:SendWeaponAnim(ACT_VM_DRAW)
self:SetNextPrimaryFire(CurTime() + 0.5)
self:SetHoldType("revolver")
if CLIENT then
self.CLVM = ClientsideModel(self.ViewModel)
self:SetNoDraw(true)
end
end
function SWEP:Holster()
if IsValid(self.CLVM) then
self.CLVM:Remove()
end
return true
end
function SWEP:OnRemove()
if IsValid(self.CLVM) then
self.CLVM:Remove()
end
end
function SWEP:GenerateBullet()
local tbl = self.BulletData
tbl.Attacker = self:GetOwner()
tbl.Damage = self.Damage
tbl.Force = self.Force
tbl.Distance = self.Distance
tbl.Num = 1
tbl.Spread = vector_origin
tbl.Src = self:GetOwner():GetShootPos()
tbl.Dir = self:GetOwner():EyeAngles():Forward()
return tbl
end
function SWEP:MuzzleFlash()
local vPoint = self:GetOwner():EyePos() + self:GetOwner():EyeAngles():Forward() * 10
local ed = EffectData()
ed:SetOrigin(vPoint)
ed:SetScale(1)
ed:SetEntity(self)
end
function SWEP:DryFire()
self:EmitSound("weapons/pistol/pistol_empty.wav")
end
function SWEP:Reload()
if self:Clip1() >= self:GetMaxClip1() or self:GetOwner():GetAmmoCount(self.Primary.Ammo) <= 0 then return end
if self.ReloadTime and CurTime() <= self.ReloadTime then return end
self:DefaultReload(ACT_VM_RELOAD)
local AnimationTime = self:GetOwner():GetViewModel():SequenceDuration()
self.ReloadTime = CurTime() + AnimationTime
self:SetNextPrimaryFire(CurTime() + AnimationTime)
self:SetNextSecondaryFire(CurTime() + AnimationTime)
self:EmitSound("Weapon_357.Reload")
end
function SWEP:Think()
if self.ReloadTime and CurTime() > self.ReloadTime then
self:SendWeaponAnim(ACT_VM_IDLE)
self.ReloadTime = nil
end
end
function SWEP:PostDrawViewModel(vm, wep, ply)
local EyePos, EyeAng = EyePos(), EyeAngles()
local velocity = self:GetOwner():GetVelocity()
velocity = WorldToLocal(velocity, angle_zero, vector_origin, EyeAng)
self:Move_Process(EyePos, EyeAng, velocity)
self:Step_Process(EyePos, EyeAng, velocity)
self:Breath_Process(EyePos, EyeAng)
self:Look_Process(EyePos, EyeAng)
self.LastEyeAng = EyeAng
self.LastEyePos = EyePos
self.LastVelocity = velocity
local offsetpos, _ = LocalToWorld(self.OffsetPos, self.OffsetAng, self.VMPos, self.VMAng)
self.VMPos:Set(offsetpos)
if CLIENT and IsValid(self.CLVM) then
cam.Start3D(vector_origin, angle_zero, self:GetOwner():GetFOV() * 0.8)
cam.IgnoreZ(true)
self.CLVM:SetPos(self.VMPos)
self.CLVM:SetAngles(self.VMAng)
ply:GetHands():SetParent(self.CLVM)
ply:GetHands():SetupBones()
ply:GetHands():DrawModel()
self.CLVM:SetSequence(vm:GetSequence())
self.CLVM:SetCycle(vm:GetCycle())
self.CLVM:SetupBones()
self.CLVM:DrawModel()
cam.IgnoreZ(false)
cam.End3D()
end
end
function SWEP:PreDrawViewModel(vm, wep, ply)
return true
end
-- self:PostDrawViewModel(vm, wep, ply)
hook.Add("PreDrawTranslucentRenderables", "ae", function()
local ply = LocalPlayer()
local activewep = ply:GetActiveWeapon()
if activewep.CLVM then
activewep:PostDrawViewModel(ply:GetViewModel(), activewep, ply)
end
end)
hook.Add("VManipVMEntity", "ae", function()
local ply = LocalPlayer()
local activewep = ply:GetActiveWeapon()
if activewep.CLVM then return activewep.CLVM end
end)
hook.Add("VManipLegsVMEntity", "ae", function()
local ply = LocalPlayer()
local activewep = ply:GetActiveWeapon()
if activewep.CLVM then return activewep.CLVM end
end)
function SWEP:PrimaryAttack()
if self:Clip1() < 1 then
self:DryFire()
self:SetNextPrimaryFire(CurTime() + 1)
return
end
self:SetClip1(self:Clip1() - 1)
self:GetOwner():MuzzleFlash()
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self:SetNextPrimaryFire(CurTime() + 0.65)
self:EmitSound("Weapon_357.Single")
self:FireBullets(self:GenerateBullet())
self:GetOwner():ViewPunch(Angle(-10, 0, 0))
return true
end
function SWEP:SecondaryAttack()
return true
end

View file

@ -1,323 +0,0 @@
SWEP.ViewModel = "models/weapons/c_smg1.mdl"
SWEP.WorldModel = "models/weapons/w_357.mdl"
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Slot = 1
SWEP.SlotPos = 2
SWEP.DrawAmmo = true
SWEP.DrawCrosshair = true
SWEP.Primary.ClipSize = 45
SWEP.Primary.DefaultClip = 45
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "smg1"
SWEP.UseHands = true
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Spawnable = true
SWEP.BobScale = 0
SWEP.SwayScale = 0
SWEP.ViewModelFOV = 70
SWEP.PrintName = "Beatrun SMG?"
SWEP.Author = "datae"
SWEP.Instructions = ""
SWEP.Category = "Beatrun"
SWEP.BulletData = {}
SWEP.Damage = 15
SWEP.Force = 1
SWEP.Distance = 56756
SWEP.ReloadTime = 0
SWEP.VMPos = Vector()
SWEP.VMAng = Angle()
SWEP.VMPosOffset = Vector()
SWEP.VMAngOffset = Angle()
SWEP.VMPosOffset_Lerp = Vector()
SWEP.VMAngOffset_Lerp = Angle()
SWEP.VMLookLerp = Angle()
SWEP.StepBob = 0
SWEP.StepBobLerp = 0
SWEP.StepRandomX = 1
SWEP.StepRandomY = 1
SWEP.LastEyeAng = Angle()
SWEP.SmoothEyeAng = Angle()
SWEP.LastVelocity = Vector()
SWEP.Velocity_Lerp = Vector()
SWEP.VelocityLastDiff = 0
SWEP.Breath_Intensity = 1
SWEP.Breath_Rate = 1
-- SWEP.OffsetPos = Vector(10,-10,0) --NT
SWEP.OffsetPos = Vector(0,0,-2)
SWEP.OffsetAng = Angle()
local coolswayCT = 0
local oldCT = 0
local function LerpC(t, a, b, powa)
return a + (b - a) * math.pow(t, powa)
end
function SWEP:Move_Process(EyePos, EyeAng, velocity)
local VMPos, VMAng = self.VMPos, self.VMAng
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
local VMPosOffset_Lerp, VMAngOffset_Lerp = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
local FT = FrameTime()
local sightedmult = 1
VMPos:Set(EyePos)
VMAng:Set(EyeAng)
VMPosOffset.x = self:GetOwner():GetVelocity().z * 0.0015 * sightedmult
VMPosOffset.y = math.Clamp(velocity.y * -0.004, -1, 1) * sightedmult
VMPosOffset_Lerp.x = Lerp(8 * FT, VMPosOffset_Lerp.x, VMPosOffset.x)
VMPosOffset_Lerp.y = Lerp(8 * FT, VMPosOffset_Lerp.y, VMPosOffset.y)
VMAngOffset.x = math.Clamp(VMPosOffset.x * 8, -4, 4)
VMAngOffset.y = VMPosOffset.y * -1
VMAngOffset.z = VMPosOffset.y * 0.5 + (VMPosOffset.x * -5)
VMAngOffset_Lerp.x = LerpC(10 * FT, VMAngOffset_Lerp.x, VMAngOffset.x, 0.75)
VMAngOffset_Lerp.y = LerpC(5 * FT, VMAngOffset_Lerp.y, VMAngOffset.y, 0.6)
VMAngOffset_Lerp.z = Lerp(25 * FT, VMAngOffset_Lerp.z, VMAngOffset.z)
VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x)
VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y)
VMAng:Add(VMAngOffset_Lerp)
end
local stepend = math.pi * 4
function SWEP:Step_Process(EyePos, EyeAng, velocity)
local CT = CurTime()
if CT > coolswayCT then
coolswayCT = CT
else
return
end
local VMPos, VMAng = self.VMPos, self.VMAng
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
local VMPosOffset_Lerp, _ = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
velocity = math.min(velocity:Length(), 500)
local delta = math.abs(self.StepBob * 2 / stepend - 1)
local FT = FrameTime()
local FTMult = 300 * FT
local sightedmult = 1
-- local sprintmult = 1
local onground = self:GetOwner():OnGround()
self.StepBob = self.StepBob + (velocity * 0.00015 + (math.pow(delta, 0.01) * 0.03)) * FTMult
if self.StepBob >= stepend then
self.StepBob = 0
self.StepRandomX = math.Rand(1, 1.5)
self.StepRandomY = math.Rand(1, 1.5)
end
if velocity == 0 then
self.StepBob = 0
end
if onground then
VMPosOffset.x = (math.sin(self.StepBob) * velocity * 0.000375 * sightedmult) * self.StepRandomX
VMPosOffset.y = (math.sin(self.StepBob * 0.5) * velocity * 0.0005 * sightedmult) * self.StepRandomY
VMPosOffset.z = math.sin(self.StepBob * 0.75) * velocity * 0.002 * sightedmult
end
VMPosOffset_Lerp.x = Lerp(16 * FT, VMPosOffset_Lerp.x, VMPosOffset.x)
VMPosOffset_Lerp.y = Lerp(4 * FT, VMPosOffset_Lerp.y, VMPosOffset.y)
VMPosOffset_Lerp.z = Lerp(2 * FT, VMPosOffset_Lerp.z, VMPosOffset.z)
VMAngOffset.x = VMPosOffset_Lerp.x * 2
VMAngOffset.y = VMPosOffset_Lerp.y * -7.5
VMAngOffset.z = VMPosOffset_Lerp.y * 5
VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x)
VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y)
VMPos:Add(VMAng:Forward() * VMPosOffset_Lerp.z)
VMAng:Add(VMAngOffset)
end
function SWEP:Breath_Health()
local owner = self:GetOwner()
if not IsValid(owner) then return end
local health = owner:Health()
local maxhealth = owner:GetMaxHealth()
self.Breath_Intensity = math.Clamp(maxhealth / health, 0, 2)
self.Breath_Rate = math.Clamp((maxhealth * 0.5) / health, 1, 1.5)
end
function SWEP:Breath_StateMult()
local owner = self:GetOwner()
if not IsValid(owner) then return end
local sightedmult = 1
self.Breath_Intensity = self.Breath_Intensity * sightedmult
end
function SWEP:Breath_Process(EyePos, EyeAng)
local VMPos, VMAng = self.VMPos, self.VMAng
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
self:Breath_Health()
self:Breath_StateMult()
VMPosOffset.x = (math.sin(CurTime() * 2 * self.Breath_Rate) * 0.1) * self.Breath_Intensity
VMPosOffset.y = (math.sin(CurTime() * 2.5 * self.Breath_Rate) * 0.025) * self.Breath_Intensity
VMAngOffset.x = VMPosOffset.x * 1.5
VMAngOffset.y = VMPosOffset.y * 2
VMPos:Add(VMAng:Up() * VMPosOffset.x)
VMPos:Add(VMAng:Right() * VMPosOffset.y)
VMAng:Add(VMAngOffset)
end
function SWEP:Look_Process(EyePos, EyeAng)
local VMPos, VMAng = self.VMPos, self.VMAng
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
local FT = FrameTime()
local sightedmult = 1
self.SmoothEyeAng = LerpAngle(FT * 5, self.SmoothEyeAng, EyeAng - self.LastEyeAng)
VMPosOffset.x = -self.SmoothEyeAng.x * -1 * sightedmult
VMPosOffset.y = self.SmoothEyeAng.y * 0.5 * sightedmult
VMAngOffset.x = VMPosOffset.x * 2.5
VMAngOffset.y = VMPosOffset.y * 1.25
VMAngOffset.z = VMPosOffset.y * 2
self.VMLookLerp.y = Lerp(FT * 10, self.VMLookLerp.y, VMAngOffset.y * 1.5 + self.SmoothEyeAng.y)
VMAng.y = VMAng.y - self.VMLookLerp.y
VMPos:Add(VMAng:Up() * VMPosOffset.x)
VMPos:Add(VMAng:Right() * VMPosOffset.y)
VMAng:Add(VMAngOffset)
end
function SWEP:GetVMPosition(EyePos, EyeAng)
if CurTime() == oldCT then return self.VMPos, self.VMAng end
local velocity = self:GetOwner():GetVelocity()
velocity = WorldToLocal(velocity, angle_zero, vector_origin, EyeAng)
self:Move_Process(EyePos, EyeAng, velocity)
self:Step_Process(EyePos, EyeAng, velocity)
self:Breath_Process(EyePos, EyeAng)
self:Look_Process(EyePos, EyeAng)
self.LastEyeAng = EyeAng
self.LastEyePos = EyePos
self.LastVelocity = velocity
local offsetpos, _ = LocalToWorld(self.OffsetPos, self.OffsetAng, self.VMPos, self.VMAng)
self.VMPos:Set(offsetpos)
-- self.VMAng:Add(offsetang)
oldCT = CurTime()
return self.VMPos, self.VMAng
end
function SWEP:GetViewModelPosition(eyepos, eyeang)
return self:GetVMPosition(eyepos, eyeang)
end
function SWEP:Deploy()
self:SendWeaponAnim(ACT_VM_DRAW)
self:SetNextPrimaryFire(CurTime() + 0.5)
end
function SWEP:GenerateBullet()
local tbl = self.BulletData
tbl.Attacker = self:GetOwner()
tbl.Damage = self.Damage
tbl.Force = self.Force
tbl.Distance = self.Distance
tbl.Num = 1
tbl.Spread = Vector(0.05, 0.05, 0)
tbl.Src = self:GetOwner():GetShootPos()
tbl.Dir = self:GetOwner():EyeAngles():Forward()
return tbl
end
function SWEP:MuzzleFlash()
local vPoint = self:GetOwner():EyePos() + self:GetOwner():EyeAngles():Forward() * 10
local ed = EffectData()
ed:SetOrigin(vPoint)
ed:SetScale(1)
ed:SetEntity(self)
util.Effect("arccw_shelleffect", ed)
end
function SWEP:DryFire()
self:EmitSound("weapons/pistol/pistol_empty.wav")
end
function SWEP:Reload()
if self:Clip1() >= self:GetMaxClip1() or self:GetOwner():GetAmmoCount(self.Primary.Ammo) <= 0 then return end
if self.ReloadTime and CurTime() <= self.ReloadTime then return end
self:DefaultReload(ACT_VM_RELOAD)
local AnimationTime = self:GetOwner():GetViewModel():SequenceDuration()
self.ReloadTime = CurTime() + AnimationTime
self:SetNextPrimaryFire(CurTime() + AnimationTime)
self:SetNextSecondaryFire(CurTime() + AnimationTime)
self:EmitSound("weapons/smg1/smg1_reload.wav")
end
function SWEP:PrimaryAttack()
if self:Clip1() < 1 then
self:DryFire()
self:SetNextPrimaryFire(CurTime() + 0.5)
return
end
self:SetClip1(self:Clip1() - 1)
self:GetOwner():MuzzleFlash()
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self:SetNextPrimaryFire(CurTime() + 0.065)
self:EmitSound("weapons/smg1/smg1_fire1.wav")
self:FireBullets(self:GenerateBullet())
self:GetOwner():ViewPunch(Angle(-0.1, 0, 0))
if IsFirstTimePredicted() then
self:MuzzleFlash()
end
return true
end
function SWEP:SecondaryAttack()
return true
end

View file

@ -1,324 +0,0 @@
SWEP.ViewModel = "models/weapons/v_jinrai_srm_s.mdl"
SWEP.WorldModel = "models/weapons/w_357.mdl"
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Slot = 1
SWEP.SlotPos = 2
SWEP.DrawAmmo = true
SWEP.DrawCrosshair = true
SWEP.Primary.ClipSize = 45
SWEP.Primary.DefaultClip = 45
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "smg1"
SWEP.UseHands = true
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Spawnable = false
SWEP.BobScale = 0
SWEP.SwayScale = 0
SWEP.ViewModelFOV = 70
SWEP.PrintName = "idk"
SWEP.Author = "datae"
SWEP.Instructions = ""
SWEP.Category = "Beatrun"
SWEP.BulletData = {}
SWEP.Damage = 15
SWEP.Force = 1
SWEP.Distance = 56756
SWEP.ReloadTime = 0
SWEP.VMPos = Vector()
SWEP.VMAng = Angle()
SWEP.VMPosOffset = Vector()
SWEP.VMAngOffset = Angle()
SWEP.VMPosOffset_Lerp = Vector()
SWEP.VMAngOffset_Lerp = Angle()
SWEP.VMLookLerp = Angle()
SWEP.StepBob = 0
SWEP.StepBobLerp = 0
SWEP.StepRandomX = 1
SWEP.StepRandomY = 1
SWEP.LastEyeAng = Angle()
SWEP.SmoothEyeAng = Angle()
SWEP.LastVelocity = Vector()
SWEP.Velocity_Lerp = Vector()
SWEP.VelocityLastDiff = 0
SWEP.Breath_Intensity = 1
SWEP.Breath_Rate = 1
SWEP.OffsetPos = Vector(10, -10, 0) --NT
-- SWEP.OffsetPos = Vector(0,0,-2)
SWEP.OffsetAng = Angle()
local coolswayCT = 0
local oldCT = 0
local function LerpC(t, a, b, powa)
return a + (b - a) * math.pow(t, powa)
end
function SWEP:Move_Process(EyePos, EyeAng, velocity)
local VMPos, VMAng = self.VMPos, self.VMAng
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
local VMPosOffset_Lerp, VMAngOffset_Lerp = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
local FT = FrameTime()
local sightedmult = 1
VMPos:Set(EyePos)
VMAng:Set(EyeAng)
VMPosOffset.x = self:GetOwner():GetVelocity().z * 0.0015 * sightedmult
VMPosOffset.y = math.Clamp(velocity.y * -0.004, -1, 1) * sightedmult
VMPosOffset_Lerp.x = Lerp(8 * FT, VMPosOffset_Lerp.x, VMPosOffset.x)
VMPosOffset_Lerp.y = Lerp(8 * FT, VMPosOffset_Lerp.y, VMPosOffset.y)
VMAngOffset.x = math.Clamp(VMPosOffset.x * 8, -4, 4)
VMAngOffset.y = VMPosOffset.y * -1
VMAngOffset.z = VMPosOffset.y * 0.5 + (VMPosOffset.x * -5)
VMAngOffset_Lerp.x = LerpC(10 * FT, VMAngOffset_Lerp.x, VMAngOffset.x, 0.75)
VMAngOffset_Lerp.y = LerpC(5 * FT, VMAngOffset_Lerp.y, VMAngOffset.y, 0.6)
VMAngOffset_Lerp.z = Lerp(25 * FT, VMAngOffset_Lerp.z, VMAngOffset.z)
VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x)
VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y)
VMAng:Add(VMAngOffset_Lerp)
end
local stepend = math.pi * 4
function SWEP:Step_Process(EyePos, EyeAng, velocity)
local CT = CurTime()
if CT > coolswayCT then
coolswayCT = CT
else
return
end
local VMPos, VMAng = self.VMPos, self.VMAng
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
local VMPosOffset_Lerp, _ = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
velocity = math.min(velocity:Length(), 500)
local delta = math.abs(self.StepBob * 2 / stepend - 1)
local FT = FrameTime()
local FTMult = 300 * FT
local sightedmult = 1
-- local sprintmult = 1
local onground = self:GetOwner():OnGround()
self.StepBob = self.StepBob + (velocity * 0.00015 + (math.pow(delta, 0.01) * 0.03)) * FTMult
if self.StepBob >= stepend then
self.StepBob = 0
self.StepRandomX = math.Rand(1, 1.5)
self.StepRandomY = math.Rand(1, 1.5)
end
if velocity == 0 then
self.StepBob = 0
end
if onground then
VMPosOffset.x = (math.sin(self.StepBob) * velocity * 0.000375 * sightedmult) * self.StepRandomX
VMPosOffset.y = (math.sin(self.StepBob * 0.5) * velocity * 0.0005 * sightedmult) * self.StepRandomY
VMPosOffset.z = math.sin(self.StepBob * 0.75) * velocity * 0.002 * sightedmult
end
VMPosOffset_Lerp.x = Lerp(16 * FT, VMPosOffset_Lerp.x, VMPosOffset.x)
VMPosOffset_Lerp.y = Lerp(4 * FT, VMPosOffset_Lerp.y, VMPosOffset.y)
VMPosOffset_Lerp.z = Lerp(2 * FT, VMPosOffset_Lerp.z, VMPosOffset.z)
VMAngOffset.x = VMPosOffset_Lerp.x * 2
VMAngOffset.y = VMPosOffset_Lerp.y * -7.5
VMAngOffset.z = VMPosOffset_Lerp.y * 5
VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x)
VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y)
VMPos:Add(VMAng:Forward() * VMPosOffset_Lerp.z)
VMAng:Add(VMAngOffset)
end
function SWEP:Breath_Health()
local owner = self:GetOwner()
if not IsValid(owner) then return end
local health = owner:Health()
local maxhealth = owner:GetMaxHealth()
self.Breath_Intensity = math.Clamp(maxhealth / health, 0, 2)
self.Breath_Rate = math.Clamp((maxhealth * 0.5) / health, 1, 1.5)
end
function SWEP:Breath_StateMult()
local owner = self:GetOwner()
if not IsValid(owner) then return end
local sightedmult = 1
self.Breath_Intensity = self.Breath_Intensity * sightedmult
end
function SWEP:Breath_Process(EyePos, EyeAng)
local VMPos, VMAng = self.VMPos, self.VMAng
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
self:Breath_Health()
self:Breath_StateMult()
VMPosOffset.x = (math.sin(CurTime() * 2 * self.Breath_Rate) * 0.1) * self.Breath_Intensity
VMPosOffset.y = (math.sin(CurTime() * 2.5 * self.Breath_Rate) * 0.025) * self.Breath_Intensity
VMAngOffset.x = VMPosOffset.x * 1.5
VMAngOffset.y = VMPosOffset.y * 2
VMPos:Add(VMAng:Up() * VMPosOffset.x)
VMPos:Add(VMAng:Right() * VMPosOffset.y)
VMAng:Add(VMAngOffset)
end
function SWEP:Look_Process(EyePos, EyeAng)
local VMPos, VMAng = self.VMPos, self.VMAng
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
local FT = FrameTime()
local sightedmult = 1
self.SmoothEyeAng = LerpAngle(FT * 5, self.SmoothEyeAng, EyeAng - self.LastEyeAng)
VMPosOffset.x = -self.SmoothEyeAng.x * -1 * sightedmult
VMPosOffset.y = self.SmoothEyeAng.y * 0.5 * sightedmult
VMAngOffset.x = VMPosOffset.x * 2.5
VMAngOffset.y = VMPosOffset.y * 1.25
VMAngOffset.z = VMPosOffset.y * 2
self.VMLookLerp.y = Lerp(FT * 10, self.VMLookLerp.y, VMAngOffset.y * 1.5 + self.SmoothEyeAng.y)
VMAng.y = VMAng.y - self.VMLookLerp.y
VMPos:Add(VMAng:Up() * VMPosOffset.x)
VMPos:Add(VMAng:Right() * VMPosOffset.y)
VMAng:Add(VMAngOffset)
end
function SWEP:GetVMPosition(EyePos, EyeAng)
if CurTime() == oldCT then return self.VMPos, self.VMAng end
local velocity = self:GetOwner():GetVelocity()
velocity = WorldToLocal(velocity, angle_zero, vector_origin, EyeAng)
self:Move_Process(EyePos, EyeAng, velocity)
self:Step_Process(EyePos, EyeAng, velocity)
self:Breath_Process(EyePos, EyeAng)
self:Look_Process(EyePos, EyeAng)
self.LastEyeAng = EyeAng
self.LastEyePos = EyePos
self.LastVelocity = velocity
local offsetpos, _ = LocalToWorld(self.OffsetPos, self.OffsetAng, self.VMPos, self.VMAng)
self.VMPos:Set(offsetpos)
-- self.VMAng:Add(offsetang)
oldCT = CurTime()
return self.VMPos, self.VMAng
end
function SWEP:CalcViewModelView(vm, oldeyepos, oldeyeang, eyepos, eyeang)
return self:GetVMPosition(eyepos, eyeang)
end
function SWEP:Deploy()
self:SendWeaponAnim(ACT_VM_DRAW)
self:SetNextPrimaryFire(CurTime() + 0.5)
end
function SWEP:GenerateBullet()
local tbl = self.BulletData
tbl.Attacker = self:GetOwner()
tbl.Damage = self.Damage
tbl.Force = self.Force
tbl.Distance = self.Distance
tbl.Num = 1
tbl.Spread = Vector(0.05, 0.05, 0)
tbl.Src = self:GetOwner():GetShootPos()
tbl.Dir = self:GetOwner():GetEyeTrace().Normal
return tbl
end
function SWEP:MuzzleFlash()
local vPoint = self:GetOwner():EyePos() + self:GetOwner():EyeAngles():Forward() * 10
local ed = EffectData()
ed:SetOrigin(vPoint)
ed:SetScale(1)
ed:SetEntity(self)
util.Effect("arccw_shelleffect", ed)
end
function SWEP:DryFire()
self:EmitSound("weapons/pistol/pistol_empty.wav")
end
function SWEP:Reload()
if self:Clip1() >= self:GetMaxClip1() or self:GetOwner():GetAmmoCount(self.Primary.Ammo) <= 0 then return end
if self.ReloadTime and CurTime() <= self.ReloadTime then return end
self:DefaultReload(ACT_VM_RELOAD)
local AnimationTime = self:GetOwner():GetViewModel():SequenceDuration()
self.ReloadTime = CurTime() + AnimationTime
self:SetNextPrimaryFire(CurTime() + AnimationTime)
self:SetNextSecondaryFire(CurTime() + AnimationTime)
self:EmitSound("weapons/smg1/smg1_reload.wav")
end
function SWEP:PrimaryAttack()
if self:Clip1() < 1 then
self:DryFire()
self:SetNextPrimaryFire(CurTime() + 0.5)
return
end
self:SetClip1(self:Clip1() - 1)
self:GetOwner():MuzzleFlash()
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
self:SetNextPrimaryFire(CurTime() + 0.065)
self:EmitSound("weapons/smg1/smg1_fire1.wav")
self:FireBullets(self:GenerateBullet())
self:GetOwner():ViewPunch(Angle(-0.1, 0, 0))
if IsFirstTimePredicted() then
self:MuzzleFlash()
end
return true
end
function SWEP:SecondaryAttack()
return true
end

View file

@ -12,7 +12,7 @@ SWEP.Instructions = ""
SWEP.BounceWeaponIcon = false
SWEP.DrawWeaponInfoBox = false
SWEP.HoldType = "crossbow"
SWEP.HoldType = "pistol"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true

View file

@ -119,7 +119,7 @@ function AEUI:RemovePanel(panel)
end
end
function AEUI:AddText(panel, str, font, x, y, centered, color)
function AEUI:Text(panel, str, font, x, y, centered, color)
font = font or "AEUIDefault"
x = x or 0
y = y or 0

View file

@ -63,7 +63,7 @@ local function infostring()
return str
end
AEUI:AddText(bminfo, infostring, "AEUIDefault", bminfo.w / 2, bminfo.h / 2 - 20, true)
AEUI:Text(bminfo, infostring, "AEUIDefault", bminfo.w / 2, bminfo.h / 2 - 20, true)
local function BuildModeHUDButton(e)
buildmodeinputs[e.key](true)

View file

@ -45,7 +45,7 @@ function GetCourse(sharecode)
http.Fetch(url, function(body, length, headers, code)
local response = util.JSONToTable(body)
if response.res == 200 then
if response and response.res == 200 then
print("Success! | Length: " .. length .. "\nLoading course...")
local dir = "beatrun/courses/" .. currentMap .. "/"
@ -57,6 +57,10 @@ function GetCourse(sharecode)
LoadCourseRaw(coursedata)
return true
elseif not response then
print("Can't access the database! Please make sure that domain is correct")
return false
else
print("Error! | Response: " .. response.message)

View file

@ -1,59 +0,0 @@
if not util.IsBinaryModuleInstalled("gdiscord") then return end
require("gdiscord")
local image = "default"
local discord_id = "1109438051496775682"
local refresh_time = 60
local discord_start = discord_start or -1
function DiscordUpdate()
local ply = LocalPlayer()
if not ply.GetLevel then return end
local rpc_data = {}
if game.SinglePlayer() then
rpc_data["state"] = "Singleplayer"
else
local ip = game.GetIPAddress()
if ip == "loopback" then
if GetConVar("p2p_enabled"):GetBool() then
rpc_data["state"] = "Peer 2 Peer"
else
rpc_data["state"] = "Local Server"
end
else
rpc_data["state"] = "Dedicated Server"
end
end
rpc_data["partySize"] = player.GetCount()
rpc_data["partyMax"] = game.MaxPlayers()
if game.SinglePlayer() then
rpc_data["partyMax"] = 0
end
local level = ply:GetLevel()
local customname = hook.Run("BeatrunHUDCourse")
local course = customname and customname or Course_Name ~= "" and Course_Name or "Freeplay"
rpc_data["details"] = "Level: " .. level .. " | Map: " .. game.GetMap()
rpc_data["startTimestamp"] = discord_start
rpc_data["largeImageKey"] = image
rpc_data["largeImageText"] = course
DiscordUpdateRPC(rpc_data)
end
hook.Add("Initialize", "UpdateDiscordStatus", function()
timer.Simple(10, function()
discord_start = os.time()
DiscordRPCInitialize(discord_id)
DiscordUpdate()
if timer.Exists("DiscordRPCTimer") then timer.Remove("DiscordRPCTimer") end
timer.Create("DiscordRPCTimer", refresh_time, 0, DiscordUpdate)
end)
end)

View file

@ -56,8 +56,8 @@ hook.Add("RenderScreenspaceEffects", "BeatrunNoclipBW", function()
color = math.Approach(color, 1, RealFrameTime() * 2)
end
if LocalPlayer():Health() < 100 then
tab["$pp_colour_colour"] = math.max(LocalPlayer():Health() / LocalPlayer():GetMaxHealth(), 0)
if ply:Health() < 100 then
tab["$pp_colour_colour"] = math.max(ply:Health() / ply:GetMaxHealth(), 0)
DrawColorModify(tab)
end
end)
@ -131,13 +131,26 @@ local function BeatrunHUD()
surface.SetFont("DebugFixedSmall")
local vtext = VERSIONGLOBAL
local tw, _ = surface.GetTextSize(vtext)
surface.SetTextColor(255, 255, 255, 15)
local version_text = "v" .. VERSIONGLOBAL
local tw, _ = surface.GetTextSize(version_text)
surface.SetTextColor(255, 255, 255, 20)
surface.SetTextPos(scrw - tw, 0)
surface.DrawText(vtext)
surface.DrawText(version_text)
surface.SetFont("BeatrunHUD")
if file.Exists("beatrun/version.txt", "DATA") then
local latest_version = file.Read("beatrun/version.txt", "DATA")
if latest_version ~= VERSIONGLOBAL then
local update_text = "Update available!"
local notlatest_w, _ = surface.GetTextSize(update_text)
surface.SetTextColor(255, 255, 255, 30)
surface.SetTextPos(scrw - notlatest_w, 10)
surface.DrawText(update_text)
surface.SetFont("BeatrunHUD")
end
end
local pl = ply:GetNW2Int("PLoss")
local CT = CurTime()
@ -205,7 +218,7 @@ local function BeatrunHUD()
hidealpha = 0
end
local corner_color_c = string.ToColor(LocalPlayer():GetInfo("Beatrun_HUDCornerColor"))
local corner_color_c = string.ToColor(ply:GetInfo("Beatrun_HUDCornerColor"))
corner_color_c.a = math.Clamp(corner_color_c.a + 50, 0, 255)
corner_color_c.a = dynamic:GetBool() and math.max(150 - hidealpha, 50) or corner_color_c.a
@ -214,10 +227,10 @@ local function BeatrunHUD()
DrawBlurRect(20 + vp.z, scrh * 0.895 + vp.x, SScaleX(bgpadding), SScaleY(85), math.max(255 - hidealpha, 2))
local corner_color = string.ToColor(LocalPlayer():GetInfo("Beatrun_HUDCornerColor"))
local corner_color = string.ToColor(ply:GetInfo("Beatrun_HUDCornerColor"))
corner_color.a = dynamic:GetBool() and math.max(100 - hidealpha, 50) or corner_color.a
local text_color = string.ToColor(LocalPlayer():GetInfo("Beatrun_HUDTextColor"))
local text_color = string.ToColor(ply:GetInfo("Beatrun_HUDTextColor"))
text_color.a = dynamic:GetBool() and math.max(255 - hidealpha, 2) or text_color.a
surface.SetDrawColor(corner_color)
@ -230,16 +243,16 @@ local function BeatrunHUD()
if verificationstats:GetBool() then
surface.SetTextPos(scrw * 0.015 + vp.z, scrh * 0.02 + vp.x)
surface.DrawText("Purist: ")
surface.DrawText(LocalPlayer():GetInfo("Beatrun_PuristMode") == "1" and "true" or "false")
surface.DrawText(ply:GetInfo("Beatrun_PuristMode") == "1" and "true" or "false")
surface.SetTextPos(scrw * 0.015 + vp.z, scrh * 0.04 + vp.x)
surface.DrawText("Purist Wallrun: ")
surface.DrawText(LocalPlayer():GetInfo("Beatrun_PuristWallrun") == "1" and "true" or "false")
surface.DrawText(ply:GetInfo("Beatrun_PuristWallrun") == "1" and "true" or "false")
surface.SetTextPos(scrw * 0.015 + vp.z, scrh * 0.06 + vp.x)
surface.DrawText("Kick Glitch: ")
surface.DrawText(LocalPlayer():GetInfo("Beatrun_OldKickGlitch") == "1" and "Old" or "New")
surface.DrawText(ply:GetInfo("Beatrun_OldKickGlitch") == "1" and "Old" or "New")
end
if tobool(LocalPlayer():GetInfo("Beatrun_PuristMode")) then
if tobool(ply:GetInfo("Beatrun_PuristMode")) then
surface.SetDrawColor(230, 230, 230)
surface.SetMaterial(MELogo)
surface.DrawTexturedRect(scrw * 0.00125 + vp.z, scrh * 0.9 + vp.x + SScaleY(16) * 0.25, SScaleX(16), SScaleY(16))
@ -253,11 +266,11 @@ local function BeatrunHUD()
surface.DrawText(nicktext)
surface.SetDrawColor(25, 25, 25, math.max(255 - hidealpha, 2))
surface.DrawRect(scrw * 0.015 + vp.z, scrh * 0.94 + 1 + vp.x, SScaleX(150), SScaleY(4))
surface.SetDrawColor(string.ToColor(LocalPlayer():GetInfo("Beatrun_HUDTextColor")), math.max(255 - hidealpha, 2))
surface.SetDrawColor(string.ToColor(ply:GetInfo("Beatrun_HUDTextColor")), math.max(255 - hidealpha, 2))
surface.DrawRect(scrw * 0.015 + vp.z, scrh * 0.94 + vp.x, SScaleX(150 * math.min(ply:GetLevelRatio(), 1)), SScaleY(5))
for k, v in pairs(XP_floatingxp) do
local floating_color = string.ToColor(LocalPlayer():GetInfo("Beatrun_HUDFloatingXPColor"))
local floating_color = string.ToColor(ply:GetInfo("Beatrun_HUDFloatingXPColor"))
floating_color.a = math.Clamp(1000 * math.abs(CurTime() - k) / 5 - hidealpha, 0, 255)
surface.SetFont("BeatrunHUD")
@ -271,7 +284,7 @@ local function BeatrunHUD()
end
end
local text_color_c = string.ToColor(LocalPlayer():GetInfo("Beatrun_HUDTextColor"))
local text_color_c = string.ToColor(ply:GetInfo("Beatrun_HUDTextColor"))
text_color_c.a = text_color_c.a - 55
text_color_c.a = dynamic:GetBool() and math.max(200 - hidealpha, 2) or text_color_c.a

View file

@ -1418,11 +1418,8 @@ local function JumpAnim(event, ply)
end
if not wasjumpanim then
if UseOldAnims:GetBool() then
animtable.animmodelstring = "meclimbanim"
else
animtable.animmodelstring = "climbanim"
end
CheckAnims()
StartBodyAnim(animtable)
--print("---- BodyAnim recreated -- " .. engine.TickCount())

View file

@ -25,7 +25,7 @@ local function buildmodebutton()
LocalPlayer():ConCommand("buildmode")
end
AEUI:AddText(coursepanel, language.GetPhrase("beatrun.coursemenu.trials"):format(game.GetMap()), "AEUIVeryLarge", 20, 30)
AEUI:Text(coursepanel, language.GetPhrase("beatrun.coursemenu.trials"):format(game.GetMap()), "AEUIVeryLarge", 20, 30)
local buildmodebutton = AEUI:AddButton(coursepanel, "#beatrun.coursemenu.buildmode", buildmodebutton, "AEUILarge", coursepanel.w - 400, coursepanel.h - 50)
buildmodebutton.greyed = sacheck
@ -67,13 +67,14 @@ function OpenCourseMenu()
local course = util.Decompress(data) or data
if course then
course = util.JSONToTable(course)
local courseentry = AEUI:AddText(courselist, course[5] or "ERROR", "AEUILarge", 10, 40 * #courselist.elements)
local courseid = v:Split(".txt")[1]
local coursetable = util.JSONToTable(course)
local filename = v:Split(".txt")[1]
local courseid = util.CRC(course)
local courseentry = AEUI:Text(courselist, coursetable[5] and coursetable[5] .. " (" .. courseid .. ")" or "ERROR", "AEUILarge", 10, 40 * #courselist.elements)
function courseentry:onclick()
LocalPlayer():EmitSound("buttonclick.wav")
LoadCourse(courseid)
LoadCourse(filename)
end
courseentry.greyed = sacheck

View file

@ -0,0 +1,97 @@
function StartDiscordPresence(arguments)
if not util.IsBinaryModuleInstalled("gdiscord") then return end
require("gdiscord")
local image = "default"
local discord_id = "1109438051496775682"
local refresh_time = 60
local discord_start = discord_start or -1
function DiscordUpdate()
local ply = LocalPlayer()
if not ply.GetLevel then return end
local rpc_data = {}
if game.SinglePlayer() then
rpc_data["state"] = "Singleplayer"
else
local ip = game.GetIPAddress()
if ip == "loopback" then
if GetConVar("p2p_enabled"):GetBool() then
rpc_data["state"] = "Peer 2 Peer"
else
rpc_data["state"] = "Local Server"
end
else
rpc_data["state"] = "Dedicated Server"
end
end
rpc_data["partySize"] = player.GetCount()
rpc_data["partyMax"] = game.MaxPlayers()
if game.SinglePlayer() then
rpc_data["partyMax"] = 0
end
local level = ply:GetLevel()
local customname = hook.Run("BeatrunHUDCourse")
local course = customname and customname or Course_Name ~= "" and Course_Name or "Freeplay"
rpc_data["details"] = "Level: " .. level .. " | Map: " .. game.GetMap()
rpc_data["startTimestamp"] = discord_start
rpc_data["largeImageKey"] = image
rpc_data["largeImageText"] = course
DiscordUpdateRPC(rpc_data)
end
timer.Simple(5, function()
discord_start = os.time()
DiscordRPCInitialize(discord_id)
DiscordUpdate()
if timer.Exists("UpdateDiscordRichPresence") then timer.Remove("UpdateDiscordRichPresence") end
timer.Create("UpdateDiscordRichPresence", refresh_time, 0, DiscordUpdate)
end)
end
function StartSteamPresence(arguments)
if not util.IsBinaryModuleInstalled("steamrichpresencer") then return end
require("steamrichpresencer")
local richtext = ""
local refresh_time = 60
local function SteamUpdate()
local ply = LocalPlayer()
if not ply.GetLevel then return end
local map = game.GetMap()
local level = ply:GetLevel()
local customname = hook.Run("BeatrunHUDCourse")
local course = customname and customname or Course_Name ~= "" and Course_Name or "Freeplay"
local updatedtext = "Beatrun Lv. " .. level .. " (" .. map .. ") | " .. course
if richtext ~= updatedtext then
richtext = updatedtext
steamworks.SetRichPresence("generic", richtext)
end
end
timer.Simple(5, function()
SteamUpdate()
if timer.Exists("UpdateSteamRichPresence") then timer.Remove("UpdateSteamRichPresence") end
timer.Create("UpdateSteamRichPresence", refresh_time, 0, SteamUpdate)
end)
end
hook.Add("OnGamemodeLoaded", "UpdateDiscordStatus", function()
StartDiscordPresence()
StartSteamPresence()
end)

View file

@ -1,26 +0,0 @@
if not util.IsBinaryModuleInstalled("steamrichpresencer") then return end
require("steamrichpresencer")
local richtext = ""
local refresh_time = 60
local function UpdateRichPresence()
local ply = LocalPlayer()
if not ply.GetLevel then return end
local map = game.GetMap()
local level = ply:GetLevel()
local customname = hook.Run("BeatrunHUDCourse")
local course = customname and customname or Course_Name ~= "" and Course_Name or "Freeplay"
local updatedtext = "Beatrun Lv. " .. level .. " (" .. map .. ") | " .. course
if richtext ~= updatedtext then
richtext = updatedtext
steamworks.SetRichPresence("generic", richtext)
end
end
hook.Add("OnGamemodeLoaded", "LoadDLL", function()
UpdateRichPresence()
timer.Create("UpdateSteamRichPresence", refresh_time, 0, UpdateRichPresence)
end)

View file

@ -1,209 +0,0 @@
local rx = 0
local gx = 0
local bx = 0
local ry = 0
local gy = 0
local by = 0
local black = Material("vgui/black")
local ca_r = CreateMaterial("ca_r", "UnlitGeneric", {
["$ignorez"] = 1,
["$basetexture"] = "vgui/black",
["$additive"] = 1,
["$color2"] = "[1 0 0]"
})
local ca_g = CreateMaterial("ca_g", "UnlitGeneric", {
["$ignorez"] = 1,
["$basetexture"] = "vgui/black",
["$additive"] = 1,
["$color2"] = "[0 1 0]"
})
local ca_b = CreateMaterial("ca_b", "UnlitGeneric", {
["$ignorez"] = 1,
["$basetexture"] = "vgui/black",
["$additive"] = 1,
["$color2"] = "[0 0 1]"
})
-- local zoom = Material("vgui/zoom.vtf")
local function CA(rx, gx, bx, ry, gy, by)
render.UpdateScreenEffectTexture()
local screentx = render.GetScreenEffectTexture()
ca_r:SetTexture("$basetexture", screentx)
ca_g:SetTexture("$basetexture", screentx)
ca_b:SetTexture("$basetexture", screentx)
render.SetMaterial(black)
render.DrawScreenQuad()
render.SetMaterial(ca_r)
render.DrawScreenQuadEx(-rx / 2, -ry / 2, ScrW() + rx, ScrH() + ry)
render.SetMaterial(ca_g)
render.DrawScreenQuadEx(-gx / 2, -gy / 2, ScrW() + gx, ScrH() + gy)
render.SetMaterial(ca_b)
render.DrawScreenQuadEx(-bx / 2, -by / 2, ScrW() + bx, ScrH() + by)
end
function RenderCA()
rx = 10
ry = 10
gx = 10 * (GlitchIntensity * 5 or 1)
gy = 10 * (GlitchIntensity * 5 or 1)
bx = 2 * (GlitchIntensity * 5 or 1)
by = 2 * (GlitchIntensity * 5 or 1)
CA(rx, gx, bx, ry, gy, by)
local gi = math.max(1, GlitchIntensity * 4)
DrawMotionBlur(0.25, 0.75 * GlitchIntensity, 0.005)
DrawBloom(0, 0.5, 0.1 * gi, 0.1 * gi, 1, 1, 1, 1, 1)
end
surface.CreateFont("DaisyHUDSmall", {
shadow = true,
blursize = 0,
underline = false,
rotary = false,
strikeout = false,
additive = false,
antialias = false,
extended = false,
scanlines = 2,
font = "x14y24pxHeadUpDaisy",
italic = false,
outline = false,
symbol = false,
weight = 500,
size = ScreenScale(6)
})
local deletiontable = {}
-- local deletiontime = 0
local deletiontypetime = 0
local deletiontype = 0
deletionentry = 0
local garble = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!\"#$%&()*+,-./:;<=>?@[]^_`{|}~"
local garblelen = #garble
local deletionrare = false
local deletionraretbl = {
"...",
"Kc7bUS7z",
"817"
}
local deletioncredits = {
"Beatrun",
" ",
" ",
"Programming",
"| datae",
" ",
" ",
"Various assets & concepts",
"| Mirror's Edge (EA)",
"| Tetris Effect (Resonair)",
"| Dying Light (Techland)",
" ",
" ",
"Credits music",
"| \"Sunrise\" from OneShot",
" ",
" ",
"Special thanks to",
"",
" ",
" ",
" ",
" ",
" ",
"Get the fuck out of the credits this part of the mod isnt finished"
}
incredits = false
local deletionstring = ""
local deletionlen = 0
function DrawDeletionText()
surface.SetFont("DaisyHUDSmall")
local oldgi = GlitchIntensity
if incredits then
GlitchIntensity = math.max(0.15, GlitchIntensity)
end
local deletionstringc = deletionstring:Left(deletiontype)
if deletiontypetime < CurTime() then
deletiontype = deletiontype + 1
deletiontypetime = CurTime() + ((deletionrare or incredits) and 0.125 or 0.025)
end
if deletionlen < deletiontype then
deletionrare = math.random() <= 0.01
if incredits then
deletioncredits[19] = LocalPlayer():SteamID() or "Someone..?"
if deletionentry + 1 > #deletioncredits then
blindpopulatespeed = 150
blindfakepopulate = true
vanishlimit = 100
return
end
deletionstring = deletioncredits[deletionentry + 1]
else
deletionstring = not deletionrare and "Deleting /usr/fragments/mem" .. deletionentry .. ".dat" or deletionraretbl[math.random(#deletionraretbl)]
end
deletionlen = #deletionstring
deletionrare = deletionrare
deletiontype = 0
deletionentry = deletionentry + 1
table.insert(deletiontable, deletionstringc)
if #deletiontable >= 6 then
table.remove(deletiontable, 1)
end
end
local _, th = surface.GetTextSize(deletionstringc)
cam.Start2D()
local num = 0
local ply = LocalPlayer()
local vp = ply:GetViewPunchAngles()
local vpcl = ply.ViewPunchAngle or angle_zero
vp:Add(vpcl)
local GlitchIntensity = incredits and 2 or GlitchIntensity
surface.SetTextColor(255, 255, 255, 2.5 * (num + 1) * GlitchIntensity)
for k, v in ipairs(deletiontable) do
surface.SetTextColor(255, 255, 255, 2.5 * k * GlitchIntensity)
local text = v
for i = 1, 4 do
local index = math.random(1, #text)
if text[index] ~= " " then
text = text:SetChar(index, garble[math.random(1, garblelen)])
end
end
surface.SetTextPos(ScrW() * 0.01 + vp.x, ScrH() * 0.05 + (k - 1) * th + vp.y)
surface.DrawText(text)
num = k
end
if deletiontype > 0 then
surface.SetTextPos(ScrW() * 0.01 + vp.x, ScrH() * 0.05 + num * th + vp.y)
surface.DrawText(deletionstringc)
end
cam.End2D()
GlitchIntensity = oldgi
end

View file

@ -1,288 +0,0 @@
Synesthesia = Synesthesia or {}
local syn = Synesthesia
function syn:Reset()
if IsValid(self.channel) then
if self.channel.Stop then
self.channel:Stop()
end
self.channel = nil
end
self.events = nil
self.curevent = 1
self.length = 0
self.lasttime = 0
self.finished = false
hook.Remove("PreRender", "Synesthesia")
end
function syn:Looped()
self.curevent = 1
self.lasttime = 0
self.finished = false
end
function syn:Finished()
self.finished = true
end
function syn:Play(file, events)
self:Reset()
sound.PlayFile(file, "noblock", function(a)
if IsValid(a) then
timer.Simple(0, function()
a:EnableLooping(true)
end)
self.length = a:GetLength()
self.channel = a
self.events = events
hook.Add("PreRender", "Synesthesia", self.Think)
else
ErrorNoHaltWithStack("Failed to play ", file)
return
end
end)
end
function syn:Stop()
self:Reset()
end
function syn:GetEvents()
return self.events
end
function syn:CurEvent()
return self.curevent
end
function syn:UpEvent()
self.curevent = self.curevent + 1
return self.curevent
end
function syn:GetLength()
return self.length
end
function syn:GetTime()
return self.channel:GetTime()
end
function syn:GetFinished()
return self.finished
end
function syn:Think()
local self = syn
local curtime = self:GetTime()
local curevent = self:GetEvents()[self:CurEvent()]
if not self:GetFinished() and curevent[1] <= curtime then
curevent[2]()
local nextevent = self:UpEvent()
if not self:GetEvents()[nextevent] then
self:Finished()
end
end
if curtime < self.lasttime then
self:Looped()
end
self.lasttime = self:GetTime()
end
local testbuildup = false
local testfovconvar = GetConVar("Beatrun_FOV", 100)
local testfov = 100
local colbeatr = 250
local colbeatg = 120
local colbeatb = 40
local colr = 250
local colg = 120
local colb = 40
local testcurcolor = 1
local testcolor = Color(151, 166, 182)
local function test_beat()
testfov = testfovconvar:GetFloat()
BlindGetColor().r = colbeatr
BlindGetColor().g = colbeatg
BlindGetColor().b = colbeatb
if not testbuildup then
blindrandx = 2
blindrandy = 2
blindrandz = 2
end
vanishrandx = 0
vanishrandy = 0
vanishrandz = 4
vanishusenormal = false
LocalPlayer():SetFOV(testfov - 1)
LocalPlayer():SetFOV(testfov, 1)
end
local function test_beathard()
BlindGetColor().r = colbeatr
BlindGetColor().g = colbeatg
BlindGetColor().b = colbeatb
if not testbuildup then
blindrandx = 2
blindrandy = 2
blindrandz = 2
end
vanishrandx = 0
vanishrandy = 0
vanishrandz = 4
vanishusenormal = false
LocalPlayer():SetFOV(testfov + 2)
LocalPlayer():SetFOV(testfov, 2)
end
local function test_color1()
colbeatb = 200
colbeatg = 200
colbeatr = 240
colb = 185
colg = 160
colr = 150
testcurcolor = 1
end
local function test_color2()
colbeatb = 5
colbeatg = 75
colbeatr = 250
colb = 40
colg = 120
colr = 250
testcurcolor = 2
end
local function test_pullback()
eyedot = 0.52
end
local function test_startbuildup()
blindrandx = 0.5
blindrandy = 0.5
blindrandz = 0.5
testbuildup = true
end
local function test_endbuildup()
testbuildup = false
end
local function test_think()
BlindGetColor().r = math.Approach(BlindGetColor().r, colr, FrameTime() * 100)
BlindGetColor().g = math.Approach(BlindGetColor().g, colg, FrameTime() * 100)
BlindGetColor().b = math.Approach(BlindGetColor().b, colb, FrameTime() * 100)
vanishrandx = math.Approach(vanishrandx, 0.5, FrameTime() * 50)
vanishrandy = math.Approach(vanishrandy, 0.5, FrameTime() * 50)
vanishrandz = math.Approach(vanishrandz, 0.5, FrameTime() * 50)
vanishusenormal = vanishrandx == 0.5
if testcurcolor == 1 then
eyedot = math.Approach(eyedot, 0.6, FrameTime() * 0.15)
else
eyedot = 0.4
end
if testbuildup then
GlitchIntensity = math.Approach(GlitchIntensity, 0.65, FrameTime() * 0.1)
blindrandx = math.Approach(blindrandx, 1.5, FrameTime() * 0.1)
blindrandy = math.Approach(blindrandy, 1.5, FrameTime() * 0.1)
blindrandz = math.Approach(blindrandz, 1.5, FrameTime() * 0.1)
else
GlitchIntensity = math.Approach(GlitchIntensity, 0.1, FrameTime() * 4)
blindrandx = math.Approach(blindrandx, 0.5, FrameTime() * 10)
blindrandy = math.Approach(blindrandy, 0.5, FrameTime() * 10)
blindrandz = math.Approach(blindrandz, 0.5, FrameTime() * 10)
end
end
local testevents = {
{0, test_color1},
{0, test_endbuildup},
{0, test_beat},
{0.75, test_pullback},
{1.1, test_pullback},
{1.9, test_pullback},
{3.25, test_beat},
{6.75, test_beat},
{7.6, test_pullback},
{8, test_pullback},
{8.85, test_pullback},
{9, test_pullback},
{9.02, test_pullback},
{10.25, test_beat},
{13.675, test_beat},
{14.5, test_pullback},
{15, test_pullback},
{15, test_startbuildup},
{15.8, test_pullback},
{15.9, test_pullback},
{16, test_pullback},
{17.065, test_beat},
{20.5, test_beat},
{21.3, test_pullback},
{21.7, test_pullback},
{22.5, test_pullback},
{22.8, test_pullback},
{22.82, test_pullback},
{24, test_beat},
{27.375, test_beathard},
{27.375, test_color2},
{30.75, test_beat},
{34.25, test_beathard},
{37.65, test_beat},
{41, test_endbuildup},
{41.1, test_beat},
{44, test_startbuildup},
{44.5, test_beat},
{48, test_beathard},
{51.4, test_beat},
{54.8, test_beat},
{54.8, test_endbuildup},
{58.25, test_beat},
{59, test_startbuildup},
{61.65, test_beathard},
{65, test_beat}
}
function test_syn(a)
if a then
customglitch = true
BlindSetColor(testcolor)
Synesthesia:Play("sound/music/shard/puzzle_012.ogg", testevents)
hook.Add("PreRender", "test_think", test_think)
else
Synesthesia:Stop()
hook.Remove("PreRender", "test_think")
end
end
hook.Add("Blind", "syntest", test_syn)

View file

@ -1,714 +0,0 @@
local function push_right(self, x)
assert(x ~= nil)
self.tail = self.tail + 1
self[self.tail] = x
end
local function push_left(self, x)
assert(x ~= nil)
self[self.head] = x
self.head = self.head - 1
end
local function pop_right(self)
if self:is_empty() then return nil end
local r = self[self.tail]
self[self.tail] = nil
self.tail = self.tail - 1
return r
end
local function pop_left(self)
if self:is_empty() then return nil end
local r = self[self.head + 1]
self.head = self.head + 1
local r = self[self.head]
self[self.head] = nil
return r
end
local function length(self)
return self.tail - self.head
end
local function is_empty(self)
return self:length() == 0
end
local function iter_left(self)
local i = self.head
return function()
if i < self.tail then
i = i + 1
return self[i]
end
end
end
local function iter_right(self)
local i = self.tail + 1
return function()
if i > self.head + 1 then
i = i - 1
return self[i]
end
end
end
local function contents(self)
local r = {}
for i = self.head + 1, self.tail do
r[i - self.head] = self[i]
end
return r
end
local methods = {
push_right = push_right,
push_left = push_left,
peek_right = peek_right,
peek_left = peek_left,
pop_right = pop_right,
pop_left = pop_left,
rotate_right = rotate_right,
rotate_left = rotate_left,
remove_right = remove_right,
remove_left = remove_left,
iter_right = iter_right,
iter_left = iter_left,
length = length,
is_empty = is_empty,
contents = contents
}
local function new()
local r = {
head = 0,
tail = 0
}
return setmetatable(r, {
__index = methods
})
end
local vecmeta = FindMetaTable("Vector")
function vecmeta:LerpTemp(t, start, endpos)
local xs, ys, zs = start:Unpack()
local xe, ye, ze = endpos:Unpack()
self:SetUnpacked(LerpL(t, xs, xe), LerpL(t, ys, ye), LerpL(t, zs, ze))
end
hitpoints = new()
hitcolor = new()
hitnormal = new()
soundpoints = new()
GlitchIntensity = 0
local tr = {}
local tr_result = {}
local randvector = Vector()
-- local box_mins = Vector(-0.5, -0.5, -0.5)
-- local box_maxs = Vector(0.5, 0.5, 0.5)
local awareness = CreateClientConVar("blindness_awareness", 10000, true, false, "Awareness in hu")
local quality = CreateClientConVar("blindness_highquality", 1, true, false, "Draws quads instead of lines", 0, 1)
-- local boxang = Angle()
-- local vanishvec = Vector()
-- local vanishvecrand = Vector()
vanishrandx = 0.5
vanishrandy = 0.5
vanishrandz = 0.5
blindrandx = 0.5
blindrandy = 0.5
blindrandz = 0.5
blindrandobeyglitch = true
vanishlimit = 50
vanishusenormal = true
eyedot = 0.4
local red = Color(255, 0, 0)
local blue = Color(0, 0, 255)
local white = Color(210, 159, 110, 255)
local green = Color(0, 255, 0)
local circle = Material("circle.png", "nocull")
whiteg = white
customcolors = {
Color(210, 159, 110, 255),
Color(203, 145, 65, 255),
Color(205, 205, 220, 255),
Color(150, 50, 150, 255),
Color(250, 20, 80, 255),
Color(250, 120, 40, 255),
Color(250, 20, 40, 255),
Color(10, 255, 20, 255)
}
local forcelines = false
function BlindSetColor(newcol)
white = newcol
end
function BlindGetColor()
return white
end
local grass = Color(20, 150, 10)
local sand = Color(76, 70, 50)
local glass = Color(10, 20, 150)
local limit = 5400
-- local pinged = false
local camvector = Vector()
local camang = Angle()
local camlerp = 0
local lerp, sound, bgm = nil
blindcolor = {0, 0, 0}
local colors = {
[MAT_DEFAULT] = blue,
[MAT_GLASS] = glass,
[MAT_SAND] = sand,
[MAT_DIRT] = sand,
[MAT_GRASS] = grass,
[MAT_FLESH] = red
}
local colorslist = {green, grass, sand, glass}
blindrandrendermin = 0.9
blindinverted = false
blindpopulate = false
blindpopulatespeed = 1000
blindfakepopulate = false
customglitch = false
blindcustomlerp = 0
blindcustompoints = {Vector()}
local blindcustompoints = blindcustompoints
-- local sizemult = 1
function InvertColors()
for k, v in ipairs(colorslist) do
v.r = 255 - v.r
v.g = 255 - v.g
v.b = 255 - v.b
end
blindinverted = not blindinverted
if blindinverted then
white.r = 0
white.g = 0
white.b = 0
sizemult = 4
blindcolor[1] = 61
blindcolor[2] = 61
blindcolor[3] = 61
blindrandrendermin = 1
else
white.r = 210
white.g = 159
white.b = 110
blindcolor[1] = 0
blindcolor[2] = 0
blindcolor[3] = 0
blindrandrendermin = 0.9
end
end
function TogglePopulate()
blindfakepopulate = not blindfakepopulate
end
local colorsclass = {
prop_door_rotating = green,
func_door_rotating = green,
func_door = green
}
local blindedsounds = {
["bad.wav"] = true,
["music/locloop_unk.wav"] = true,
["lidar/burst1.wav"] = true,
["glitch.wav"] = true,
["A_TT_CD_02.wav"] = true,
["good.wav"] = true,
["reset.wav"] = true,
["ping.wav"] = true,
["music/locloop.wav"] = true,
["lidar/burst2.wav"] = true,
["reset2.wav"] = true,
["A_TT_CD_01.wav"] = true,
["lidar/scan.wav"] = true,
["lidar/burst4.wav"] = true,
["lidar/burst3.wav"] = true,
["lidar/scanstop.wav"] = true
}
local trw = {
collisiongroup = COLLISION_GROUP_WORLD
}
local trwr = {}
local function IsInWorld(pos)
trw.start = pos
trw.endpos = pos
trw.output = trwr
util.TraceLine(trw)
return trwr.HitWorld
end
local function RandomizeCam(eyepos, eyeang)
local ctsin = 1 / (LocalPlayer():GetEyeTrace().Fraction * 200)
if IsInWorld(eyepos) then
ctsin = 100
end
lerp = Lerp(25 * FrameTime(), camlerp, ctsin)
camvector.x = eyepos.x + lerp
camvector.y = eyepos.y + lerp
camvector.z = eyepos.z + lerp
camang.p = eyeang.p
camang.y = eyeang.y
camang.r = eyeang.r
end
local function populatetrace(eyepos)
local af = awareness:GetFloat() or 1000
randvector.x = eyepos.x + math.random(-af, af)
randvector.y = eyepos.y + math.random(-af, af)
randvector.z = eyepos.z + math.random(-af * 0.5, af)
tr.start = eyepos
tr.endpos = randvector
tr.output = tr_result
if not IsValid(tr.filter) then
tr.filter = LocalPlayer()
end
util.TraceLine(tr)
return tr_result
end
local function Echo(t)
table.insert(soundpoints, t.Pos)
if not blindedsounds[t.SoundName] and t.SoundName:Left(3) ~= "te/" then return false end
end
local function PopThatMotherfucker()
hitpoints:pop_left()
hitcolor:pop_left()
hitnormal:pop_left()
end
local blindcolor = blindcolor
local fakepopulatevec = Vector(1, 2, 3)
LOCEntities = LOCEntities or {}
meshtbl = meshtbl or new()
local meshtbl = meshtbl
pausescan = false
--[[
local function OptimizeMeshes()
local i = 0
-- local vertexcount = 0
for v in meshtbl:iter_left() do
if i >= 90 then break end
v:Destroy()
i = i + 1
end
end
]]
glob_blindangles = Angle()
glob_blindorigin = Vector()
curmesh = Mesh()
local lastpointcount = 0
local nextcachecheck = 0
local function Blindness(origin, angles)
local ply = LocalPlayer()
local eyepos = origin
local eyeang = angles
local FT = FrameTime()
local quality = quality:GetBool()
glob_blindorigin:Set(origin)
glob_blindangles:Set(angles)
local hitpointscount = nil
-- local vel_l = ply:GetVelocity():Length()
-- local vel = 2.5
cang = math.pi * 2 / 16 + (ply.offset or 0)
cpos = Vector(0, math.cos(cang) * 75, math.sin(cang) * 250)
ply.offset = (ply.offset or 0) + FrameTime()
if ply.offset >= 180 then
ply.offset = 0
end
local randrender = math.Rand(blindrandrendermin, 1)
render.Clear(blindcolor[1] * randrender, blindcolor[2] * randrender, blindcolor[3] * randrender, 0)
render.ClearDepth()
render.ClearStencil()
if blindpopulate then
for i = 0, FT * blindpopulatespeed do
if not blindfakepopulate then
local trace = populatetrace(blindorigin or eyepos)
if trace.Hit then
hitpoints:push_right(trace.HitPos)
local invert = math.random()
if invert < 0.05 then
trace.HitNormal:Mul(-1)
end
hitnormal:push_right(trace.HitNormal)
local hcol = colors[trace.MatType]
local hcolclass = colorsclass[trace.Entity:GetClass()]
hitcolor:push_right(hcol or hcolclass or white)
if limit < hitpoints:length() then
PopThatMotherfucker()
end
end
else
hitpoints:push_right(fakepopulatevec)
hitnormal:push_right(fakepopulatevec)
hitcolor:push_right(white)
if limit < hitpoints:length() then
PopThatMotherfucker()
end
end
end
end
hitpointscount = soundpoints:length()
while limit < hitpointscount do
soundpoints:pop_left()
hitpointscount = soundpoints:length()
end
RandomizeCam(eyepos, eyeang)
if sound then
sound:ChangeVolume((lerp - 0.1) * 0.25)
end
cam.Start3D(camvector, camang)
for k, v in pairs(LOCEntities) do
if not IsValid(k) then
LOCEntities[k] = nil
else
k:DrawLOC()
end
end
local f = eyeang:Forward()
local eyediff = Vector()
local k = limit
local k2 = 0
-- local lastpos = hitpoints[hitpoints.tail]
-- local vanishlimit = vanishlimit
-- local vanishrandx = vanishrandx
-- local vanishrandy = vanishrandy
-- local vanishrandz = vanishrandz
-- local blindrandx = blindrandx
-- local blindrandy = blindrandy
-- local blindrandz = blindrandz
-- local blindrandobeyglitch = blindrandobeyglitch
render.SetMaterial(circle)
if not customglitch then
GlitchIntensity = lerp
end
LocalPlayer().offset = (LocalPlayer().offset or 0) + FrameTime() * 2
if LocalPlayer().offset >= 180 then
LocalPlayer().offset = 0
end
local ed = eyedot
local anggg = ply:EyeAngles()
anggg.x = 0
local eyep = ply:EyePos() + anggg:Forward() * 200
local hitindex = 1
local drawcount = #blindcustompoints
local drawiters = 0
local lerpt = blindcustomlerp
if not pausescan then
if not curmesh:IsValid() or CurTime() < nextcachecheck then
-- local dynmesh = nil
if CurTime() < nextcachecheck then
if curmesh:IsValid() then
curmesh:Destroy()
end
dynmesh = mesh.Begin(MATERIAL_QUADS, limit)
else
curmesh = Mesh()
dynmesh = mesh.Begin(curmesh, MATERIAL_QUADS, limit)
end
for v in hitpoints:iter_right() do
local col = hitcolor[hitcolor.tail - k2] or BlindGetColor()
eyediff:Set(v)
local drawindex = hitindex % drawcount + 1
if drawindex == 1 then
drawiters = drawiters + 1
end
eyep = blindcustompoints[drawindex] + Vector(math.random() * 2, math.random() * 2, math.random() * 2)
if drawiters < 2 then
eyediff:LerpTemp(lerpt, eyediff, eyep)
end
eyediff:Sub(eyepos)
if ed < f:Dot(eyediff) / eyediff:Length() then
eyediff:Set(v)
if v ~= fakepopulatevec then
if quality and not forcelines then
mesh.QuadEasy(eyediff, hitnormal[hitnormal.tail - k2], 2, 2, col)
else
render.DrawLine(eyediff, v, col)
end
end
lastpos = v
end
k = k - 1
k2 = k2 + 1
hitindex = hitindex + 1
end
mesh.End()
if curmesh:IsValid() then
curmesh:Draw()
end
else
curmesh:Draw()
end
if lastpointcount ~= hitpoints:length() then
nextcachecheck = CurTime() + 0.1
end
lastpointcount = hitpoints:length()
end
for v in meshtbl:iter_left() do
v:Draw()
end
hook.Run("Blind3D", origin, angles)
cam.End3D()
hook.Run("Blind3DPost", origin, angles)
-- local ctsin = math.sin(CurTime())
local col = white
col.a = alpha
hook.Run("RenderScreenspaceEffects")
local AEUIDraw = hook.GetTable().HUDPaint.AEUIDraw
if AEUIDraw then
cam.Start2D()
AEUIDraw()
cam.End2D()
end
return true
end
blinded = false
local function BlindnessPreUI()
if blinded then
cam.Start3D()
render.Clear(10, 10, 10, 0)
cam.End3D()
draw.NoTexture()
end
end
--[[
local te = "te/metamorphosis/"
local jingles = {
land = te .. "3-linedrop",
jump = te .. "1-linemove",
jumpwallrun = te .. "3-spin",
wallrunh = te .. "3-spin",
wallrunv = te .. "3-spin",
coil = te .. "3-spin"
}
local jinglescount = {
jump = 6,
wallrunh = 6,
jumpwallrun = 6,
wallrunv = 6,
land = 11,
coil = 6
}
local function BlindnessJingles(event)
if jingles[event] then
LocalPlayer():EmitSound(jingles[event] .. math.random(1, jinglescount[event]) .. ".wav")
end
end
]]
function ToggleBlindness(toggle)
blinded = toggle
if blinded then
local ply = LocalPlayer()
local activewep = ply:GetActiveWeapon()
if ply:UsingRH() and activewep.RunWind1 then
activewep.RunWind1:Stop()
activewep.RunWind2:Stop()
end
gui.HideGameUI()
hook.Add("EntityEmitSound", "Echo", Echo)
hook.Add("RenderScene", "Blindness", Blindness)
hook.Add("PreDrawHUD", "Blindness", BlindnessPreUI)
hook.Add("RenderScreenspaceEffects", "CA", RenderCA)
local milestone = ply:GetLevel() >= 100
local bgmstring = milestone and "music/locloop.wav" or "music/locloop_unk.wav"
forcelines = not milestone
BlindSetColor(milestone and customcolors[1] or customcolors[3])
if not sound then
sound = CreateSound(LocalPlayer(), "glitch.wav")
end
if not bgm then
bgm = CreateSound(LocalPlayer(), bgmstring)
end
sound:PlayEx(0, 100)
if incredits then
EmitSound("music/Sunrise.mp3", vector_origin, -2, 0, 1, 75, SND_SHOULDPAUSE)
end
hook.Run("Blind", true)
else
hook.Remove("EntityEmitSound", "Echo")
hook.Remove("RenderScene", "Blindness")
hook.Remove("PreDrawHUD", "Blindness")
hook.Remove("RenderScreenspaceEffects", "CA")
surface.SetAlphaMultiplier(1)
if sound then
sound:Stop()
end
if bgm then
bgm:Stop()
bgm = nil
end
hook.Run("Blind", false)
end
end
function cool()
local k = limit
local k2 = 0
a = Mesh(circle)
mesh.Begin(a, MATERIAL_QUADS, limit)
-- local ed = Vector()
-- local meshlen = meshtbl:length()
for v in hitpoints:iter_right() do
mesh.QuadEasy(v, hitnormal[hitnormal.tail - k2], 2, 2, hitcolor[hitcolor.tail - k2] or white)
k = k - 1
k2 = k2 + 1
end
mesh.End()
meshtbl:push_right(a)
if meshtbl:length() > 160 then
meshtbl:pop_left():Destroy()
end
end
net.Receive("BlindPlayers", function()
ToggleBlindness(net.ReadBool())
end)
net.Receive("BlindNPCKilled", function()
LocalPlayer():EmitSound("bad.wav", 50, 100 + math.random(-5, 2))
end)
hook.Add("OnEntityCreated", "BlindnessEntities", function(ent)
timer.Simple(0.5, function()
if IsValid(ent) and ent.DrawLOC then
LOCEntities[ent] = true
end
end)
end)
hook.Add("InitPostEntity", "Beatrun_LOC", function()
if GetGlobalBool("LOC") then
ToggleBlindness(true)
end
hook.Remove("EntityEmitSound", "zzz_TFA_EntityEmitSound")
hook.Remove("InitPostEntity", "Beatrun_LOC")
end)

View file

@ -4,3 +4,21 @@ include("shared.lua")
for _, v in ipairs(file.Find("gamemodes/beatrun/gamemode/cl/*.lua", "GAME")) do
include("cl/" .. v)
end
http.Fetch("https://raw.githubusercontent.com/JonnyBro/beatrun/main/version.txt", function(body, size, headers, code)
if code == 200 then
if not file.Exists("beatrun/version.txt", "DATA") then
file.Write("beatrun/version.txt", body)
end
if body ~= VERSIONGLOBAL then
file.Write("beatrun/version.txt", body)
else
print("Latest version already")
end
else
print("Error while checking version:\n" .. body)
end
end, function(e)
print("Error while checking version:\n" .. e)
end)

View file

@ -593,7 +593,7 @@ if SERVER then
game.CleanUpMap()
local a = util.Decompress(data) or data
local crc = util.CRC(a)
local id = util.CRC(a)
local data = util.JSONToTable(a)
local props = data[1]
@ -664,7 +664,7 @@ if SERVER then
Course_StartAng = ang
Course_Name = name
Course_ID = crc
Course_ID = id
Course_Sync()
@ -942,7 +942,7 @@ if CLIENT then
function SaveCourse(name, compress)
local save = CourseData(name)
local jsonsave = util.TableToJSON(save)
local crc = util.CRC(jsonsave)
local id = util.CRC(jsonsave)
local dir = "beatrun/courses/" .. game.GetMap() .. "/"
if compress == nil then compress = true end
@ -950,12 +950,12 @@ if CLIENT then
file.CreateDir(dir)
if compress then
file.Write(dir .. crc .. ".txt", util.Compress(jsonsave))
file.Write(dir .. id .. ".txt", util.Compress(jsonsave))
else
file.Write(dir .. crc .. ".txt", jsonsave)
file.Write(dir .. id .. ".txt", jsonsave)
end
print("Save created: " .. crc .. ".txt")
print("Save created: " .. id .. ".txt")
end
concommand.Add("Beatrun_SaveCourse", function(ply, cmd, args, argstr)

View file

@ -3,6 +3,9 @@ if SERVER then
util.AddNetworkString("DataTheft_Sync")
function Beatrun_StartDataTheft()
if GetGlobalBool("GM_DATATHEFT") then return end
if Course_Name ~= "" then return end
SetGlobalBool("GM_DATATHEFT", true)
net.Start("DataTheft_Start")

View file

@ -9,7 +9,7 @@ if SERVER then
local wepIndex = math.random(#allWep)
local wep = allWep[wepIndex]
if wep.Base == "mg_base" then
if wep.Base == "mg_base" and not wep.AdminOnly then
return wep
else
return getRandomMGBaseWeapon()
@ -17,6 +17,9 @@ if SERVER then
end
function Beatrun_StartDeathmatch()
if GetGlobalBool("GM_DEATHMATCH") then return end
if Course_Name ~= "" then return end
SetGlobalBool("GM_DEATHMATCH", true)
net.Start("Deathmatch_Start")
@ -78,7 +81,7 @@ if SERVER then
if GetGlobalBool("GM_DEATHMATCH") then
local plyKills = ply:GetNW2Int("DeathmatchKills", 0)
if ply == attacker and plyKills ~= 0 then
if ply == attacker and plyKills > 0 then
ply:SetNW2Int("DeathmatchKills", plyKills - 1)
elseif IsValid(attacker) and attacker ~= ply then
local kills = attacker:GetNW2Int("DeathmatchKills", 0)

View file

@ -1,231 +0,0 @@
if SERVER then
util.AddNetworkString("ReplaySendToClient")
end
function ReplayCmd(ply, cmd)
if not ply.ReplayRecording then return end
if cmd:TickCount() == 0 then return end
if not ply.ReplayFirstTick and cmd:TickCount() ~= 0 then
ply.ReplayFirstTick = cmd:TickCount()
end
local ang = cmd:GetViewAngles()
local curtick = cmd:TickCount() - ply.ReplayFirstTick + 1
--print(ang)
ply.ReplayTicks[curtick] = {cmd:GetButtons(), ang.x, ang.y, cmd:GetForwardMove(), cmd:GetSideMove()}
if curtick > 23760 then
ErrorNoHalt("Replay recording stopped (too long). Your course might be too long.")
ply.ReplayRecording = false
end
end
hook.Add("StartCommand", "ReplayStart", ReplayCmd)
function ReplayStart(ply)
--if not game.SinglePlayer() then return end
if ply.InReplay then return end
print("Starting Replay")
ply.ReplayRecording = true
ply.ReplayTicks = {}
ply.ReplayFirstTick = false
ply.ReplayStartPos = ply:GetPos()
ply.ReplayLastAng = nil
end
function ReplayStop(ply, dontsave)
--if not game.SinglePlayer() then return end
if not ply.ReplayTicks then return end
if ply.InReplay then return end
if dontsave then
print("Replay Ended - NOT SAVED")
return
end
print("Ending Replay (" .. #ply.ReplayTicks .. "ticks)")
ply.InReplay = false
ply.ReplayRecording = false
local debugdata = {ply.ReplayStartPos, ply.ReplayTicks, engine.TickInterval()}
local replay = util.Compress(util.TableToJSON(debugdata))
local dir = "beatrun/replays/" .. game.GetMap() .. "/" .. Course_Name .. "/"
file.CreateDir(dir)
file.Write(dir .. os.date("%H-%M-%S_%d-%m-%Y", os.time()) .. ".txt", replay)
print("Replay saved as "..dir .. os.date("%H-%M-%S_%d-%m-%Y", os.time()) .. ".txt")
end
local RFF = true
function ReplayPlayback(ply, cmd)
if not ply.InReplay or not ply.ReplayTicks then return end
local cmdtc = cmd:TickCount()
if cmdtc == 0 then return end
if not ply.ReplayFirstTick then
ply.ReplayFirstTick = cmdtc
if SERVER then
ply:SetNWInt("ReplayFirstTick", cmdtc)
end
end
local firsttick = ply:GetNWInt("ReplayFirstTick")
if ply.ReplayTicks[cmdtc - firsttick + 1] then
tickcount = cmdtc - firsttick + 1
if ply.ReplayEndAtTick and ply.ReplayEndAtTick <= tickcount then
ply.ReplayTicks = {}
return
end
local tickdata = ply.ReplayTicks[tickcount]
local ang = shortdata and 0 or Angle(tickdata[2], tickdata[3], cmd:GetViewAngles().z)
if not shortdata then
ply.ReplayLastAng = ang
end
cmd:SetButtons(tickdata[1])
cmd:SetViewAngles(ply.ReplayLastAng)
cmd:SetForwardMove(tickdata[4])
cmd:SetSideMove(tickdata[5])
cmd:RemoveKey(IN_RELOAD)
elseif SERVER and cmdtc - firsttick + 1 > 0 or CLIENT and not ply:GetNWBool("InReplay") and RFF < CurTime() then
print("Replay cancelled: nil tick at " .. cmdtc - firsttick + 1, firsttick)
if SERVER then
ply:SetNWBool("InReplay", false)
end
hook.Remove("StartCommand", "ReplayPlay")
hook.Remove("RenderScreenspaceEffects", "BeatrunReplayVision")
hook.Remove("HUDPaint", "BeatrunReplayHUD")
ply.InReplay = false
ply.ReplayFirstTick = false
if TUTORIALMODE then
net.Start("ReplayTutorialPos")
net.WriteVector(ply.ReplayStartPos)
net.SendToServer()
TutorialClearEvents()
end
end
end
function ReplaySendToClient(ply, args)
--if not game.SinglePlayer() then return end
ply.InReplay = true
ply:Spawn()
local replaydata = util.JSONToTable(util.Decompress(file.Read("beatrun/replays/" .. game.GetMap() .. "/"..Course_Name.."/"..args..".txt", "DATA")))
ply.ReplayFirstTick = false
ply.ReplayStartPos = replaydata[1]
ply.ReplayTicks = replaydata[2]
ply:SetNWBool("InReplay", true)
local compressedreplay = util.Compress(util.TableToJSON(replaydata))
if replaydata[3] != engine.TickInterval() then
errorstring = "Replay tickrate and current tickrate does not match. Replay tick interval is: " .. (replaydata[3]) .. " " .. engine.TickInterval()
print(errorstring)
end
net.Start("ReplaySendToClient")
net.WriteData(compressedreplay, #compressedreplay)
net.Send(ply)
ply:SetPos(ply.ReplayStartPos)
ply:SetVelocity(vector_origin)
hook.Add("StartCommand", "ReplayPlay", ReplayPlayback)
end
if CLIENT then
local tab = {
["$pp_colour_contrast"] = 0.9,
["$pp_colour_addg"] = 0.5799,
["$pp_colour_addb"] = 1.12,
["$pp_colour_addr"] = 0,
["$pp_colour_colour"] = 0.14,
["$pp_colour_brightness"] = -0.57,
["$pp_colour_mulg"] = 0,
["$pp_colour_mulb"] = 0,
["$pp_colour_mulr"] = 0
}
local function BeatrunReplayVision()
if LocalPlayer().ReplayFirstTick then
DrawColorModify(tab)
end
end
local rcol = Color(200, 200, 200)
local function BeatrunReplayHUD()
if LocalPlayer().ReplayTicks and not LocalPlayer().ReplayTicks.reliable then
surface.SetFont("BeatrunHUD")
surface.SetTextColor(rcol)
surface.SetTextPos(5, ScrH() * 0.975)
local text = TUTORIALMODE and "" or "*Clientside replay: may not be accurate "
surface.DrawText(text .. tickcount .. "/" .. #LocalPlayer().ReplayTicks)
end
end
function ReplayBegin()
LocalPlayer().InReplay = true
RFF = CurTime() + 1
hook.Add("StartCommand", "ReplayPlay", ReplayPlayback)
--hook.Add("RenderScreenspaceEffects", "BeatrunReplayVision", BeatrunReplayVision)
hook.Add("HUDPaint", "BeatrunReplayHUD", BeatrunReplayHUD)
surface.PlaySound("friends/friend_join.wav")
end
net.Receive("ReplayRequest", ReplayBegin)
net.Receive("ReplaySendToClient", function(length)
LocalPlayer().ReplayTicks = util.JSONToTable(util.Decompress(net.ReadData(length/8)))[2]
LocalPlayer().ReplayFirstTick = false
ReplayBegin()
end)
end
function ReplayCancel(ply)
hook.Remove("StartCommand", "ReplayPlay")
hook.Remove("RenderScreenspaceEffects", "BeatrunReplayVision")
hook.Remove("HUDPaint", "BeatrunReplayHUD")
ply.InReplay = false
ply.ReplayFirstTick = false
net.Start("ReplayRequest")
net.WriteBool(true)
net.SendToServer()
end
concommand.Add("Beatrun_BeginReplayPlayback", function(ply,cmd,args,argstr)
ReplaySendToClient(ply,argstr)
end)

View file

@ -1,20 +0,0 @@
--[[
local prefabs = {
basic_floor = {
{Vector(), Vector(300, 300, 50), 0, 0, 0}
}
}
]]
function SpawnPrefab(pos, data)
for k, v in ipairs(data) do
-- local mins = v[1]
-- local maxs = v[2]
local offsetx = v[3] or 0
local offsety = v[4] or 0
local offsetz = v[5] or 0
local offsetvec = Vector(offsetx, offsety, offsetz)
offsetvec:Add(pos)
end
end

View file

@ -1,11 +1,11 @@
VERSIONGLOBAL = "v1.0.4"
VERSIONGLOBAL = "1.0.8"
DeriveGamemode("sandbox")
GM.Name = "Beatrun"
GM.Author = "who cares"
GM.Email = "whocares@noone.com"
GM.Website = "www.mirrorsedge.com xd"
GM.Author = "N/A"
GM.Email = "N/A"
GM.Website = "github.com/JonnyBro/beatrun"
include("player_class/player_beatrun.lua")

View file

@ -4,8 +4,7 @@ hook.Add("EntityTakeDamage", "MEHitSounds", function(ply, dmginfo)
if not ply:IsPlayer() then return end
if dmginfo:IsBulletDamage() then
-- Block damage if they're going very fast
if ply:GetVelocity():Length() > 400 then return true end
if ply:GetVelocity():Length() > 400 then return true end -- Block damage if they're going very fast
ply:EmitSound("mirrorsedge/Flesh_0" .. tostring(math.random(1, 9)) .. ".wav")
ply:ViewPunch(Angle(math.Rand(-10, -5), 0, math.Rand(0, 5)))

View file

@ -1,42 +0,0 @@
util.AddNetworkString("ReplayRequest")
util.AddNetworkString("ReplayTutorialPos")
net.Receive("ReplayRequest", function(len, ply)
local stopped = net.ReadBool()
if not stopped and not ply.InReplay and ((Course_Name ~= "") or TUTORIALMODE) then
ply.InReplay = true
ply:ResetParkourState()
ply:Spawn()
ply:SetNW2Int("CPNum", -1)
ply:SetLocalVelocity(vector_origin)
ply:SetLaggedMovementValue(0)
timer.Simple(0.1, function()
ply:SetLaggedMovementValue(1)
end)
if not TUTORIALMODE then
ply:SetPos(Course_StartPos)
else
ply:SetPos(net.ReadVector())
end
net.Start("ReplayRequest")
net.Send(ply)
elseif stopped then
ply.InReplay = false
end
hook.Run("PostReplayRequest", ply, stopped)
end)
net.Receive("ReplayTutorialPos", function(len, ply)
if not TUTORIALMODE then return end
local pos = net.ReadVector()
ply:SetPos(pos or ply:GetPos())
ply:SetLocalVelocity(vector_origin)
end)

View file

@ -1,89 +0,0 @@
util.AddNetworkString("BlindPlayers")
util.AddNetworkString("BlindNPCKilled")
local function Echo()
return false
end
blinded = false
concommand.Add("toggleblindness", function(ply)
if IsValid(ply) and not ply:IsSuperAdmin() then return end
blinded = not blinded
net.Start("BlindPlayers")
net.WriteBool(blinded)
net.Broadcast()
if blinded then
for k, v in pairs(ents.FindByClass("env_soundscape")) do
v:Remove()
end
hook.Add("EntityEmitSound", "Echo", Echo)
else
hook.Remove("EntityEmitSound", "Echo")
end
end)
local red = Color(255, 90, 90)
local green = Color(90, 255, 90)
concommand.Add("blindplayer", function(ply, cmd, args)
if IsValid(ply) and not ply:IsSuperAdmin() then return end
local blinded = tobool(args[2])
local blindedstr = (blinded and "is now blind.\n") or "is no longer blind.\n"
local blindedcol = (blinded and red) or green
local plysearch = args[1]
if not plysearch then
MsgC(red, "syntax: blindplayer (player name) (0/1)\n")
return
end
local mply = nil
local mname = ""
local mcount = 0
for _, v in ipairs(player.GetAll()) do
local name = v:Nick()
local smatch = string.match(name, plysearch)
if smatch then
local slen = smatch:len()
if slen > mcount then
mply = v
mname = name
mcount = slen
end
end
end
if IsValid(mply) then
MsgC(blindedcol, mname, " ", blindedstr)
else
MsgC(red, "Player not found: ", plysearch)
return
end
net.Start("BlindPlayers")
net.WriteBool(blinded)
net.Send(mply)
end)
hook.Add("OnNPCKilled", "BlindNPCKilled", function(npc, attacker, inflictor)
if blinded and attacker:IsPlayer() then
net.Start("BlindNPCKilled")
net.Send(attacker)
end
end)
hook.Add("InitPostEntity", "WtfTFA", function()
hook.Remove("EntityEmitSound", "zzz_TFA_EntityEmitSound")
hook.Remove("InitPostEntity", "WtfTFA")
end)

View file

@ -1,12 +0,0 @@
function SpawnDebugLadder()
local p = Entity(1):GetEyeTrace()
a = ents.Create("br_ladder")
a:SetAngles(p.HitNormal:Angle())
a:SetPos(p.HitPos + p.HitNormal * 10)
a:Spawn()
sk = util.QuickTrace(p.HitPos, Vector(0, 0, 100000)).HitPos - p.HitNormal * 10
a:LadderHeightExact(util.QuickTrace(sk, Vector(0, 0, -100000)).HitPos:Distance(a:GetPos()) - 62)
end

1
version.txt Normal file
View file

@ -0,0 +1 @@
1.0.8