diff --git a/FIXES.md b/FIXES.md index 8b73369..eb39117 100644 --- a/FIXES.md +++ b/FIXES.md @@ -1,13 +1,13 @@ -# Сделанные мной фиксы и добавления +# Добавлено мной * Разрешение Overdrive на сервере - *Beatrun_AllowOvedriveInMultiplayer*. -* Небольшой толчёк камеры при нырянии. -* Discord Rich Presence -* Измение цвета худа - *Beatrun_HUDTextColor*, *Beatrun_HUDCornerColor*, *Beatrun_HUDFloatingXPColor* -
-* Фикс трёх букв из-за которых нихуя не работало. -* Быстрый поворот на земле (ПКМ пока бежишь/стоишь) включён по умолчанию (Beatrun_QuickturnGround). -* Быстрый поворот только с руками бегуна (Фикс поворотов при прицеливании и т.п.). -* Фикс ошибки запуска курса. -* Фикс использования хука (пробел по стене когда вы в воздухе). -* Фикс сортировки таблицы лидеров. -* Убрал ваш SteamID в углу потому что могу. \ No newline at end of file +* Измение цвета худа - *Beatrun_HUDTextColor*, *Beatrun_HUDCornerColor*, *Beatrun_HUDFloatingXPColor*. +* Discord Rich Presence (Нужен модуль из lua/bin) +* Небольшой толчок камеры при нырянии. +* Изменение максимальной скорости - *Beatrun_MaxSpeed* (Спасибо c4nk, я слепой). +* Возможность удалять зиплайны от Zipline Gun на ПКМ. (Завтра доделаю) + +# Фиксы с предыдущей версии +* Выключил обратно быстрый разворот, хуйня (Чтобы откатить напишите **Beatrun_QuickturnGround 0** в консоль). +* Фикс незакрытия меню постройки. +* Фикс сохранения курсов. +* Отключены реплеи до фикса. \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/entities/entities/br_datacube/shared.lua b/beatrun/gamemodes/beatrun/entities/entities/br_datacube/shared.lua index d2e1962..b6b8c90 100644 --- a/beatrun/gamemodes/beatrun/entities/entities/br_datacube/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/entities/br_datacube/shared.lua @@ -1,56 +1,58 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" -ENT.PrintName = "Data Cube" -ENT.Author = "" -ENT.Information = "" - -ENT.Spawnable = true +ENT.Type = "anim" +ENT.Base = "base_entity" +ENT.PrintName = "Data Cube" +ENT.Author = "" +ENT.Category = "Beatrun" +ENT.Information = "" +ENT.Spawnable = true ENT.RenderGroup = RENDERGROUP_TRANSLUCENT -ENT.Category = "Beatrun" - AddCSLuaFile() ENT.Model = "models/hunter/blocks/cube05x05x05.mdl" ENT.DataCube = true -local color_green = Color(0,255,0) +local color_green = Color(0, 255, 0) + function ENT:Initialize() - self:SetModel(self.Model) - self:SetSolid(SOLID_VPHYSICS) - self:SetCollisionGroup(COLLISION_GROUP_WEAPON) - self:SetCollisionBounds(Vector(-20,-20,-15), Vector(20,20,30)) + self:SetModel(self.Model) + self:SetSolid(SOLID_VPHYSICS) + self:SetCollisionGroup(COLLISION_GROUP_WEAPON) + self:SetCollisionBounds(Vector(-20, -20, -15), Vector(20, 20, 30)) + if SERVER then self:PhysicsInit(SOLID_VPHYSICS) - local randvec = VectorRand()*200 + + local randvec = VectorRand() * 200 randvec.z = math.abs(randvec.z) + self:SetTrigger(true) self:GetPhysicsObject():SetVelocity(randvec) end + self:SetColor(color_green) self:SetCustomCollisionCheck(true) end -hook.Add( "ShouldCollide", "DataCubeCollisions", function( ent1, ent2 ) - -- If players are about to collide with each other, then they won't collide. - if ( ent1.DataCube and ent2.DataCube ) then return false end +hook.Add("ShouldCollide", "DataCubeCollisions", function(ent1, ent2) + -- If players are about to collide with each other, then they won't collide. + if ent1.DataCube and ent2.DataCube then return false end +end) -end ) +-- local screencolor = Color(64, 0, 0, 64) -local screencolor = Color(64, 0, 0, 64) function ENT:StartTouch(ent) if ent:IsPlayer() then - ent:SetNW2Int("DataCubes", ent:GetNW2Int("DataCubes", 0)+1) - self:EmitSound("A_TT_Stars.wav", 75, 100+math.random(-10,5)) + ent:SetNW2Int("DataCubes", ent:GetNW2Int("DataCubes", 0) + 1) + + self:EmitSound("A_TT_Stars.wav", 75, 100 + math.random(-10, 5)) self:Remove() end end function ENT:Touch(ent) - if ent:IsPlayer() then - - end + if ent:IsPlayer() then return end end function ENT:Think() @@ -58,21 +60,20 @@ function ENT:Think() end function ENT:Use(activator, caller, usetype) - end function ENT:OnRemove() - end -local spinang = Angle(0,1,0) +local spinang = Angle(0, 1, 0) + function ENT:DrawTranslucent() local curang = self:GetRenderAngles() or Angle() curang:Add(spinang) + self:SetRenderAngles(curang) self:DrawModel() end - function ENT:Draw() end \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/entities/entities/br_hookpoint/shared.lua b/beatrun/gamemodes/beatrun/entities/entities/br_hookpoint/shared.lua index 0994435..2862b1c 100644 --- a/beatrun/gamemodes/beatrun/entities/entities/br_hookpoint/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/entities/br_hookpoint/shared.lua @@ -1,63 +1,58 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" -ENT.PrintName = "Hook Point" -ENT.Author = "" -ENT.Information = "" - -ENT.Spawnable = true +ENT.Type = "anim" +ENT.Base = "base_entity" +ENT.PrintName = "Hook Point" +ENT.Author = "" +ENT.Category = "Beatrun" +ENT.Information = "" +ENT.Spawnable = true ENT.RenderGroup = RENDERGROUP_TRANSLUCENT -ENT.Category = "Beatrun" - AddCSLuaFile() ENT.Model = "models/Roller.mdl" ENT.HookPoint = true -local color_green = Color(0,255,0) +-- local color_green = Color(0, 255, 0) + function ENT:Initialize() - self:SetModel(self.Model) - self:SetSolid(SOLID_VPHYSICS) - self:SetCollisionGroup(COLLISION_GROUP_WEAPON) + self:SetModel(self.Model) + self:SetSolid(SOLID_VPHYSICS) + self:SetCollisionGroup(COLLISION_GROUP_WEAPON) + local mins, maxs = self:GetCollisionBounds() self:PhysicsInitBox(mins, maxs) - - -- Set up solidity and movetype - self:SetMoveType( MOVETYPE_NONE ) + self:SetMoveType(MOVETYPE_NONE) self:GetPhysicsObject():EnableMotion(false) end - function ENT:Think() if SERVER then - self:NextThink(CurTime()+1) + self:NextThink(CurTime() + 1) + return true end - - if ( CLIENT ) then + + if CLIENT then local physobj = self:GetPhysicsObject() - if ( IsValid( physobj ) ) then - physobj:SetPos( self:GetPos() ) - physobj:SetAngles( self:GetAngles() ) + if IsValid(physobj) then + physobj:SetPos(self:GetPos()) + physobj:SetAngles(self:GetAngles()) end end end function ENT:Use(activator, caller, usetype) - end function ENT:OnRemove() - end function ENT:DrawTranslucent() self:DrawModel() end - function ENT:Draw() end \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/entities/entities/br_intelmarker/shared.lua b/beatrun/gamemodes/beatrun/entities/entities/br_intelmarker/shared.lua index 2a86ca1..1c4bd4d 100644 --- a/beatrun/gamemodes/beatrun/entities/entities/br_intelmarker/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/entities/br_intelmarker/shared.lua @@ -1,33 +1,31 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" -ENT.PrintName = "Intel Marker" -ENT.Author = "" -ENT.Information = "" - -ENT.Spawnable = true +ENT.Type = "anim" +ENT.Base = "base_entity" +ENT.PrintName = "Intel Marker" +ENT.Author = "" +ENT.Category = "Beatrun" +ENT.Information = "" +ENT.Spawnable = true ENT.RenderGroup = RENDERGROUP_TRANSLUCENT -ENT.Category = "Beatrun" - AddCSLuaFile() ENT.Model = "models/hunter/blocks/cube025x025x025.mdl" function ENT:SetupDataTables() - - self:NetworkVar( "Int", 0, "Score" ) - + self:NetworkVar("Int", 0, "Score") end local minb, maxb = Vector(-40, -40, 0), Vector(40, 40, 64) + function ENT:Initialize() - self:SetModel(self.Model) + self:SetModel(self.Model) self:DrawShadow(false) - self:SetMoveType(MOVETYPE_NONE) - self:SetSolid(SOLID_BBOX) - self:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE) + self:SetMoveType(MOVETYPE_NONE) + self:SetSolid(SOLID_BBOX) + self:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE) self:SetCollisionBounds(minb, maxb) + if CLIENT then self:SetRenderBounds(minb, maxb) self.offset = 0 @@ -37,8 +35,7 @@ function ENT:Initialize() end function ENT:StartTouch(ent) - if ent:IsPlayer() then - end + if ent:IsPlayer() then return end end function ENT:UpdateTransmitState() @@ -46,37 +43,41 @@ function ENT:UpdateTransmitState() end function ENT:Use(activator, caller, usetype) - end function ENT:OnRemove() - end local radius = 35 local red = Color(100, 255, 0, 125) local circlepos = Vector() -local circleup = Vector(0,0,40) -local msin = math.sin -local mabs = math.abs +local circleup = Vector(0, 0, 40) +-- local msin = math.sin +-- local mabs = math.abs + function ENT:DrawTranslucent() self:SetRenderBounds(minb, maxb) render.SetColorMaterial() - for i=0, 16 do - local angle = i * math.pi*2 / 16 + self.offset - circlepos:SetUnpacked(math.cos(angle)*radius, math.sin(angle)*radius, 0) - local newpos = self:GetPos()+circlepos - render.DrawBeam(newpos, newpos+circleup, 4, 0, 1, red, true) + + for i = 0, 16 do + local angle = i * math.pi * 2 / 16 + self.offset + + circlepos:SetUnpacked(math.cos(angle) * radius, math.sin(angle) * radius, 0) + + local newpos = self:GetPos() + circlepos + + render.DrawBeam(newpos, newpos + circleup, 4, 0, 1, red, true) end - local bmin, bmax = self:GetRenderBounds() - self.offset = self.offset + (0.00075) + + -- local bmin, bmax = self:GetRenderBounds() + self.offset = self.offset + 0.00075 + if self.offset >= 180 then self.offset = 0 end + -- render.DrawWireframeBox(self:GetPos(), angle_zero, bmin, bmax) end - function ENT:Draw() - end \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/entities/entities/br_ladder/shared.lua b/beatrun/gamemodes/beatrun/entities/entities/br_ladder/shared.lua index 3395132..5a84a13 100644 --- a/beatrun/gamemodes/beatrun/entities/entities/br_ladder/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/entities/br_ladder/shared.lua @@ -1,44 +1,47 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" -ENT.PrintName = "Ladder" -ENT.Author = "" -ENT.Information = "" - -ENT.Spawnable = true +ENT.Type = "anim" +ENT.Base = "base_entity" +ENT.PrintName = "Ladder" +ENT.Author = "" +ENT.Category = "Beatrun" +ENT.Information = "" +ENT.Spawnable = true ENT.RenderGroup = RENDERGROUP_OPAQUE -ENT.Category = "Beatrun" - AddCSLuaFile() ENT.Model = "models/props_c17/metalladder002.mdl" ENT.ModelEnd = "models/props_c17/metalladder002b.mdl" - ENT.NoClimbing = true function ENT:SetupDataTables() - self:NetworkVar( "Float", 0, "LadderHeight" ) + self:NetworkVar("Float", 0, "LadderHeight") end function LadderSpawnDebug() - local p=Entity(1):GetEyeTrace() - a=ents.Create('br_ladder') + local p = Entity(1):GetEyeTrace() + + a = ents.Create("br_ladder") + a:SetAngles(p.HitNormal:Angle()) - a:SetPos(p.HitPos+p.HitNormal*10) + 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) + + 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 function ENT:LadderHeight(mul) - local height = 125*mul - self:SetLadderHeight(height-(75)) - local mins, maxs = Vector(5,-14,0), Vector(14, 14,height) - self:SetCollisionBounds(mins,maxs) - self:PhysicsInitBox(mins,maxs) - self:SetSolid(SOLID_VPHYSICS) - self:SetCollisionGroup(SOLID_VPHYSICS) + local height = 125 * mul + self:SetLadderHeight(height - 75) + + local mins, maxs = Vector(5, -14, 0), Vector(14, 14, height) + + self:SetCollisionBounds(mins, maxs) + self:PhysicsInitBox(mins, maxs) + self:SetSolid(SOLID_VPHYSICS) + self:SetCollisionGroup(SOLID_VPHYSICS) self:EnableCustomCollisions(true) self:GetPhysicsObject():EnableMotion(false) end @@ -46,53 +49,58 @@ end function ENT:LadderHeightExact(height) self:SetLadderHeight(height) height = height + 75 - local mins, maxs = Vector(5,-14,0), Vector(14, 14,height) - self:SetCollisionBounds(mins,maxs) - self:PhysicsInitBox(mins,maxs) - self:SetSolid(SOLID_VPHYSICS) - self:SetCollisionGroup(SOLID_VPHYSICS) + + local mins, maxs = Vector(5, -14, 0), Vector(14, 14, height) + + self:SetCollisionBounds(mins, maxs) + self:PhysicsInitBox(mins, maxs) + self:SetSolid(SOLID_VPHYSICS) + self:SetCollisionGroup(SOLID_VPHYSICS) self:EnableCustomCollisions(true) self:GetPhysicsObject():EnableMotion(false) end function ENT:Initialize() local height = 125 + if SERVER then - self:SetLadderHeight(height-(75)) + self:SetLadderHeight(height - 75) end - - self:SetModel(self.Model) + + self:SetModel(self.Model) + local ang = self:GetAngles() - local mins, maxs = Vector(5,-14,0), Vector(14, 14,height) - self:SetCollisionBounds(mins,maxs) + local mins, maxs = Vector(5, -14, 0), Vector(14, 14, height) + + self:SetCollisionBounds(mins, maxs) self:SetAngles(ang) - self:PhysicsInitBox(mins,maxs) - self:SetSolid(SOLID_VPHYSICS) - self:SetCollisionGroup(SOLID_VPHYSICS) + self:PhysicsInitBox(mins, maxs) + self:SetSolid(SOLID_VPHYSICS) + self:SetCollisionGroup(SOLID_VPHYSICS) self:EnableCustomCollisions(true) self:GetPhysicsObject():EnableMotion(false) - + if CLIENT then - self:SetRenderBounds(mins,maxs) + self:SetRenderBounds(mins, maxs) self.CLModel = ClientsideModel(self.Model) self.CLModel:SetPos(self:GetPos()) self.CLModel:SetAngles(self:GetAngles()) - self.CLModelEnd = ClientsideModel(self.ModelEnd) self.CLModelEnd:SetPos(self:GetPos()) self.CLModelEnd:SetAngles(self:GetAngles()) - - local scale = Vector(1,0.85,1) + + local scale = Vector(1, 0.85, 1) local mat = Matrix() + mat:Scale(scale) + self.CLModel:EnableMatrix("RenderMultiply", mat) self.CLModelEnd:EnableMatrix("RenderMultiply", mat) - self.CLModel:SetMaterial("medge/plain/redbrickvertex") self.CLModelEnd:SetMaterial("medge/plain/redbrickvertex") - end - - self:SetPos(self:GetPos()-self:GetAngles():Forward()*10) + end + + self:SetPos(self:GetPos() - self:GetAngles():Forward() * 10) end function ENT:UpdateTransmitState() @@ -103,7 +111,7 @@ function ENT:OnRemove() if IsValid(self.CLModel) then self.CLModel:Remove() end - + if IsValid(self.CLModelEnd) then self.CLModelEnd:Remove() end @@ -115,52 +123,58 @@ end function ENT:Think() if SERVER then local ang = self:GetAngles() - if ang[1] != 0 or ang[3] != 0 then + + if ang[1] ~= 0 or ang[3] ~= 0 then ang.x = 0 ang.z = 0 + self:SetAngles(ang) end - self:NextThink(CurTime()+1) + + self:NextThink(CurTime() + 1) + return true end - - if ( CLIENT ) then + + if CLIENT then local physobj = self:GetPhysicsObject() - - if !IsValid(self.CLModel) then + + if not IsValid(self.CLModel) then self.CLModel = ClientsideModel(self.Model) self.CLModel:SetPos(self:GetPos()) self.CLModel:SetAngles(self:GetAngles()) end - - if !IsValid(self.CLModelEnd) then - + + if not IsValid(self.CLModelEnd) then self.CLModelEnd = ClientsideModel(self.ModelEnd) self.CLModelEnd:SetPos(self:GetPos()) self.CLModelEnd:SetAngles(self:GetAngles()) - - - local scale = Vector(1,0.85,1) + + local scale = Vector(1, 0.85, 1) local mat = Matrix() + mat:Scale(scale) + self.CLModel:EnableMatrix("RenderMultiply", mat) self.CLModelEnd:EnableMatrix("RenderMultiply", mat) - self.CLModel:SetMaterial("medge/plain/redbrickvertex") self.CLModelEnd:SetMaterial("medge/plain/redbrickvertex") end - if ( IsValid( physobj ) ) then - physobj:SetPos( self:GetPos() ) - physobj:SetAngles( self:GetAngles() ) - self.CLModel:SetPos( self:GetPos() ) - self.CLModel:SetAngles( self:GetAngles() ) - self.CLModelEnd:SetPos( self:GetPos() ) - self.CLModelEnd:SetAngles( self:GetAngles() ) - local mins, maxs = physobj:GetAABB() + if IsValid(physobj) then + physobj:SetPos(self:GetPos()) + physobj:SetAngles(self:GetAngles()) + + self.CLModel:SetPos(self:GetPos()) + self.CLModel:SetAngles(self:GetAngles()) + self.CLModelEnd:SetPos(self:GetPos()) + self.CLModelEnd:SetAngles(self:GetAngles()) + + local _, maxs = physobj:GetAABB() local cmins, cmaxs = self:GetCollisionBounds() - if maxs.z != cmaxs.z then - self:PhysicsInitBox(cmins,cmaxs) + + if maxs.z ~= cmaxs.z then + self:PhysicsInitBox(cmins, cmaxs) self:SetSolid(SOLID_VPHYSICS) self:SetCollisionGroup(SOLID_VPHYSICS) self:EnableCustomCollisions(true) @@ -168,7 +182,8 @@ function ENT:Think() end else local cmins, cmaxs = self:GetCollisionBounds() - self:PhysicsInitBox(cmins,cmaxs) + + self:PhysicsInitBox(cmins, cmaxs) self:SetSolid(SOLID_VPHYSICS) self:SetCollisionGroup(SOLID_VPHYSICS) self:EnableCustomCollisions(true) @@ -179,59 +194,64 @@ end function ENT:Draw() local pos = self:GetPos() - local ang = self:GetAngles() + -- local ang = self:GetAngles() local oldz = pos.z local mins, maxs = self:GetCollisionBounds() - maxs.z = self:GetLadderHeight()+75 - local num = maxs.z/125 + maxs.z = self:GetLadderHeight() + 75 + + local num = maxs.z / 125 local numc = math.floor(num) - local extra = num-numc - if !IsValid(self.CLModel) then - self:SetRenderBounds(mins,maxs) + local extra = num - numc + + if not IsValid(self.CLModel) then + self:SetRenderBounds(mins, maxs) self.CLModel = ClientsideModel(self.Model) self.CLModel:SetPos(self:GetPos()) self.CLModel:SetAngles(self:GetAngles()) end - - if !IsValid(self.CLModelEnd) then - + + if not IsValid(self.CLModelEnd) then self.CLModelEnd = ClientsideModel(self.ModelEnd) self.CLModelEnd:SetPos(self:GetPos()) self.CLModelEnd:SetAngles(self:GetAngles()) - - local scale = Vector(1,0.85,1) + local scale = Vector(1, 0.85, 1) local mat = Matrix() + mat:Scale(scale) + self.CLModel:EnableMatrix("RenderMultiply", mat) self.CLModelEnd:EnableMatrix("RenderMultiply", mat) - self.CLModel:SetMaterial("medge/plain/redbrickvertex") self.CLModelEnd:SetMaterial("medge/plain/redbrickvertex") end - - self:SetRenderBounds(mins,maxs) - for i=0, numc do + + self:SetRenderBounds(mins, maxs) + + for i = 0, numc do if num == 1 then self.CLModel:DrawModel() break end - if i==numc then - if i>0 then - pos.z = pos.z+(125*extra) + + if i == numc then + if i > 0 then + pos.z = pos.z + (125 * extra) end + self.CLModel:SetPos(pos) self.CLModel:SetupBones() self.CLModel:DrawModel() else - pos.z = oldz+(125*i) + pos.z = oldz + (125 * i) self.CLModel:SetPos(pos) self.CLModel:SetupBones() self.CLModel:DrawModel() end end - + pos.z = pos.z + 112 + self.CLModelEnd:SetPos(pos) self.CLModelEnd:SetupBones() self.CLModelEnd:DrawModel() diff --git a/beatrun/gamemodes/beatrun/entities/entities/br_laser/shared.lua b/beatrun/gamemodes/beatrun/entities/entities/br_laser/shared.lua index 8b1a86c..806098c 100644 --- a/beatrun/gamemodes/beatrun/entities/entities/br_laser/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/entities/br_laser/shared.lua @@ -1,89 +1,102 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" -ENT.PrintName = "Laser Hazard" -ENT.Author = "" -ENT.Information = "" - -ENT.Spawnable = true +ENT.Type = "anim" +ENT.Base = "base_entity" +ENT.PrintName = "Laser Hazard" +ENT.Author = "" +ENT.Category = "Beatrun" +ENT.Information = "" +ENT.Spawnable = true ENT.RenderGroup = RENDERGROUP_BOTH -ENT.Category = "Beatrun" - AddCSLuaFile() ENT.Model = "models/maxofs2d/button_02.mdl" - - ENT.NoClimbing = true ENT.LaserLength = 100000 if CLIENT then - language.Add( "br_laser", "Laser Hazard" ) + language.Add("br_laser", "Laser Hazard") end function ENT:SetupDataTables() - self:NetworkVar( "Vector", 1, "EndPos" ) + self:NetworkVar("Vector", 1, "EndPos") end -local spawntr = {} -local spawntrout = {} +-- local spawntr = {} +-- local spawntrout = {} + function ENT:Initialize() local entstable = player.GetAll() local ang = self:GetAngles() - entstable[#entstable+1] = self - self:SetEndPos(util.QuickTrace(self:GetPos(), ang:Up()*self.LaserLength, entstable).HitPos) - self:SetModel(self.Model) - local mins, maxs = Vector(0,-1,-1), Vector(0, 1, self:GetPos():Distance(self:GetEndPos())) + + entstable[#entstable + 1] = self + + self:SetEndPos(util.QuickTrace(self:GetPos(), ang:Up() * self.LaserLength, entstable).HitPos) + self:SetModel(self.Model) + + local mins, maxs = Vector(0, -1, -1), Vector(0, 1, self:GetPos():Distance(self:GetEndPos())) + if SERVER then - self:PhysicsInitBox(mins,maxs) + self:PhysicsInitBox(mins, maxs) self:SetSolid(SOLID_VPHYSICS) self:GetPhysicsObject():EnableMotion(false) end - self.NoPlayerCollisions=true + + self.NoPlayerCollisions = true self:EnableCustomCollisions(true) - + if CLIENT then - self:SetRenderBounds(mins,maxs) - self:SetCollisionBounds(mins,maxs) + self:SetRenderBounds(mins, maxs) + self:SetCollisionBounds(mins, maxs) end end function ENT:OnRemove() - end function ENT:BRCollisionFunc(ent) if CLIENT then return false end if ent:Health() <= 0 or (ent:IsPlayer() and ent:HasGodMode()) then return false end + local ang = self:GetAngles() - if util.QuickTrace(self:GetPos(), ang:Up()*self.LaserLength, self).Entity != ent then return false end + + if util.QuickTrace(self:GetPos(), ang:Up() * self.LaserLength, self).Entity ~= ent then return false end + local dmginfo = DamageInfo() dmginfo:SetAttacker(self) - dmginfo:SetDamage(100) + dmginfo:SetDamage(1000) dmginfo:SetDamageType(DMG_DISSOLVE) + ent:TakeDamageInfo(dmginfo) - ent:EmitSound("bigspark"..math.random(1,2)..".wav") + ent:EmitSound("bigspark" .. math.random(1, 2) .. ".wav") + return false end function ENT:Think() if CLIENT then return end + local entstable = player.GetAll() local ang = self:GetAngles() - entstable[#entstable+1] = self - local tr = util.QuickTrace(self:GetPos(), ang:Up()*self.LaserLength, entstable) + + entstable[#entstable + 1] = self + + local tr = util.QuickTrace(self:GetPos(), ang:Up() * self.LaserLength, entstable) local trpos = tr.HitPos - if trpos != self:GetEndPos() then - local mins, maxs = Vector(0,-1,-1), Vector(0, 1, self:GetPos():Distance(trpos)) + + if trpos ~= self:GetEndPos() then + local mins, maxs = Vector(0, -1, -1), Vector(0, 1, self:GetPos():Distance(trpos)) + self:SetEndPos(trpos) - self:PhysicsInitBox(mins,maxs) + self:PhysicsInitBox(mins, maxs) self:SetSolid(SOLID_VPHYSICS) - self.NoPlayerCollisions=true + self.NoPlayerCollisions = true self:EnableCustomCollisions(true) self:GetPhysicsObject():EnableMotion(false) end - self:NextThink(CurTime()+5) + + self:NextThink(CurTime() + 5) + return true end @@ -92,10 +105,12 @@ function ENT:UpdateTransmitState() end local ropemat = Material("cable/physbeam") -local color_red = Color(255,0,0) +local color_red = Color(255, 0, 0) + function ENT:Draw() local mins, maxs = self:GetCollisionBounds() - self:SetRenderBounds(mins,maxs) + + self:SetRenderBounds(mins, maxs) self:DrawModel() end @@ -106,7 +121,9 @@ end function ENT:DrawLOC() local mins, maxs = self:GetCollisionBounds() - self:SetRenderBounds(mins,maxs) + + self:SetRenderBounds(mins, maxs) + render.SetMaterial(ropemat) render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_red) end \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/entities/entities/br_mat/shared.lua b/beatrun/gamemodes/beatrun/entities/entities/br_mat/shared.lua index 930a510..0b06ac5 100644 --- a/beatrun/gamemodes/beatrun/entities/entities/br_mat/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/entities/br_mat/shared.lua @@ -1,27 +1,24 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" -ENT.PrintName = "Mat" -ENT.Author = "" -ENT.Information = "" - -ENT.Spawnable = true +ENT.Type = "anim" +ENT.Base = "base_entity" +ENT.PrintName = "Mat" +ENT.Author = "" +ENT.Category = "Beatrun" +ENT.Information = "" +ENT.Spawnable = true ENT.RenderGroup = RENDERGROUP_OPAQUE -ENT.Category = "Beatrun" - AddCSLuaFile() ENT.Model = "models/mechanics/robotics/stand.mdl" function ENT:SetupDataTables() - end function ENT:Initialize() self:SetModel(self.Model) - self:SetMoveType( MOVETYPE_VPHYSICS ) - self:SetSolid( SOLID_VPHYSICS ) + self:SetMoveType(MOVETYPE_VPHYSICS) + self:SetSolid(SOLID_VPHYSICS) self:PhysicsInit(SOLID_VPHYSICS) self:GetPhysicsObject():EnableMotion(false) end diff --git a/beatrun/gamemodes/beatrun/entities/entities/br_rabbitfrog/shared.lua b/beatrun/gamemodes/beatrun/entities/entities/br_rabbitfrog/shared.lua index c55e364..abc1c9b 100644 --- a/beatrun/gamemodes/beatrun/entities/entities/br_rabbitfrog/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/entities/br_rabbitfrog/shared.lua @@ -1,45 +1,48 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" -ENT.PrintName = "Rabbitfrog" -ENT.Author = "" -ENT.Information = "" - -ENT.Spawnable = true +ENT.Type = "anim" +ENT.Base = "base_entity" +ENT.PrintName = "Rabbitfrog" +ENT.Author = "" +ENT.Category = "Beatrun" +ENT.Information = "" +ENT.Spawnable = true ENT.RenderGroup = RENDERGROUP_OPAQUE -ENT.Category = "Beatrun" - 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" ) + 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) +-- local mins, maxs = Vector(-64, -64, 0), Vector(64, 64, 154) + function ENT:Initialize() - self:SetModel(self.Model) - -- self:SetMoveType(MOVETYPE_NONE) + self:SetModel(self.Model) + -- self:SetMoveType(MOVETYPE_NONE) -- self:SetSolid(SOLID_BBOX) -- self:SetCollisionBounds(mins, maxs) - if SERVER then self:PhysicsInit(SOLID_VPHYSICS) end + + if SERVER then + self:PhysicsInit(SOLID_VPHYSICS) + end + self:SetMoveType(MOVETYPE_VPHYSICS) self:ResetSequence(1) - if SERVER then self:SetUseType( SIMPLE_USE ) end + + if SERVER then + self:SetUseType(SIMPLE_USE) + end end - function ENT:OnRemove() - end function ENT:UpdateTransmitState() @@ -47,43 +50,44 @@ function ENT:UpdateTransmitState() end function ENT:Think() - self:NextThink( CurTime() ) + 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 ) +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:SetFloat("$blur", (i / d) * a) blur:Recompute() + render.UpdateScreenEffectTexture() - surface.DrawTexturedRect( 0, 0, ScrW(), ScrH() ) - + 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 rabbitpos, rabbitang = Vector(), Angle() +local landseq = { + [1] = true, + [4] = true +} -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 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) @@ -91,10 +95,12 @@ local function IsLanding(ent) end local introalpha = 255 + local function LandingHUDPaint() - introalpha = introalpha-(FrameTime()*50) - surface.SetDrawColor(0,0,0,introalpha) - surface.DrawRect(0,0,ScrW(),ScrH()) + introalpha = introalpha - (FrameTime() * 50) + + surface.SetDrawColor(0, 0, 0, introalpha) + surface.DrawRect(0, 0, ScrW(), ScrH()) if introalpha <= 0 then hook.Remove("HUDPaint", "LandingHUDPaint") @@ -110,7 +116,6 @@ local function LandingIntro() fx = false neweye = false endlerp = 0 - surface.PlaySound("hopperland.mp3") LandingHUDIntro() end @@ -118,68 +123,67 @@ end function ENT:Draw() -- Reset everything to known good - render.SetStencilWriteMask( 0xFF ) - render.SetStencilTestMask( 0xFF ) - render.SetStencilReferenceValue( 0 ) + render.SetStencilWriteMask(0xFF) + render.SetStencilTestMask(0xFF) + render.SetStencilReferenceValue(0) -- render.SetStencilCompareFunction( STENCIL_ALWAYS ) - render.SetStencilPassOperation( STENCIL_KEEP ) + render.SetStencilPassOperation(STENCIL_KEEP) -- render.SetStencilFailOperation( STENCIL_KEEP ) - render.SetStencilZFailOperation( STENCIL_KEEP ) + render.SetStencilZFailOperation(STENCIL_KEEP) render.ClearStencil() - -- Enable stencils - render.SetStencilEnable( true ) - -- Set the reference value to 1. This is what the compare function tests against - render.SetStencilReferenceValue( 1 ) - -- Force everything to fail - render.SetStencilCompareFunction( STENCIL_NEVER ) - -- Save all the things we don't draw - render.SetStencilFailOperation( STENCIL_REPLACE ) + 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 - -- Fail to draw our entities. - self:DrawModel() - -- Render all pixels that don't have their stencil value as 1 - render.SetStencilCompareFunction( STENCIL_EQUAL ) - -- Don't modify the stencil buffer when things fail - render.SetStencilFailOperation( STENCIL_KEEP ) + 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 - -- Draw our big entities. They will have holes in them wherever the smaller entities were -- for _, ent in pairs( ents.FindByClass( "sent_stencil_test_big" ) ) do - render.PushFilterMag( TEXFILTER.ANISOTROPIC ) - render.PushFilterMin( TEXFILTER.ANISOTROPIC ) + 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.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 - -- Let everything render normally again - render.SetStencilEnable( false ) + 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 + 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, nang = LocalToWorld(offset, angles, pos, angles) + local npos, _ = LocalToWorld(offset, angles, pos, angles) angles:Sub(angoffset) angles.x = -angles.x - angles.y = angles.y-90 + 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())) @@ -189,46 +193,52 @@ local function RabbitCalcView(ply, origin, ang) lastpos:Set(origin) lastang:Set(ang) elseif endlerp < 1 then - if !neweye then + if not neweye then lastang.z = 0 + ang:Set(lastang) + ply:SetEyeAngles(lastang) neweye = true - ply:CLViewPunch(Angle(12,0,0)) + + ply:CLViewPunch(Angle(12, 0, 0)) VManip:PlayAnim("vault") 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 + 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 +-- if IsValid(rabbit) and rabbit:GetCycle() < 1 and IsLanding(rabbit) then return false end -- end) - function ENT:Use(ply, caller, usetype, value) - if !ply:IsPlayer() then return end + if not ply:IsPlayer() then return end + print("hi") + ply:SetRabbit(self) ply:SetRabbitSeat(1) end @@ -239,13 +249,15 @@ end 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 pos = matrix:GetTranslation() - ply:GetViewOffset() local angles = matrix:GetAngles() - local npos, nang = LocalToWorld(offset, angles, pos, angles) + local npos, _ = LocalToWorld(offset, angles, pos, angles) ply:SetMoveType(MOVETYPE_NOCLIP) mv:SetOrigin(npos) end end + -- hook.Add("SetupMove", "RabbitPlayerMove", RabbitPlayerMove) \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/entities/entities/br_swingbar/shared.lua b/beatrun/gamemodes/beatrun/entities/entities/br_swingbar/shared.lua index 0d3d3ad..25e2a57 100644 --- a/beatrun/gamemodes/beatrun/entities/entities/br_swingbar/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/entities/br_swingbar/shared.lua @@ -1,71 +1,75 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" -ENT.PrintName = "Swingbar" -ENT.Author = "" -ENT.Information = "" - -ENT.Spawnable = true +ENT.Type = "anim" +ENT.Base = "base_entity" +ENT.PrintName = "Swingbar" +ENT.Author = "" +ENT.Category = "Beatrun" +ENT.Information = "" +ENT.Spawnable = true ENT.RenderGroup = RENDERGROUP_OPAQUE -ENT.Category = "Beatrun" - AddCSLuaFile() ENT.Model = "models/hunter/plates/plate2.mdl" - ENT.NoWallrun = true ENT.NoClimbing = true +local red = Color(255, 0, 0) +-- local spawntr = {} +-- local spawntrout = {} -local red = Color(255,0,0) -local spawntr = {} -local spawntrout = {} function ENT:Initialize() self:DrawShadow(false) self:SetColor(red) - self:SetModel(self.Model) - -- self:SetMoveType(MOVETYPE_NONE) - if SERVER then self:PhysicsInit(SOLID_VPHYSICS) end + self:SetModel(self.Model) + -- self:SetMoveType(MOVETYPE_NONE) + + if SERVER then + self:PhysicsInit(SOLID_VPHYSICS) + end + self:SetSolid(SOLID_VPHYSICS) self:SetCollisionGroup(COLLISION_GROUP_WEAPON) self:SetCustomCollisionCheck(true) self.NoPlayerCollisions = true - - -- local mins, maxs = self:GetCollisionBounds()*4 + + -- local mins, maxs = self:GetCollisionBounds() * 4 + -- spawntr.start = self:GetPos() -- spawntr.endpos = spawntr.start -- spawntr.filter = self -- spawntr.output = spawntrout -- spawntr.mins, spawntr.maxs = mins, maxs + -- util.TraceHull(spawntr) - + -- if spawntrout.Hit then - -- local ang = spawntrout.HitNormal:Angle() - -- ang.x = 0 - -- self:SetAngles(ang) + -- local ang = spawntrout.HitNormal:Angle() + -- ang.x = 0 + -- self:SetAngles(ang) -- end - end function ENT:CollisionFunc(ent) - -- if ent:GetPos().z+64>self:GetPos().z then - -- print("huh") - -- return true - -- else - -- return false - -- end end -function ENT:OnRemove() +-- if ent:GetPos().z + 64 > self:GetPos().z then +-- print("huh") +-- return true +-- else +-- return false +-- end + +function ENT:OnRemove() end function ENT:Think() return true end -local matrix -local vecscale +-- local matrix +-- local vecscale + function ENT:Draw() self:DrawModel() end \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/entities/entities/br_swingpipe/shared.lua b/beatrun/gamemodes/beatrun/entities/entities/br_swingpipe/shared.lua index 18ee2ff..af93611 100644 --- a/beatrun/gamemodes/beatrun/entities/entities/br_swingpipe/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/entities/br_swingpipe/shared.lua @@ -1,15 +1,13 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" -ENT.PrintName = "Swingpipe" -ENT.Author = "" -ENT.Information = "" - -ENT.Spawnable = true +ENT.Type = "anim" +ENT.Base = "base_entity" +ENT.PrintName = "Swingpipe" +ENT.Author = "" +ENT.Category = "Beatrun" +ENT.Information = "" +ENT.Spawnable = true ENT.RenderGroup = RENDERGROUP_OPAQUE -ENT.Category = "Beatrun" - AddCSLuaFile() ENT.Model = "models/parkoursource/pipe_standard.mdl" @@ -17,53 +15,57 @@ ENT.Model = "models/parkoursource/pipe_standard.mdl" function ENT:SetupDataTables() end -local spawntr = {} -local spawntrout = {} +-- local spawntr = {} +-- local spawntrout = {} + function ENT:Initialize() self:DrawShadow(false) - self:SetModel(self.Model) - self:SetMoveType(MOVETYPE_NONE) - local mins, maxs = Vector(-15,-15,0), Vector(15, 15,180) - self:SetCollisionBounds(mins,maxs) - self:PhysicsInitBox(mins,maxs) - self:SetSolid(SOLID_VPHYSICS) - self:SetCollisionGroup(COLLISION_GROUP_WEAPON) + self:SetModel(self.Model) + self:SetMoveType(MOVETYPE_NONE) + + local mins, maxs = Vector(-15, -15, 0), Vector(15, 15, 180) + + self:SetCollisionBounds(mins, maxs) + self:PhysicsInitBox(mins, maxs) + self:SetSolid(SOLID_VPHYSICS) + self:SetCollisionGroup(COLLISION_GROUP_WEAPON) self:EnableCustomCollisions(true) + if SERVER then self:GetPhysicsObject():EnableMotion(false) else - -- self:SetRenderOrigin(self:GetPos() - self:GetAngles():Forward()*15) + return end + + -- self:SetRenderOrigin(self:GetPos() - self:GetAngles():Forward() * 15) self:SetMaterial("medge/plain/redbrickvertex") - self.NoPlayerCollisions=true - - -- local mins, maxs = self:GetCollisionBounds()*4 + self.NoPlayerCollisions = true + -- local mins, maxs = self:GetCollisionBounds() * 4 + -- spawntr.start = self:GetPos() -- spawntr.endpos = spawntr.start -- spawntr.filter = self -- spawntr.output = spawntrout -- spawntr.mins, spawntr.maxs = mins, maxs - -- util.TraceHull(spawntr) - - -- if spawntrout.Hit then - -- local ang = spawntrout.HitNormal:Angle() - -- ang.x = 0 - -- self:SetAngles(ang) - -- end - -end + -- util.TraceHull(spawntr) + + -- if spawntrout.Hit then + -- local ang = spawntrout.HitNormal:Angle() + -- ang.x = 0 + -- self:SetAngles(ang) + -- end +end function ENT:OnRemove() - end - function ENT:Think() end -local matrix -local vecscale +-- local matrix +-- local vecscale + function ENT:Draw() self:DrawModel() -- local mins, maxs = self:GetCollisionBounds() diff --git a/beatrun/gamemodes/beatrun/entities/entities/br_swingrope/shared.lua b/beatrun/gamemodes/beatrun/entities/entities/br_swingrope/shared.lua index 1819c7f..851eb29 100644 --- a/beatrun/gamemodes/beatrun/entities/entities/br_swingrope/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/entities/br_swingrope/shared.lua @@ -1,68 +1,71 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" -ENT.PrintName = "Swingrope" -ENT.Author = "" -ENT.Information = "" - -ENT.Spawnable = true +ENT.Type = "anim" +ENT.Base = "base_entity" +ENT.PrintName = "Swingrope" +ENT.Author = "" +ENT.Category = "Beatrun" +ENT.Information = "" +ENT.Spawnable = true ENT.RenderGroup = RENDERGROUP_OPAQUE -ENT.Category = "Beatrun" - AddCSLuaFile() ENT.Model = "models/parkoursource/pipe_standard.mdl" - - ENT.NoClimbing = true ENT.NoWallrun = true function ENT:SetupDataTables() - self:NetworkVar( "Vector", 0, "StartPos" ) - self:NetworkVar( "Vector", 1, "EndPos" ) + self:NetworkVar("Vector", 0, "StartPos") + self:NetworkVar("Vector", 1, "EndPos") end -local spawntr = {} -local spawntrout = {} +-- local spawntr = {} +-- local spawntrout = {} + function ENT:Initialize() self:SetPos(self:GetStartPos()) - self:SetModel(self.Model) - local ang = (self:GetEndPos()-self:GetStartPos()):Angle() - local mins, maxs = Vector(-8,-8,0), Vector(self:GetStartPos():Distance(self:GetEndPos()), 0, 8) + self:SetModel(self.Model) + + local ang = (self:GetEndPos() - self:GetStartPos()):Angle() + local mins, maxs = Vector(-8, -8, 0), Vector(self:GetStartPos():Distance(self:GetEndPos()), 0, 8) + self:SetAngles(ang) - self:PhysicsInitBox(mins,maxs) - self:SetSolid(SOLID_VPHYSICS) - self.NoPlayerCollisions=true + self:PhysicsInitBox(mins, maxs) + self:SetSolid(SOLID_VPHYSICS) + self.NoPlayerCollisions = true self:EnableCustomCollisions(true) self:GetPhysicsObject():EnableMotion(false) - + if CLIENT then - self:SetRenderBounds(mins,maxs) + self:SetRenderBounds(mins, maxs) end end function ENT:OnRemove() - end - function ENT:Think() - if self:GetPos() != self:GetStartPos() then + if self:GetPos() ~= self:GetStartPos() then self:SetStartPos(self:GetPos()) - local ang = (self:GetEndPos()-self:GetStartPos()):Angle() - local mins, maxs = Vector(-8,-8,0), Vector(self:GetStartPos():Distance(self:GetEndPos()), 0, 8) + + local ang = (self:GetEndPos() - self:GetStartPos()):Angle() + local mins, maxs = Vector(-8, -8, 0), Vector(self:GetStartPos():Distance(self:GetEndPos()), 0, 8) + self:SetAngles(ang) + if CLIENT then self:SetRenderAngles(ang) end - self:PhysicsInitBox(mins,maxs) + + self:PhysicsInitBox(mins, maxs) self:SetSolid(SOLID_VPHYSICS) - self.NoPlayerCollisions=true + self.NoPlayerCollisions = true self:EnableCustomCollisions(true) self:GetPhysicsObject():EnableMotion(false) end - self:NextThink(CurTime()+5) + + self:NextThink(CurTime() + 5) + return true end @@ -71,23 +74,28 @@ function ENT:UpdateTransmitState() end local ropemat = Material("cable/cable2") -local color_red = Color(255,0,0) +local color_red = Color(255, 0, 0) + function ENT:Draw() if LocalPlayer():GetGrappling() then local grapplepos = LocalPlayer():GetGrapplePos() - if grapplepos == self:GetStartPos() or grapplepos == self:GetEndPos() then - return - end + + if grapplepos == self:GetStartPos() or grapplepos == self:GetEndPos() then return end end + local mins, maxs = self:GetCollisionBounds() - self:SetRenderBounds(mins,maxs) + + self:SetRenderBounds(mins, maxs) + render.SetMaterial(ropemat) render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_white) end function ENT:DrawLOC() local mins, maxs = self:GetCollisionBounds() - self:SetRenderBounds(mins,maxs) + + self:SetRenderBounds(mins, maxs) + render.SetMaterial(ropemat) render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_red) end \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/entities/entities/br_zipline/shared.lua b/beatrun/gamemodes/beatrun/entities/entities/br_zipline/shared.lua index 5bc8596..2392dc4 100644 --- a/beatrun/gamemodes/beatrun/entities/entities/br_zipline/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/entities/br_zipline/shared.lua @@ -1,68 +1,71 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" -ENT.PrintName = "Zipline" -ENT.Author = "" -ENT.Information = "" - -ENT.Spawnable = true +ENT.Type = "anim" +ENT.Base = "base_entity" +ENT.PrintName = "Zipline" +ENT.Author = "" +ENT.Category = "Beatrun" +ENT.Information = "" +ENT.Spawnable = true ENT.RenderGroup = RENDERGROUP_OPAQUE -ENT.Category = "Beatrun" - AddCSLuaFile() ENT.Model = "models/parkoursource/pipe_standard.mdl" - - ENT.NoClimbing = true function ENT:SetupDataTables() - self:NetworkVar( "Vector", 0, "StartPos" ) - self:NetworkVar( "Vector", 1, "EndPos" ) - self:NetworkVar( "Bool", 0, "TwoWay" ) + self:NetworkVar("Vector", 0, "StartPos") + self:NetworkVar("Vector", 1, "EndPos") + self:NetworkVar("Bool", 0, "TwoWay") end -local spawntr = {} -local spawntrout = {} +-- local spawntr = {} +-- local spawntrout = {} + function ENT:Initialize() self:SetPos(self:GetStartPos()) - self:SetModel(self.Model) - local ang = (self:GetEndPos()-self:GetStartPos()):Angle() - local mins, maxs = Vector(-8,-8,0), Vector(self:GetStartPos():Distance(self:GetEndPos()), 0, 8) + self:SetModel(self.Model) + + local ang = (self:GetEndPos() - self:GetStartPos()):Angle() + local mins, maxs = Vector(-8, -8, 0), Vector(self:GetStartPos():Distance(self:GetEndPos()), 0, 8) + self:SetAngles(ang) - self:PhysicsInitBox(mins,maxs) - self:SetSolid(SOLID_VPHYSICS) - self.NoPlayerCollisions=true + self:PhysicsInitBox(mins, maxs) + self:SetSolid(SOLID_VPHYSICS) + self.NoPlayerCollisions = true self:EnableCustomCollisions(true) self:GetPhysicsObject():EnableMotion(false) - + if CLIENT then - self:SetRenderBounds(mins,maxs) + self:SetRenderBounds(mins, maxs) end end function ENT:OnRemove() - end - function ENT:Think() - if self:GetPos() != self:GetStartPos() then + if self:GetPos() ~= self:GetStartPos() then self:SetStartPos(self:GetPos()) - local ang = (self:GetEndPos()-self:GetStartPos()):Angle() - local mins, maxs = Vector(-8,-8,0), Vector(self:GetStartPos():Distance(self:GetEndPos()), 0, 8) + + local ang = (self:GetEndPos() - self:GetStartPos()):Angle() + local mins, maxs = Vector(-8, -8, 0), Vector(self:GetStartPos():Distance(self:GetEndPos()), 0, 8) + self:SetAngles(ang) + if CLIENT then self:SetRenderAngles(ang) end - self:PhysicsInitBox(mins,maxs) + + self:PhysicsInitBox(mins, maxs) self:SetSolid(SOLID_VPHYSICS) - self.NoPlayerCollisions=true + self.NoPlayerCollisions = true self:EnableCustomCollisions(true) self:GetPhysicsObject():EnableMotion(false) end - self:NextThink(CurTime()+5) + + self:NextThink(CurTime() + 5) + return true end @@ -71,17 +74,22 @@ function ENT:UpdateTransmitState() end local ropemat = Material("cable/cable2") -local color_red = Color(255,0,0) +local color_red = Color(255, 0, 0) + function ENT:Draw() local mins, maxs = self:GetCollisionBounds() - self:SetRenderBounds(mins,maxs) + + self:SetRenderBounds(mins, maxs) + render.SetMaterial(ropemat) render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_white) end function ENT:DrawLOC() local mins, maxs = self:GetCollisionBounds() - self:SetRenderBounds(mins,maxs) + + self:SetRenderBounds(mins, maxs) + render.SetMaterial(ropemat) render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_red) end \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/entities/entities/tt_block/shared.lua b/beatrun/gamemodes/beatrun/entities/entities/tt_block/shared.lua index 15fd11e..d34e6b9 100644 --- a/beatrun/gamemodes/beatrun/entities/entities/tt_block/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/entities/tt_block/shared.lua @@ -1,39 +1,38 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" -ENT.PrintName = "Block" -ENT.Author = "" -ENT.Information = "" - -ENT.Spawnable = true +ENT.Type = "anim" +ENT.Base = "base_entity" +ENT.PrintName = "Block" +ENT.Author = "" +ENT.Category = "Beatrun" +ENT.Information = "" +ENT.Spawnable = true ENT.RenderGroup = RENDERGROUP_OPAQUE -ENT.Category = "Beatrun" - AddCSLuaFile() ENT.Model = "models/hunter/blocks/cube025x025x025.mdl" - local mat -if CLIENT then - mat = CreateMaterial("blockmeasure", "VertexLitGeneric", {["$basetexture"]="dev/dev_measuregeneric01b", ["$basetexturetransform"]="scale 0.5 0.5"}) -end -function ENT:SetupDataTables() +if CLIENT then + mat = CreateMaterial("blockmeasure", "VertexLitGeneric", { + ["$basetexture"] = "dev/dev_measuregeneric01b", + ["$basetexturetransform"] = "scale 0.5 0.5" + }) +end + +function ENT:SetupDataTables() end function ENT:Initialize() self:DrawShadow(false) - self:SetModel(self.Model) - self:SetMoveType(MOVETYPE_NONE) - self:SetSolid(SOLID_BBOX) + self:SetModel(self.Model) + self:SetMoveType(MOVETYPE_NONE) + self:SetSolid(SOLID_BBOX) self:SetCollisionBounds(Vector(-75, -75, 0), Vector(75, 75, 100)) self:AddSolidFlags(FSOLID_CUSTOMRAYTEST) end - function ENT:OnRemove() - end function ENT:DrawTranslucent() @@ -42,25 +41,33 @@ end function ENT:Think() if SERVER then local mins, maxs = self:GetCollisionBounds() + mins:Rotate(self:GetAngles()) maxs:Rotate(self:GetAngles()) + self:SetCollisionBounds(mins, maxs) - self:NextThink(CurTime()+1) + self:NextThink(CurTime() + 1) + return true end end local matrix local vecscale + function ENT:Draw() local mins, maxs = self:GetCollisionBounds() matrix = matrix or Matrix() vecscale = vecscale or Vector() - vecscale:SetUnpacked(maxs.x*0.025, maxs.y*0.025, 0) + + vecscale:SetUnpacked(maxs.x * 0.025, maxs.y * 0.025, 0) matrix:SetScale(vecscale) - mat:SetMatrix("$basetexturetransform",matrix) + + mat:SetMatrix("$basetexturetransform", matrix) + self:SetRenderBounds(mins, maxs) - render.SetColorModulation(1,1,1) + + render.SetColorModulation(1, 1, 1) render.SetMaterial(mat) render.DrawBox(self:GetPos(), self:GetAngles(), mins, maxs, color_white) end \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/entities/entities/tt_cp/shared.lua b/beatrun/gamemodes/beatrun/entities/entities/tt_cp/shared.lua index 2a1fb7b..3d70c90 100644 --- a/beatrun/gamemodes/beatrun/entities/entities/tt_cp/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/entities/tt_cp/shared.lua @@ -1,35 +1,32 @@ -ENT.Type = "anim" -ENT.Base = "base_entity" -ENT.PrintName = "Checkpoint" -ENT.Author = "" -ENT.Information = "" - -ENT.Spawnable = true +ENT.Type = "anim" +ENT.Base = "base_entity" +ENT.PrintName = "Checkpoint" +ENT.Author = "" +ENT.Category = "Beatrun" +ENT.Information = "" +ENT.Spawnable = true ENT.RenderGroup = RENDERGROUP_TRANSLUCENT -ENT.Category = "Beatrun" - AddCSLuaFile() ENT.Model = "models/hunter/blocks/cube025x025x025.mdl" - ENT.IsFinish = false function ENT:SetupDataTables() - - self:NetworkVar( "Int", 0, "CPNum" ) - + self:NetworkVar("Int", 0, "CPNum") end local minb, maxb = Vector(-75, -75, 0), Vector(75, 75, 10000) + function ENT:Initialize() - self:SetModel(self.Model) + self:SetModel(self.Model) self:DrawShadow(false) - self:SetMoveType(MOVETYPE_NONE) - self:SetSolid(SOLID_BBOX) - self:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE) + self:SetMoveType(MOVETYPE_NONE) + self:SetSolid(SOLID_BBOX) + self:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE) self:SetCollisionBounds(minb, maxb) + if CLIENT then self:SetRenderBounds(minb, maxb) self.offset = 0 @@ -41,9 +38,11 @@ function ENT:Initialize() end local screencolor = Color(64, 0, 0, 64) + function ENT:StartTouch(ent) - if ent:IsPlayer() and Course_Name != "" and !ent.BuildMode and ent:GetNW2Int("CPNum", 1) == self:GetCPNum() then + if ent:IsPlayer() and Course_Name ~= "" and not ent.BuildMode and ent:GetNW2Int("CPNum", 1) == self:GetCPNum() then ent:SetNW2Int("CPNum", ent:GetNW2Int("CPNum", 1) + 1) + if ent:GetNW2Int("CPNum", 1) > table.Count(Checkpoints) then ReplayStop(ent) FinishCourse(ent) @@ -51,11 +50,14 @@ function ENT:StartTouch(ent) ent.CPSavePos = ent:GetPos() ent.CPSaveAng = ent:EyeAngles() ent.CPSaveVel = ent:GetVelocity() + ent:SaveParkourState() + net.Start("Checkpoint_Hit") net.WriteUInt(ent:GetNW2Int("CPNum", 1), 8) net.Send(ent) end + ent:ScreenFade(SCREENFADE.IN, screencolor, 0.25, 0) end end @@ -65,57 +67,73 @@ function ENT:UpdateTransmitState() end function ENT:Use(activator, caller, usetype) - end function ENT:OnRemove() - end local radius = 75 local red = Color(255, 0, 0, 200) local circlepos = Vector() -local circleup = Vector(0,0,10000) +local circleup = Vector(0, 0, 10000) + function ENT:DrawTranslucent() self:SetRenderBounds(minb, maxb) - if (!BuildMode and CheckpointNumber != self:GetCPNum()) and !LocalPlayer().InReplay then return end + + if (not BuildMode and CheckpointNumber ~= self:GetCPNum()) and not LocalPlayer().InReplay then return end + render.SetColorMaterial() + red.a = math.Clamp(LocalPlayer():GetPos():Distance(self:GetPos()) * 0.2, 25, 200) - for i=0, 16 do - local angle = i * math.pi*2 / 16 + self.offset - circlepos:SetUnpacked(math.cos(angle)*radius, math.sin(angle)*radius, 0) - local newpos = self:GetPos()+circlepos - render.DrawBeam(newpos, newpos+circleup, 8, 0, 1, red, true) + + for i = 0, 16 do + local angle = i * math.pi * 2 / 16 + self.offset + + circlepos:SetUnpacked(math.cos(angle) * radius, math.sin(angle) * radius, 0) + + local newpos = self:GetPos() + circlepos + + render.DrawBeam(newpos, newpos + circleup, 8, 0, 1, red, true) end + -- local bmin, bmax = self:GetRenderBounds() -- render.DrawWireframeBox(self:GetPos(), angle_zero, bmin, bmax) - self.offset = self.offset + (0.00075) + self.offset = self.offset + 0.00075 + if self.offset >= 180 then self.offset = 0 end end - function ENT:Draw() - end -local circlesprite = Material("circle.png","nocull") +local circlesprite = Material("circle.png", "nocull") + function ENT:DrawLOC() - if (!BuildMode and CheckpointNumber != self:GetCPNum()) and !LocalPlayer().InReplay then return end + if (not BuildMode and CheckpointNumber ~= self:GetCPNum()) and not LocalPlayer().InReplay then return end + render.SetMaterial(circlesprite) + red.a = math.Clamp(LocalPlayer():GetPos():Distance(self:GetPos()) * 0.2, 25, 200) + local f = LocalPlayer():EyeAngles():Forward() - for i=0, 16 do - local angle = i * math.pi*2 / 16 + self.offset - circlepos:SetUnpacked(math.cos(angle)*radius, math.sin(angle)*radius, 0) - local newpos = self:GetPos()+circlepos + + for i = 0, 16 do + local angle = i * math.pi * 2 / 16 + self.offset + + circlepos:SetUnpacked(math.cos(angle) * radius, math.sin(angle) * radius, 0) + + local newpos = self:GetPos() + circlepos -- render.DrawLine(newpos, newpos+VectorRand()*5, red) - render.DrawQuadEasy(newpos,f,6,6,red) + + render.DrawQuadEasy(newpos, f, 6, 6, red) end + -- local bmin, bmax = self:GetRenderBounds() -- render.DrawWireframeBox(self:GetPos(), angle_zero, bmin, bmax) - self.offset = self.offset + (0.00075) + self.offset = self.offset + 0.00075 + if self.offset >= 180 then self.offset = 0 end diff --git a/beatrun/gamemodes/beatrun/entities/weapons/aewep_357.lua b/beatrun/gamemodes/beatrun/entities/weapons/aewep_357.lua index d85da93..f46e3db 100644 --- a/beatrun/gamemodes/beatrun/entities/weapons/aewep_357.lua +++ b/beatrun/gamemodes/beatrun/entities/weapons/aewep_357.lua @@ -1,35 +1,35 @@ -SWEP.ViewModel = "models/weapons/c_357.mdl" -SWEP.WorldModel = "models/weapons/w_357.mdl" +SWEP.ViewModel = "models/weapons/c_357.mdl" +SWEP.WorldModel = "models/weapons/w_357.mdl" -SWEP.Weight = 5 -SWEP.AutoSwitchTo = false -SWEP.AutoSwitchFrom = false +SWEP.Weight = 5 +SWEP.AutoSwitchTo = false +SWEP.AutoSwitchFrom = false -SWEP.Slot = 1 -SWEP.SlotPos = 2 -SWEP.DrawAmmo = true -SWEP.DrawCrosshair = true +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.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.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 = "357" -- This will be shown in the spawn menu, and in the weapon selection menu -SWEP.Author = "datae" -- These two options will be shown when you have the weapon highlighted in the weapon selection menu -SWEP.Instructions = "" +SWEP.PrintName = "357" +SWEP.Author = "datae" +SWEP.Instructions = "" SWEP.BulletData = {} SWEP.Damage = 150 @@ -67,173 +67,172 @@ 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) +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 + 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) + 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.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) + VMPosOffset_Lerp.x = Lerp(8 * FT, VMPosOffset_Lerp.x, VMPosOffset.x) + VMPosOffset_Lerp.y = Lerp(8 * FT, VMPosOffset_Lerp.y, VMPosOffset.y) - VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x) - VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y) - - VMAng:Add(VMAngOffset_Lerp) - + 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, VMAngOffset_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) +local stepend = math.pi * 4 - 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) +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 !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 ) + 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 !IsValid(owner) then return end - local sightedmult = 1 - - self.Breath_Intensity = self.Breath_Intensity * sightedmult + 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) - + 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) + local VMPos, VMAng = self.VMPos, self.VMAng + local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset + local FT = FrameTime() + local sightedmult = 1 - VMPosOffset.x = -self.SmoothEyeAng.x * -1 * sightedmult - VMPosOffset.y = self.SmoothEyeAng.y * 0.5 * sightedmult + self.SmoothEyeAng = LerpAngle(0.05, self.SmoothEyeAng, EyeAng - self.LastEyeAng) - 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) - + 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 + 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" ) - + self:SetNextPrimaryFire(CurTime() + 0.5) + self:SetHoldType("revolver") + if CLIENT then self.CLVM = ClientsideModel(self.ViewModel) self:SetNoDraw(true) @@ -244,6 +243,7 @@ function SWEP:Holster() if IsValid(self.CLVM) then self.CLVM:Remove() end + return true end @@ -255,22 +255,23 @@ end function SWEP:GenerateBullet() local tbl = self.BulletData - tbl.Attacker = self.Owner + 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.Owner:GetShootPos() - tbl.Dir = self.Owner:EyeAngles():Forward() + tbl.Src = self:GetOwner():GetShootPos() + tbl.Dir = self:GetOwner():EyeAngles():Forward() + return tbl end function SWEP:MuzzleFlash() - local vPoint = self.Owner:EyePos()+self.Owner:EyeAngles():Forward()*10 + local vPoint = self:GetOwner():EyePos() + self:GetOwner():EyeAngles():Forward() * 10 local ed = EffectData() - ed:SetOrigin( vPoint ) + + ed:SetOrigin(vPoint) ed:SetScale(1) ed:SetEntity(self) end @@ -280,11 +281,15 @@ function SWEP:DryFire() end function SWEP:Reload() - if self:Clip1() >= self:GetMaxClip1() or self.Owner:GetAmmoCount( self.Primary.Ammo ) <= 0 then return end + 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.Owner:GetViewModel():SequenceDuration() + + 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") @@ -299,47 +304,52 @@ 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 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) - local offsetpos, offsetang = 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.Owner: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.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) - -- self:PostDrawViewModel(vm, wep, ply) return true end -hook.Add("PreDrawTranslucentRenderables","ae", function() +-- 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 @@ -348,33 +358,36 @@ end) hook.Add("VManipVMEntity", "ae", function() local ply = LocalPlayer() local activewep = ply:GetActiveWeapon() - if activewep.CLVM then - return activewep.CLVM - end + + 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 + + if activewep.CLVM then return activewep.CLVM end end) function SWEP:PrimaryAttack() if self:Clip1() < 1 then self:DryFire() - self:SetNextPrimaryFire(CurTime()+1) + self:SetNextPrimaryFire(CurTime() + 1) + return end - self:SetClip1(self:Clip1()-1) - self.Owner:MuzzleFlash() + + self:SetClip1(self:Clip1() - 1) + self:GetOwner():MuzzleFlash() self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) - self:SetNextPrimaryFire(CurTime()+0.65) + self:SetNextPrimaryFire(CurTime() + 0.65) self:EmitSound("Weapon_357.Single") - self:FireBullets( self:GenerateBullet() ) - self.Owner:ViewPunch(Angle(-10,0,0)) + self:FireBullets(self:GenerateBullet()) + self:GetOwner():ViewPunch(Angle(-10, 0, 0)) + return true end + function SWEP:SecondaryAttack() return true end \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/entities/weapons/aewep_base.lua b/beatrun/gamemodes/beatrun/entities/weapons/aewep_base.lua index 40c41e1..2230443 100644 --- a/beatrun/gamemodes/beatrun/entities/weapons/aewep_base.lua +++ b/beatrun/gamemodes/beatrun/entities/weapons/aewep_base.lua @@ -1,35 +1,35 @@ -SWEP.ViewModel = "models/weapons/c_smg1.mdl" -SWEP.WorldModel = "models/weapons/w_357.mdl" +SWEP.ViewModel = "models/weapons/c_smg1.mdl" +SWEP.WorldModel = "models/weapons/w_357.mdl" -SWEP.Weight = 5 -SWEP.AutoSwitchTo = false -SWEP.AutoSwitchFrom = false +SWEP.Weight = 5 +SWEP.AutoSwitchTo = false +SWEP.AutoSwitchFrom = false -SWEP.Slot = 1 -SWEP.SlotPos = 2 -SWEP.DrawAmmo = true -SWEP.DrawCrosshair = true +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.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.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 = "AE" -- This will be shown in the spawn menu, and in the weapon selection menu -SWEP.Author = "datae" -- These two options will be shown when you have the weapon highlighted in the weapon selection menu -SWEP.Instructions = "" +SWEP.PrintName = "AE" +SWEP.Author = "datae" +SWEP.Instructions = "" SWEP.BulletData = {} SWEP.Damage = 15 @@ -68,210 +68,212 @@ SWEP.OffsetAng = Angle() local coolswayCT = 0 local oldCT = 0 -local function LerpC(t,a,b,powa) - -return a + (b - a) * math.pow(t,powa) +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 + 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) + 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.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) - 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) + VMAngOffset.x = math.Clamp(VMPosOffset.x * 8, -4, 4) + VMAngOffset.y = VMPosOffset.y * -1 + VMAngOffset.z = VMPosOffset.y * 0.5 + (VMPosOffset.x * -5) - VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x) - VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y) - - VMAng:Add(VMAngOffset_Lerp) - + 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, VMAngOffset_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) +local stepend = math.pi * 4 - 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) +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 !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 ) + 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 !IsValid(owner) then return end - local sightedmult = 1 - - self.Breath_Intensity = self.Breath_Intensity * sightedmult + 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) - + 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) + local VMPos, VMAng = self.VMPos, self.VMAng + local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset + local FT = FrameTime() + local sightedmult = 1 - VMPosOffset.x = -self.SmoothEyeAng.x * -1 * sightedmult - VMPosOffset.y = self.SmoothEyeAng.y * 0.5 * sightedmult + self.SmoothEyeAng = LerpAngle(FT * 5, self.SmoothEyeAng, EyeAng - self.LastEyeAng) - 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) - + 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, offsetang = LocalToWorld(self.OffsetPos, self.OffsetAng, self.VMPos, self.VMAng) + 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 + + 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:SetNextPrimaryFire(CurTime() + 0.5) end function SWEP:GenerateBullet() local tbl = self.BulletData - tbl.Attacker = self.Owner + 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.Owner:GetShootPos() - tbl.Dir = self.Owner:EyeAngles():Forward() + 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.Owner:EyePos()+self.Owner:EyeAngles():Forward()*10 + local vPoint = self:GetOwner():EyePos() + self:GetOwner():EyeAngles():Forward() * 10 local ed = EffectData() - ed:SetOrigin( vPoint ) + + ed:SetOrigin(vPoint) ed:SetScale(1) ed:SetEntity(self) - util.Effect( "arccw_shelleffect", ed ) + + util.Effect("arccw_shelleffect", ed) end function SWEP:DryFire() @@ -279,10 +281,13 @@ function SWEP:DryFire() end function SWEP:Reload() - if self:Clip1() >= self:GetMaxClip1() or self.Owner:GetAmmoCount( self.Primary.Ammo ) <= 0 then return end + 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.Owner:GetViewModel():SequenceDuration() + + self:DefaultReload(ACT_VM_RELOAD) + + local AnimationTime = self:GetOwner():GetViewModel():SequenceDuration() + self.ReloadTime = CurTime() + AnimationTime self:SetNextPrimaryFire(CurTime() + AnimationTime) self:SetNextSecondaryFire(CurTime() + AnimationTime) @@ -292,19 +297,26 @@ end function SWEP:PrimaryAttack() if self:Clip1() < 1 then self:DryFire() - self:SetNextPrimaryFire(CurTime()+0.5) + self:SetNextPrimaryFire(CurTime() + 0.5) + return end - self:SetClip1(self:Clip1()-1) - self.Owner:MuzzleFlash() + + self:SetClip1(self:Clip1() - 1) + self:GetOwner():MuzzleFlash() self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) - self:SetNextPrimaryFire(CurTime()+0.065) + self:SetNextPrimaryFire(CurTime() + 0.065) self:EmitSound("weapons/smg1/smg1_fire1.wav") - self:FireBullets( self:GenerateBullet() ) - self.Owner:ViewPunch(Angle(-0.1,0,0)) - if IsFirstTimePredicted() then self:MuzzleFlash() end + 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 \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/entities/weapons/aewep_nt.lua b/beatrun/gamemodes/beatrun/entities/weapons/aewep_nt.lua index 61a66c4..755d4b2 100644 --- a/beatrun/gamemodes/beatrun/entities/weapons/aewep_nt.lua +++ b/beatrun/gamemodes/beatrun/entities/weapons/aewep_nt.lua @@ -1,35 +1,35 @@ -SWEP.ViewModel = "models/weapons/v_jinrai_srm_s.mdl" -SWEP.WorldModel = "models/weapons/w_357.mdl" +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.Weight = 5 +SWEP.AutoSwitchTo = false +SWEP.AutoSwitchFrom = false -SWEP.Slot = 1 -SWEP.SlotPos = 2 -SWEP.DrawAmmo = true -SWEP.DrawCrosshair = true +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.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.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 = "AE" -- This will be shown in the spawn menu, and in the weapon selection menu -SWEP.Author = "datae" -- These two options will be shown when you have the weapon highlighted in the weapon selection menu -SWEP.Instructions = "" +SWEP.PrintName = "AE" +SWEP.Author = "datae" +SWEP.Instructions = "" SWEP.BulletData = {} SWEP.Damage = 15 @@ -62,216 +62,219 @@ SWEP.VelocityLastDiff = 0 SWEP.Breath_Intensity = 1 SWEP.Breath_Rate = 1 -SWEP.OffsetPos = Vector(10,-10,0) --NT +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) +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 + 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) + 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.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) - 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) + VMAngOffset.x = math.Clamp(VMPosOffset.x * 8, -4, 4) + VMAngOffset.y = VMPosOffset.y * -1 + VMAngOffset.z = VMPosOffset.y * 0.5 + (VMPosOffset.x * -5) - VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x) - VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y) - - VMAng:Add(VMAngOffset_Lerp) - + 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, VMAngOffset_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) +local stepend = math.pi * 4 - 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) +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 !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 ) + 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 !IsValid(owner) then return end - local sightedmult = 1 - - self.Breath_Intensity = self.Breath_Intensity * sightedmult + 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) - + 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) + local VMPos, VMAng = self.VMPos, self.VMAng + local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset + local FT = FrameTime() + local sightedmult = 1 - VMPosOffset.x = -self.SmoothEyeAng.x * -1 * sightedmult - VMPosOffset.y = self.SmoothEyeAng.y * 0.5 * sightedmult + self.SmoothEyeAng = LerpAngle(FT * 5, self.SmoothEyeAng, EyeAng - self.LastEyeAng) - 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) - + 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, offsetang = LocalToWorld(self.OffsetPos, self.OffsetAng, self.VMPos, self.VMAng) + 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 + + 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) + self:SetNextPrimaryFire(CurTime() + 0.5) end function SWEP:GenerateBullet() local tbl = self.BulletData - tbl.Attacker = self.Owner + 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.Owner:GetShootPos() - tbl.Dir = self.Owner:GetEyeTrace().Normal + 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.Owner:EyePos()+self.Owner:EyeAngles():Forward()*10 + local vPoint = self:GetOwner():EyePos() + self:GetOwner():EyeAngles():Forward() * 10 local ed = EffectData() - ed:SetOrigin( vPoint ) + + ed:SetOrigin(vPoint) ed:SetScale(1) ed:SetEntity(self) - util.Effect( "arccw_shelleffect", ed ) + + util.Effect("arccw_shelleffect", ed) end function SWEP:DryFire() @@ -279,10 +282,13 @@ function SWEP:DryFire() end function SWEP:Reload() - if self:Clip1() >= self:GetMaxClip1() or self.Owner:GetAmmoCount( self.Primary.Ammo ) <= 0 then return end + 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.Owner:GetViewModel():SequenceDuration() + + self:DefaultReload(ACT_VM_RELOAD) + + local AnimationTime = self:GetOwner():GetViewModel():SequenceDuration() + self.ReloadTime = CurTime() + AnimationTime self:SetNextPrimaryFire(CurTime() + AnimationTime) self:SetNextSecondaryFire(CurTime() + AnimationTime) @@ -292,19 +298,26 @@ end function SWEP:PrimaryAttack() if self:Clip1() < 1 then self:DryFire() - self:SetNextPrimaryFire(CurTime()+0.5) + self:SetNextPrimaryFire(CurTime() + 0.5) + return end - self:SetClip1(self:Clip1()-1) - self.Owner:MuzzleFlash() + + self:SetClip1(self:Clip1() - 1) + self:GetOwner():MuzzleFlash() self:SendWeaponAnim(ACT_VM_PRIMARYATTACK) - self:SetNextPrimaryFire(CurTime()+0.065) + self:SetNextPrimaryFire(CurTime() + 0.065) self:EmitSound("weapons/smg1/smg1_fire1.wav") - self:FireBullets( self:GenerateBullet() ) - self.Owner:ViewPunch(Angle(-0.1,0,0)) - if IsFirstTimePredicted() then self:MuzzleFlash() end + 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 \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/entities/weapons/shapedrawer/shared.lua b/beatrun/gamemodes/beatrun/entities/weapons/shapedrawer/shared.lua index 4520a63..15eb7d4 100644 --- a/beatrun/gamemodes/beatrun/entities/weapons/shapedrawer/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/weapons/shapedrawer/shared.lua @@ -1,4 +1,4 @@ -SWEP.PrintName = "X" +SWEP.PrintName = "X" SWEP.Slot = 0 SWEP.SlotPos = 1 SWEP.DrawAmmo = false @@ -14,13 +14,13 @@ SWEP.BounceWeaponIcon = false SWEP.DrawWeaponInfoBox = false SWEP.HoldType = "crossbow" - + SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.Category = "Beatrun" - -SWEP.UseHands = true - + +SWEP.UseHands = true + SWEP.ViewModel = "models/weapons/c_pistol.mdl" SWEP.WorldModel = "models/weapons/w_crossbow.mdl" @@ -30,7 +30,7 @@ SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "none" - + SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false @@ -74,7 +74,7 @@ function SWEP:PrimaryAttack() table.insert(self.points, ply:EyePos()+ply:EyeAngles():Forward()*50) end end - + function SWEP:SecondaryAttack() self:CallOnClient("SecondaryAttack") @@ -84,7 +84,7 @@ end hook.Add("PostDrawTranslucentRenderables","ShapeGun",function() local ply = Entity(1) - local wep = ply:GetActiveWeapon() + local wep = ply:GetActiveWeapon() or nil if IsValid(wep) and wep:GetClass()=="shapedrawer" then for k,v in ipairs(wep.points) do render.DrawWireframeBox(v,angle_zero,Vector(-1,-1,-1),Vector(1,1,1)) diff --git a/beatrun/gamemodes/beatrun/entities/weapons/ziplinegun/shared.lua b/beatrun/gamemodes/beatrun/entities/weapons/ziplinegun/shared.lua index df411e7..4b8e9bc 100644 --- a/beatrun/gamemodes/beatrun/entities/weapons/ziplinegun/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/weapons/ziplinegun/shared.lua @@ -1,46 +1,45 @@ -SWEP.PrintName = "Zipline Gun" -SWEP.Slot = 0 -SWEP.SlotPos = 1 -SWEP.DrawAmmo = false -SWEP.DrawCrosshair = true +SWEP.PrintName = "Zipline Gun" +SWEP.Slot = 0 +SWEP.SlotPos = 1 +SWEP.DrawAmmo = false +SWEP.DrawCrosshair = true - -SWEP.Author = "" -SWEP.Contact = "" -SWEP.Purpose = "" -SWEP.Instructions = "" +SWEP.Author = "" +SWEP.Contact = "" +SWEP.Purpose = "" +SWEP.Instructions = "" SWEP.BounceWeaponIcon = false SWEP.DrawWeaponInfoBox = false SWEP.HoldType = "crossbow" - -SWEP.Spawnable = true -SWEP.AdminSpawnable = true + +SWEP.Spawnable = true +SWEP.AdminSpawnable = true SWEP.Category = "Beatrun" - -SWEP.UseHands = true - -SWEP.ViewModel = "models/weapons/c_crossbow.mdl" -SWEP.WorldModel = "models/weapons/w_crossbow.mdl" -SWEP.ViewModelFOV=75 --65 75 +SWEP.UseHands = true -SWEP.Primary.ClipSize = -1 -SWEP.Primary.DefaultClip = -1 -SWEP.Primary.Automatic = false -SWEP.Primary.Ammo = "none" - -SWEP.Secondary.ClipSize = -1 -SWEP.Secondary.DefaultClip = -1 -SWEP.Secondary.Automatic = false -SWEP.Secondary.Ammo = "none" +SWEP.ViewModel = "models/weapons/c_crossbow.mdl" +SWEP.WorldModel = "models/weapons/w_crossbow.mdl" + +SWEP.ViewModelFOV = 75 -- 65 + +SWEP.Primary.ClipSize = -1 +SWEP.Primary.DefaultClip = -1 +SWEP.Primary.Automatic = false +SWEP.Primary.Ammo = "none" + +SWEP.Secondary.ClipSize = -1 +SWEP.Secondary.DefaultClip = -1 +SWEP.Secondary.Automatic = false +SWEP.Secondary.Ammo = "none" function SWEP:SetupDataTables() end function SWEP:Deploy() - self:SetHoldType( self.HoldType ) + self:SetHoldType(self.HoldType) self:SendWeaponAnim(ACT_VM_DRAW) end @@ -48,10 +47,8 @@ function SWEP:Initialize() end function SWEP:Think() - end - function SWEP:Holster() return true end @@ -63,13 +60,15 @@ function SWEP:Reload() end function SWEP:PrimaryAttack() - local ply = self.Owner + local ply = self:GetOwner() + if SERVER then CreateZipline(ply:EyePos(), ply:GetEyeTrace().HitPos) end end - function SWEP:SecondaryAttack() - + -- for k, v in pairs(ziplines) do + -- v:Remove() + -- end end \ No newline at end of file diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Checkpoints.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Checkpoints.lua index 453a57a..7eb777f 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Checkpoints.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Checkpoints.lua @@ -129,7 +129,7 @@ if CLIENT then LocalPlayer():EmitSound("A_TT_Finish_Positive.wav") SaveCheckpointTime() - SaveReplayData() + -- SaveReplayData() else timetext = "+" .. string.FormattedTime(math.abs(timestr), "%02i:%02i:%02i") timecolor = color_negative @@ -300,13 +300,13 @@ function LoadCheckpointTime() end function SaveReplayData() - local replay = util.TableToJSON(LocalPlayer().ReplayTicks) + local replay = util.Compress(util.TableToJSON(LocalPlayer().ReplayTicks)) local dir = "beatrun/replays/" .. game.GetMap() .. "/" if not replay then return end file.CreateDir(dir) - file.Write(dir .. Course_ID .. ".txt", util.Compress(replay)) + file.Write(dir .. Course_ID .. ".txt", replay) end function LoadReplayData() diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Sliding.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Sliding.lua index 6df770b..c733de5 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Sliding.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Sliding.lua @@ -673,6 +673,7 @@ hook.Add("StartCommand", "qslidespeed", function(ply, cmd) end cmd:ClearMovement() + local slidetime = math.max(0.1, qslide_duration) if (ply:GetSlidingTime() - CurTime()) / slidetime > 0.8 and (ply.SlidingInitTime > CurTime() - 0.25 or ply:GetSlidingSlippery()) then diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/sh_buildmode.lua b/beatrun/gamemodes/beatrun/gamemode/sh/sh_buildmode.lua index c4e6096..270430c 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/sh_buildmode.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/sh_buildmode.lua @@ -936,6 +936,7 @@ if CLIENT then local jsonsave = util.TableToJSON(save) local crc = util.CRC(jsonsave) local dir = "beatrun/courses/" .. game.GetMap() .. "/" + compress = compress or true file.CreateDir(dir) @@ -1620,7 +1621,7 @@ if CLIENT then gui.EnableScreenClicker(false) - LocalPlayer():SetFOV(LocalPlayer():GetInfoNum("Beatrun_FOV")) + LocalPlayer():SetFOV(0) CheckpointNumber = 1 diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/sh_freerunsysall.lua b/beatrun/gamemodes/beatrun/gamemode/sh/sh_freerunsysall.lua index 45bba5b..3adf212 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/sh_freerunsysall.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/sh_freerunsysall.lua @@ -1,6 +1,6 @@ local quakejump = CreateConVar("Beatrun_QuakeJump", 1, {FCVAR_REPLICATED, FCVAR_ARCHIVE}) - local sidestep = CreateConVar("Beatrun_SideStep", 1, {FCVAR_REPLICATED, FCVAR_ARCHIVE}) +local max_speed = CreateConVar("Beatrun_MaxSpeed", 325, {FCVAR_REPLICATED, FCVAR_ARCHIVE}) local function Hardland(jt) local ply = LocalPlayer() @@ -230,8 +230,8 @@ hook.Add("SetupMove", "MESetupMove", function(ply, mv, cmd) ply.FootstepLand = true end - if ply:GetRunSpeed() ~= 325 * ply:GetOverdriveMult() then - ply:SetRunSpeed(325 * ply:GetOverdriveMult()) + if ply:GetRunSpeed() ~= max_speed:GetInt() * ply:GetOverdriveMult() then + ply:SetRunSpeed(max_speed:GetInt() * ply:GetOverdriveMult()) end if not ply:GetMEMoveLimit() then @@ -275,9 +275,9 @@ hook.Add("SetupMove", "MESetupMove", function(ply, mv, cmd) mult = mult * ply:GetMEMoveLimit() / 1000 end - ply:SetMEMoveLimit(math.Clamp(ply:GetMEMoveLimit() + mult * ply:GetOverdriveMult() * 2, 0, 325 * ply:GetOverdriveMult())) + ply:SetMEMoveLimit(math.Clamp(ply:GetMEMoveLimit() + mult * ply:GetOverdriveMult() * 2, 0, max_speed:GetInt() * ply:GetOverdriveMult())) elseif not ismoving and (not ply:Crouching() or ply:GetCrouchJump()) or CurTime() < ply:GetMESprintDelay() and ply:OnGround() then - ply:SetMEMoveLimit(math.Clamp(ply:GetMEMoveLimit() - 40, weaponspeed, 325 * ply:GetOverdriveMult())) + ply:SetMEMoveLimit(math.Clamp(ply:GetMEMoveLimit() - 40, weaponspeed, max_speed:GetInt() * ply:GetOverdriveMult())) end if MEAngDiff > 1.25 and ply:GetWallrun() == 0 then diff --git a/lua/bin/gmcl_gdiscord_win64.dll b/lua/bin/gmcl_gdiscord_win64.dll new file mode 100644 index 0000000..2df989b Binary files /dev/null and b/lua/bin/gmcl_gdiscord_win64.dll differ