mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-28 12:53:02 +05:00
Cleanup and fixes
This commit is contained in:
parent
7fcd3cdaa1
commit
95792dbc13
24 changed files with 1273 additions and 1144 deletions
24
FIXES.md
24
FIXES.md
|
@ -1,13 +1,13 @@
|
||||||
# Сделанные мной фиксы и добавления
|
# Добавлено мной
|
||||||
* Разрешение Overdrive на сервере - *Beatrun_AllowOvedriveInMultiplayer*.
|
* Разрешение Overdrive на сервере - *Beatrun_AllowOvedriveInMultiplayer*.
|
||||||
* Небольшой толчёк камеры при нырянии.
|
* Измение цвета худа - *Beatrun_HUDTextColor*, *Beatrun_HUDCornerColor*, *Beatrun_HUDFloatingXPColor*.
|
||||||
* Discord Rich Presence
|
* Discord Rich Presence (Нужен модуль из lua/bin)
|
||||||
* Измение цвета худа - *Beatrun_HUDTextColor*, *Beatrun_HUDCornerColor*, *Beatrun_HUDFloatingXPColor*
|
* Небольшой толчок камеры при нырянии.
|
||||||
<br>
|
* Изменение максимальной скорости - *Beatrun_MaxSpeed* (Спасибо c4nk, я слепой).
|
||||||
* Фикс трёх букв из-за которых нихуя не работало.
|
* Возможность удалять зиплайны от Zipline Gun на ПКМ. (Завтра доделаю)
|
||||||
* Быстрый поворот на земле (ПКМ пока бежишь/стоишь) включён по умолчанию (Beatrun_QuickturnGround).
|
|
||||||
* Быстрый поворот только с руками бегуна (Фикс поворотов при прицеливании и т.п.).
|
# Фиксы с предыдущей версии
|
||||||
* Фикс ошибки запуска курса.
|
* Выключил обратно быстрый разворот, хуйня (Чтобы откатить напишите **Beatrun_QuickturnGround 0** в консоль).
|
||||||
* Фикс использования хука (пробел по стене когда вы в воздухе).
|
* Фикс незакрытия меню постройки.
|
||||||
* Фикс сортировки таблицы лидеров.
|
* Фикс сохранения курсов.
|
||||||
* Убрал ваш SteamID в углу потому что могу.
|
* Отключены реплеи до фикса.
|
|
@ -1,56 +1,58 @@
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
ENT.Base = "base_entity"
|
ENT.Base = "base_entity"
|
||||||
ENT.PrintName = "Data Cube"
|
ENT.PrintName = "Data Cube"
|
||||||
ENT.Author = ""
|
ENT.Author = ""
|
||||||
ENT.Information = ""
|
|
||||||
|
|
||||||
ENT.Spawnable = true
|
|
||||||
|
|
||||||
|
ENT.Category = "Beatrun"
|
||||||
|
ENT.Information = ""
|
||||||
|
ENT.Spawnable = true
|
||||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||||
|
|
||||||
ENT.Category = "Beatrun"
|
|
||||||
|
|
||||||
AddCSLuaFile()
|
AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Model = "models/hunter/blocks/cube05x05x05.mdl"
|
ENT.Model = "models/hunter/blocks/cube05x05x05.mdl"
|
||||||
ENT.DataCube = true
|
ENT.DataCube = true
|
||||||
|
|
||||||
local color_green = Color(0,255,0)
|
local color_green = Color(0, 255, 0)
|
||||||
|
|
||||||
function ENT:Initialize()
|
function ENT:Initialize()
|
||||||
self:SetModel(self.Model)
|
self:SetModel(self.Model)
|
||||||
self:SetSolid(SOLID_VPHYSICS)
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||||
self:SetCollisionBounds(Vector(-20,-20,-15), Vector(20,20,30))
|
self:SetCollisionBounds(Vector(-20, -20, -15), Vector(20, 20, 30))
|
||||||
|
|
||||||
if SERVER then
|
if SERVER then
|
||||||
self:PhysicsInit(SOLID_VPHYSICS)
|
self:PhysicsInit(SOLID_VPHYSICS)
|
||||||
local randvec = VectorRand()*200
|
|
||||||
|
local randvec = VectorRand() * 200
|
||||||
randvec.z = math.abs(randvec.z)
|
randvec.z = math.abs(randvec.z)
|
||||||
|
|
||||||
self:SetTrigger(true)
|
self:SetTrigger(true)
|
||||||
self:GetPhysicsObject():SetVelocity(randvec)
|
self:GetPhysicsObject():SetVelocity(randvec)
|
||||||
end
|
end
|
||||||
|
|
||||||
self:SetColor(color_green)
|
self:SetColor(color_green)
|
||||||
self:SetCustomCollisionCheck(true)
|
self:SetCustomCollisionCheck(true)
|
||||||
end
|
end
|
||||||
hook.Add( "ShouldCollide", "DataCubeCollisions", function( ent1, ent2 )
|
|
||||||
|
|
||||||
-- If players are about to collide with each other, then they won't collide.
|
hook.Add("ShouldCollide", "DataCubeCollisions", function(ent1, ent2)
|
||||||
if ( ent1.DataCube and ent2.DataCube ) then return false end
|
-- 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)
|
function ENT:StartTouch(ent)
|
||||||
if ent:IsPlayer() then
|
if ent:IsPlayer() then
|
||||||
ent:SetNW2Int("DataCubes", ent:GetNW2Int("DataCubes", 0)+1)
|
ent:SetNW2Int("DataCubes", ent:GetNW2Int("DataCubes", 0) + 1)
|
||||||
self:EmitSound("A_TT_Stars.wav", 75, 100+math.random(-10,5))
|
|
||||||
|
self:EmitSound("A_TT_Stars.wav", 75, 100 + math.random(-10, 5))
|
||||||
self:Remove()
|
self:Remove()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:Touch(ent)
|
function ENT:Touch(ent)
|
||||||
if ent:IsPlayer() then
|
if ent:IsPlayer() then return end
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:Think()
|
function ENT:Think()
|
||||||
|
@ -58,21 +60,20 @@ function ENT:Think()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:Use(activator, caller, usetype)
|
function ENT:Use(activator, caller, usetype)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:OnRemove()
|
function ENT:OnRemove()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local spinang = Angle(0,1,0)
|
local spinang = Angle(0, 1, 0)
|
||||||
|
|
||||||
function ENT:DrawTranslucent()
|
function ENT:DrawTranslucent()
|
||||||
local curang = self:GetRenderAngles() or Angle()
|
local curang = self:GetRenderAngles() or Angle()
|
||||||
curang:Add(spinang)
|
curang:Add(spinang)
|
||||||
|
|
||||||
self:SetRenderAngles(curang)
|
self:SetRenderAngles(curang)
|
||||||
self:DrawModel()
|
self:DrawModel()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ENT:Draw()
|
function ENT:Draw()
|
||||||
end
|
end
|
|
@ -1,63 +1,58 @@
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
ENT.Base = "base_entity"
|
ENT.Base = "base_entity"
|
||||||
ENT.PrintName = "Hook Point"
|
ENT.PrintName = "Hook Point"
|
||||||
ENT.Author = ""
|
ENT.Author = ""
|
||||||
ENT.Information = ""
|
ENT.Category = "Beatrun"
|
||||||
|
|
||||||
ENT.Spawnable = true
|
|
||||||
|
|
||||||
|
ENT.Information = ""
|
||||||
|
ENT.Spawnable = true
|
||||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||||
|
|
||||||
ENT.Category = "Beatrun"
|
|
||||||
|
|
||||||
AddCSLuaFile()
|
AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Model = "models/Roller.mdl"
|
ENT.Model = "models/Roller.mdl"
|
||||||
ENT.HookPoint = true
|
ENT.HookPoint = true
|
||||||
|
|
||||||
local color_green = Color(0,255,0)
|
-- local color_green = Color(0, 255, 0)
|
||||||
|
|
||||||
function ENT:Initialize()
|
function ENT:Initialize()
|
||||||
self:SetModel(self.Model)
|
self:SetModel(self.Model)
|
||||||
self:SetSolid(SOLID_VPHYSICS)
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||||
|
|
||||||
local mins, maxs = self:GetCollisionBounds()
|
local mins, maxs = self:GetCollisionBounds()
|
||||||
|
|
||||||
self:PhysicsInitBox(mins, maxs)
|
self:PhysicsInitBox(mins, maxs)
|
||||||
|
self:SetMoveType(MOVETYPE_NONE)
|
||||||
-- Set up solidity and movetype
|
|
||||||
self:SetMoveType( MOVETYPE_NONE )
|
|
||||||
self:GetPhysicsObject():EnableMotion(false)
|
self:GetPhysicsObject():EnableMotion(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ENT:Think()
|
function ENT:Think()
|
||||||
if SERVER then
|
if SERVER then
|
||||||
self:NextThink(CurTime()+1)
|
self:NextThink(CurTime() + 1)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if ( CLIENT ) then
|
if CLIENT then
|
||||||
local physobj = self:GetPhysicsObject()
|
local physobj = self:GetPhysicsObject()
|
||||||
|
|
||||||
if ( IsValid( physobj ) ) then
|
if IsValid(physobj) then
|
||||||
physobj:SetPos( self:GetPos() )
|
physobj:SetPos(self:GetPos())
|
||||||
physobj:SetAngles( self:GetAngles() )
|
physobj:SetAngles(self:GetAngles())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:Use(activator, caller, usetype)
|
function ENT:Use(activator, caller, usetype)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:OnRemove()
|
function ENT:OnRemove()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:DrawTranslucent()
|
function ENT:DrawTranslucent()
|
||||||
self:DrawModel()
|
self:DrawModel()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ENT:Draw()
|
function ENT:Draw()
|
||||||
end
|
end
|
|
@ -1,33 +1,31 @@
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
ENT.Base = "base_entity"
|
ENT.Base = "base_entity"
|
||||||
ENT.PrintName = "Intel Marker"
|
ENT.PrintName = "Intel Marker"
|
||||||
ENT.Author = ""
|
ENT.Author = ""
|
||||||
ENT.Information = ""
|
ENT.Category = "Beatrun"
|
||||||
|
|
||||||
ENT.Spawnable = true
|
|
||||||
|
|
||||||
|
ENT.Information = ""
|
||||||
|
ENT.Spawnable = true
|
||||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||||
|
|
||||||
ENT.Category = "Beatrun"
|
|
||||||
|
|
||||||
AddCSLuaFile()
|
AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Model = "models/hunter/blocks/cube025x025x025.mdl"
|
ENT.Model = "models/hunter/blocks/cube025x025x025.mdl"
|
||||||
|
|
||||||
function ENT:SetupDataTables()
|
function ENT:SetupDataTables()
|
||||||
|
self:NetworkVar("Int", 0, "Score")
|
||||||
self:NetworkVar( "Int", 0, "Score" )
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local minb, maxb = Vector(-40, -40, 0), Vector(40, 40, 64)
|
local minb, maxb = Vector(-40, -40, 0), Vector(40, 40, 64)
|
||||||
|
|
||||||
function ENT:Initialize()
|
function ENT:Initialize()
|
||||||
self:SetModel(self.Model)
|
self:SetModel(self.Model)
|
||||||
self:DrawShadow(false)
|
self:DrawShadow(false)
|
||||||
self:SetMoveType(MOVETYPE_NONE)
|
self:SetMoveType(MOVETYPE_NONE)
|
||||||
self:SetSolid(SOLID_BBOX)
|
self:SetSolid(SOLID_BBOX)
|
||||||
self:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE)
|
self:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE)
|
||||||
self:SetCollisionBounds(minb, maxb)
|
self:SetCollisionBounds(minb, maxb)
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
self:SetRenderBounds(minb, maxb)
|
self:SetRenderBounds(minb, maxb)
|
||||||
self.offset = 0
|
self.offset = 0
|
||||||
|
@ -37,8 +35,7 @@ function ENT:Initialize()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:StartTouch(ent)
|
function ENT:StartTouch(ent)
|
||||||
if ent:IsPlayer() then
|
if ent:IsPlayer() then return end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:UpdateTransmitState()
|
function ENT:UpdateTransmitState()
|
||||||
|
@ -46,37 +43,41 @@ function ENT:UpdateTransmitState()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:Use(activator, caller, usetype)
|
function ENT:Use(activator, caller, usetype)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:OnRemove()
|
function ENT:OnRemove()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local radius = 35
|
local radius = 35
|
||||||
local red = Color(100, 255, 0, 125)
|
local red = Color(100, 255, 0, 125)
|
||||||
local circlepos = Vector()
|
local circlepos = Vector()
|
||||||
local circleup = Vector(0,0,40)
|
local circleup = Vector(0, 0, 40)
|
||||||
local msin = math.sin
|
-- local msin = math.sin
|
||||||
local mabs = math.abs
|
-- local mabs = math.abs
|
||||||
|
|
||||||
function ENT:DrawTranslucent()
|
function ENT:DrawTranslucent()
|
||||||
self:SetRenderBounds(minb, maxb)
|
self:SetRenderBounds(minb, maxb)
|
||||||
render.SetColorMaterial()
|
render.SetColorMaterial()
|
||||||
for i=0, 16 do
|
|
||||||
local angle = i * math.pi*2 / 16 + self.offset
|
for i = 0, 16 do
|
||||||
circlepos:SetUnpacked(math.cos(angle)*radius, math.sin(angle)*radius, 0)
|
local angle = i * math.pi * 2 / 16 + self.offset
|
||||||
local newpos = self:GetPos()+circlepos
|
|
||||||
render.DrawBeam(newpos, newpos+circleup, 4, 0, 1, red, true)
|
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
|
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
|
if self.offset >= 180 then
|
||||||
self.offset = 0
|
self.offset = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- render.DrawWireframeBox(self:GetPos(), angle_zero, bmin, bmax)
|
-- render.DrawWireframeBox(self:GetPos(), angle_zero, bmin, bmax)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ENT:Draw()
|
function ENT:Draw()
|
||||||
|
|
||||||
end
|
end
|
|
@ -1,44 +1,47 @@
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
ENT.Base = "base_entity"
|
ENT.Base = "base_entity"
|
||||||
ENT.PrintName = "Ladder"
|
ENT.PrintName = "Ladder"
|
||||||
ENT.Author = ""
|
ENT.Author = ""
|
||||||
ENT.Information = ""
|
ENT.Category = "Beatrun"
|
||||||
|
|
||||||
ENT.Spawnable = true
|
|
||||||
|
|
||||||
|
ENT.Information = ""
|
||||||
|
ENT.Spawnable = true
|
||||||
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
||||||
|
|
||||||
ENT.Category = "Beatrun"
|
|
||||||
|
|
||||||
AddCSLuaFile()
|
AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Model = "models/props_c17/metalladder002.mdl"
|
ENT.Model = "models/props_c17/metalladder002.mdl"
|
||||||
ENT.ModelEnd = "models/props_c17/metalladder002b.mdl"
|
ENT.ModelEnd = "models/props_c17/metalladder002b.mdl"
|
||||||
|
|
||||||
ENT.NoClimbing = true
|
ENT.NoClimbing = true
|
||||||
|
|
||||||
function ENT:SetupDataTables()
|
function ENT:SetupDataTables()
|
||||||
self:NetworkVar( "Float", 0, "LadderHeight" )
|
self:NetworkVar("Float", 0, "LadderHeight")
|
||||||
end
|
end
|
||||||
|
|
||||||
function LadderSpawnDebug()
|
function LadderSpawnDebug()
|
||||||
local p=Entity(1):GetEyeTrace()
|
local p = Entity(1):GetEyeTrace()
|
||||||
a=ents.Create('br_ladder')
|
|
||||||
|
a = ents.Create("br_ladder")
|
||||||
|
|
||||||
a:SetAngles(p.HitNormal:Angle())
|
a:SetAngles(p.HitNormal:Angle())
|
||||||
a:SetPos(p.HitPos+p.HitNormal*10)
|
a:SetPos(p.HitPos + p.HitNormal * 10)
|
||||||
a:Spawn()
|
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
|
end
|
||||||
|
|
||||||
function ENT:LadderHeight(mul)
|
function ENT:LadderHeight(mul)
|
||||||
local height = 125*mul
|
local height = 125 * mul
|
||||||
self:SetLadderHeight(height-(75))
|
self:SetLadderHeight(height - 75)
|
||||||
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:PhysicsInitBox(mins,maxs)
|
|
||||||
self:SetSolid(SOLID_VPHYSICS)
|
self:SetCollisionBounds(mins, maxs)
|
||||||
self:SetCollisionGroup(SOLID_VPHYSICS)
|
self:PhysicsInitBox(mins, maxs)
|
||||||
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
|
self:SetCollisionGroup(SOLID_VPHYSICS)
|
||||||
self:EnableCustomCollisions(true)
|
self:EnableCustomCollisions(true)
|
||||||
self:GetPhysicsObject():EnableMotion(false)
|
self:GetPhysicsObject():EnableMotion(false)
|
||||||
end
|
end
|
||||||
|
@ -46,53 +49,58 @@ end
|
||||||
function ENT:LadderHeightExact(height)
|
function ENT:LadderHeightExact(height)
|
||||||
self:SetLadderHeight(height)
|
self:SetLadderHeight(height)
|
||||||
height = height + 75
|
height = height + 75
|
||||||
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:PhysicsInitBox(mins,maxs)
|
|
||||||
self:SetSolid(SOLID_VPHYSICS)
|
self:SetCollisionBounds(mins, maxs)
|
||||||
self:SetCollisionGroup(SOLID_VPHYSICS)
|
self:PhysicsInitBox(mins, maxs)
|
||||||
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
|
self:SetCollisionGroup(SOLID_VPHYSICS)
|
||||||
self:EnableCustomCollisions(true)
|
self:EnableCustomCollisions(true)
|
||||||
self:GetPhysicsObject():EnableMotion(false)
|
self:GetPhysicsObject():EnableMotion(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:Initialize()
|
function ENT:Initialize()
|
||||||
local height = 125
|
local height = 125
|
||||||
|
|
||||||
if SERVER then
|
if SERVER then
|
||||||
self:SetLadderHeight(height-(75))
|
self:SetLadderHeight(height - 75)
|
||||||
end
|
end
|
||||||
|
|
||||||
self:SetModel(self.Model)
|
self:SetModel(self.Model)
|
||||||
|
|
||||||
local ang = self:GetAngles()
|
local ang = self:GetAngles()
|
||||||
local mins, maxs = Vector(5,-14,0), Vector(14, 14,height)
|
local mins, maxs = Vector(5, -14, 0), Vector(14, 14, height)
|
||||||
self:SetCollisionBounds(mins,maxs)
|
|
||||||
|
self:SetCollisionBounds(mins, maxs)
|
||||||
self:SetAngles(ang)
|
self:SetAngles(ang)
|
||||||
self:PhysicsInitBox(mins,maxs)
|
self:PhysicsInitBox(mins, maxs)
|
||||||
self:SetSolid(SOLID_VPHYSICS)
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
self:SetCollisionGroup(SOLID_VPHYSICS)
|
self:SetCollisionGroup(SOLID_VPHYSICS)
|
||||||
self:EnableCustomCollisions(true)
|
self:EnableCustomCollisions(true)
|
||||||
self:GetPhysicsObject():EnableMotion(false)
|
self:GetPhysicsObject():EnableMotion(false)
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
self:SetRenderBounds(mins,maxs)
|
self:SetRenderBounds(mins, maxs)
|
||||||
self.CLModel = ClientsideModel(self.Model)
|
self.CLModel = ClientsideModel(self.Model)
|
||||||
self.CLModel:SetPos(self:GetPos())
|
self.CLModel:SetPos(self:GetPos())
|
||||||
self.CLModel:SetAngles(self:GetAngles())
|
self.CLModel:SetAngles(self:GetAngles())
|
||||||
|
|
||||||
self.CLModelEnd = ClientsideModel(self.ModelEnd)
|
self.CLModelEnd = ClientsideModel(self.ModelEnd)
|
||||||
self.CLModelEnd:SetPos(self:GetPos())
|
self.CLModelEnd:SetPos(self:GetPos())
|
||||||
self.CLModelEnd:SetAngles(self:GetAngles())
|
self.CLModelEnd:SetAngles(self:GetAngles())
|
||||||
|
|
||||||
local scale = Vector(1,0.85,1)
|
local scale = Vector(1, 0.85, 1)
|
||||||
local mat = Matrix()
|
local mat = Matrix()
|
||||||
|
|
||||||
mat:Scale(scale)
|
mat:Scale(scale)
|
||||||
|
|
||||||
self.CLModel:EnableMatrix("RenderMultiply", mat)
|
self.CLModel:EnableMatrix("RenderMultiply", mat)
|
||||||
self.CLModelEnd:EnableMatrix("RenderMultiply", mat)
|
self.CLModelEnd:EnableMatrix("RenderMultiply", mat)
|
||||||
|
|
||||||
self.CLModel:SetMaterial("medge/plain/redbrickvertex")
|
self.CLModel:SetMaterial("medge/plain/redbrickvertex")
|
||||||
self.CLModelEnd:SetMaterial("medge/plain/redbrickvertex")
|
self.CLModelEnd:SetMaterial("medge/plain/redbrickvertex")
|
||||||
end
|
end
|
||||||
|
|
||||||
self:SetPos(self:GetPos()-self:GetAngles():Forward()*10)
|
self:SetPos(self:GetPos() - self:GetAngles():Forward() * 10)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:UpdateTransmitState()
|
function ENT:UpdateTransmitState()
|
||||||
|
@ -103,7 +111,7 @@ function ENT:OnRemove()
|
||||||
if IsValid(self.CLModel) then
|
if IsValid(self.CLModel) then
|
||||||
self.CLModel:Remove()
|
self.CLModel:Remove()
|
||||||
end
|
end
|
||||||
|
|
||||||
if IsValid(self.CLModelEnd) then
|
if IsValid(self.CLModelEnd) then
|
||||||
self.CLModelEnd:Remove()
|
self.CLModelEnd:Remove()
|
||||||
end
|
end
|
||||||
|
@ -115,52 +123,58 @@ end
|
||||||
function ENT:Think()
|
function ENT:Think()
|
||||||
if SERVER then
|
if SERVER then
|
||||||
local ang = self:GetAngles()
|
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.x = 0
|
||||||
ang.z = 0
|
ang.z = 0
|
||||||
|
|
||||||
self:SetAngles(ang)
|
self:SetAngles(ang)
|
||||||
end
|
end
|
||||||
self:NextThink(CurTime()+1)
|
|
||||||
|
self:NextThink(CurTime() + 1)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if ( CLIENT ) then
|
if CLIENT then
|
||||||
local physobj = self:GetPhysicsObject()
|
local physobj = self:GetPhysicsObject()
|
||||||
|
|
||||||
if !IsValid(self.CLModel) then
|
if not IsValid(self.CLModel) then
|
||||||
self.CLModel = ClientsideModel(self.Model)
|
self.CLModel = ClientsideModel(self.Model)
|
||||||
self.CLModel:SetPos(self:GetPos())
|
self.CLModel:SetPos(self:GetPos())
|
||||||
self.CLModel:SetAngles(self:GetAngles())
|
self.CLModel:SetAngles(self:GetAngles())
|
||||||
end
|
end
|
||||||
|
|
||||||
if !IsValid(self.CLModelEnd) then
|
if not IsValid(self.CLModelEnd) then
|
||||||
|
|
||||||
self.CLModelEnd = ClientsideModel(self.ModelEnd)
|
self.CLModelEnd = ClientsideModel(self.ModelEnd)
|
||||||
self.CLModelEnd:SetPos(self:GetPos())
|
self.CLModelEnd:SetPos(self:GetPos())
|
||||||
self.CLModelEnd:SetAngles(self:GetAngles())
|
self.CLModelEnd:SetAngles(self:GetAngles())
|
||||||
|
|
||||||
|
local scale = Vector(1, 0.85, 1)
|
||||||
local scale = Vector(1,0.85,1)
|
|
||||||
local mat = Matrix()
|
local mat = Matrix()
|
||||||
|
|
||||||
mat:Scale(scale)
|
mat:Scale(scale)
|
||||||
|
|
||||||
self.CLModel:EnableMatrix("RenderMultiply", mat)
|
self.CLModel:EnableMatrix("RenderMultiply", mat)
|
||||||
self.CLModelEnd:EnableMatrix("RenderMultiply", mat)
|
self.CLModelEnd:EnableMatrix("RenderMultiply", mat)
|
||||||
|
|
||||||
self.CLModel:SetMaterial("medge/plain/redbrickvertex")
|
self.CLModel:SetMaterial("medge/plain/redbrickvertex")
|
||||||
self.CLModelEnd:SetMaterial("medge/plain/redbrickvertex")
|
self.CLModelEnd:SetMaterial("medge/plain/redbrickvertex")
|
||||||
end
|
end
|
||||||
|
|
||||||
if ( IsValid( physobj ) ) then
|
if IsValid(physobj) then
|
||||||
physobj:SetPos( self:GetPos() )
|
physobj:SetPos(self:GetPos())
|
||||||
physobj:SetAngles( self:GetAngles() )
|
physobj:SetAngles(self:GetAngles())
|
||||||
self.CLModel:SetPos( self:GetPos() )
|
|
||||||
self.CLModel:SetAngles( self:GetAngles() )
|
self.CLModel:SetPos(self:GetPos())
|
||||||
self.CLModelEnd:SetPos( self:GetPos() )
|
self.CLModel:SetAngles(self:GetAngles())
|
||||||
self.CLModelEnd:SetAngles( self:GetAngles() )
|
self.CLModelEnd:SetPos(self:GetPos())
|
||||||
local mins, maxs = physobj:GetAABB()
|
self.CLModelEnd:SetAngles(self:GetAngles())
|
||||||
|
|
||||||
|
local _, maxs = physobj:GetAABB()
|
||||||
local cmins, cmaxs = self:GetCollisionBounds()
|
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:SetSolid(SOLID_VPHYSICS)
|
||||||
self:SetCollisionGroup(SOLID_VPHYSICS)
|
self:SetCollisionGroup(SOLID_VPHYSICS)
|
||||||
self:EnableCustomCollisions(true)
|
self:EnableCustomCollisions(true)
|
||||||
|
@ -168,7 +182,8 @@ function ENT:Think()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local cmins, cmaxs = self:GetCollisionBounds()
|
local cmins, cmaxs = self:GetCollisionBounds()
|
||||||
self:PhysicsInitBox(cmins,cmaxs)
|
|
||||||
|
self:PhysicsInitBox(cmins, cmaxs)
|
||||||
self:SetSolid(SOLID_VPHYSICS)
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
self:SetCollisionGroup(SOLID_VPHYSICS)
|
self:SetCollisionGroup(SOLID_VPHYSICS)
|
||||||
self:EnableCustomCollisions(true)
|
self:EnableCustomCollisions(true)
|
||||||
|
@ -179,59 +194,64 @@ end
|
||||||
|
|
||||||
function ENT:Draw()
|
function ENT:Draw()
|
||||||
local pos = self:GetPos()
|
local pos = self:GetPos()
|
||||||
local ang = self:GetAngles()
|
-- local ang = self:GetAngles()
|
||||||
local oldz = pos.z
|
local oldz = pos.z
|
||||||
local mins, maxs = self:GetCollisionBounds()
|
local mins, maxs = self:GetCollisionBounds()
|
||||||
maxs.z = self:GetLadderHeight()+75
|
maxs.z = self:GetLadderHeight() + 75
|
||||||
local num = maxs.z/125
|
|
||||||
|
local num = maxs.z / 125
|
||||||
local numc = math.floor(num)
|
local numc = math.floor(num)
|
||||||
local extra = num-numc
|
local extra = num - numc
|
||||||
if !IsValid(self.CLModel) then
|
|
||||||
self:SetRenderBounds(mins,maxs)
|
if not IsValid(self.CLModel) then
|
||||||
|
self:SetRenderBounds(mins, maxs)
|
||||||
self.CLModel = ClientsideModel(self.Model)
|
self.CLModel = ClientsideModel(self.Model)
|
||||||
self.CLModel:SetPos(self:GetPos())
|
self.CLModel:SetPos(self:GetPos())
|
||||||
self.CLModel:SetAngles(self:GetAngles())
|
self.CLModel:SetAngles(self:GetAngles())
|
||||||
end
|
end
|
||||||
|
|
||||||
if !IsValid(self.CLModelEnd) then
|
if not IsValid(self.CLModelEnd) then
|
||||||
|
|
||||||
self.CLModelEnd = ClientsideModel(self.ModelEnd)
|
self.CLModelEnd = ClientsideModel(self.ModelEnd)
|
||||||
self.CLModelEnd:SetPos(self:GetPos())
|
self.CLModelEnd:SetPos(self:GetPos())
|
||||||
self.CLModelEnd:SetAngles(self:GetAngles())
|
self.CLModelEnd:SetAngles(self:GetAngles())
|
||||||
|
|
||||||
|
local scale = Vector(1, 0.85, 1)
|
||||||
local scale = Vector(1,0.85,1)
|
|
||||||
local mat = Matrix()
|
local mat = Matrix()
|
||||||
|
|
||||||
mat:Scale(scale)
|
mat:Scale(scale)
|
||||||
|
|
||||||
self.CLModel:EnableMatrix("RenderMultiply", mat)
|
self.CLModel:EnableMatrix("RenderMultiply", mat)
|
||||||
self.CLModelEnd:EnableMatrix("RenderMultiply", mat)
|
self.CLModelEnd:EnableMatrix("RenderMultiply", mat)
|
||||||
|
|
||||||
self.CLModel:SetMaterial("medge/plain/redbrickvertex")
|
self.CLModel:SetMaterial("medge/plain/redbrickvertex")
|
||||||
self.CLModelEnd:SetMaterial("medge/plain/redbrickvertex")
|
self.CLModelEnd:SetMaterial("medge/plain/redbrickvertex")
|
||||||
end
|
end
|
||||||
|
|
||||||
self:SetRenderBounds(mins,maxs)
|
self:SetRenderBounds(mins, maxs)
|
||||||
for i=0, numc do
|
|
||||||
|
for i = 0, numc do
|
||||||
if num == 1 then
|
if num == 1 then
|
||||||
self.CLModel:DrawModel()
|
self.CLModel:DrawModel()
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if i==numc then
|
|
||||||
if i>0 then
|
if i == numc then
|
||||||
pos.z = pos.z+(125*extra)
|
if i > 0 then
|
||||||
|
pos.z = pos.z + (125 * extra)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.CLModel:SetPos(pos)
|
self.CLModel:SetPos(pos)
|
||||||
self.CLModel:SetupBones()
|
self.CLModel:SetupBones()
|
||||||
self.CLModel:DrawModel()
|
self.CLModel:DrawModel()
|
||||||
else
|
else
|
||||||
pos.z = oldz+(125*i)
|
pos.z = oldz + (125 * i)
|
||||||
self.CLModel:SetPos(pos)
|
self.CLModel:SetPos(pos)
|
||||||
self.CLModel:SetupBones()
|
self.CLModel:SetupBones()
|
||||||
self.CLModel:DrawModel()
|
self.CLModel:DrawModel()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
pos.z = pos.z + 112
|
pos.z = pos.z + 112
|
||||||
|
|
||||||
self.CLModelEnd:SetPos(pos)
|
self.CLModelEnd:SetPos(pos)
|
||||||
self.CLModelEnd:SetupBones()
|
self.CLModelEnd:SetupBones()
|
||||||
self.CLModelEnd:DrawModel()
|
self.CLModelEnd:DrawModel()
|
||||||
|
|
|
@ -1,89 +1,102 @@
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
ENT.Base = "base_entity"
|
ENT.Base = "base_entity"
|
||||||
ENT.PrintName = "Laser Hazard"
|
ENT.PrintName = "Laser Hazard"
|
||||||
ENT.Author = ""
|
ENT.Author = ""
|
||||||
ENT.Information = ""
|
ENT.Category = "Beatrun"
|
||||||
|
|
||||||
ENT.Spawnable = true
|
|
||||||
|
|
||||||
|
ENT.Information = ""
|
||||||
|
ENT.Spawnable = true
|
||||||
ENT.RenderGroup = RENDERGROUP_BOTH
|
ENT.RenderGroup = RENDERGROUP_BOTH
|
||||||
|
|
||||||
ENT.Category = "Beatrun"
|
|
||||||
|
|
||||||
AddCSLuaFile()
|
AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Model = "models/maxofs2d/button_02.mdl"
|
ENT.Model = "models/maxofs2d/button_02.mdl"
|
||||||
|
|
||||||
|
|
||||||
ENT.NoClimbing = true
|
ENT.NoClimbing = true
|
||||||
ENT.LaserLength = 100000
|
ENT.LaserLength = 100000
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
language.Add( "br_laser", "Laser Hazard" )
|
language.Add("br_laser", "Laser Hazard")
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:SetupDataTables()
|
function ENT:SetupDataTables()
|
||||||
self:NetworkVar( "Vector", 1, "EndPos" )
|
self:NetworkVar("Vector", 1, "EndPos")
|
||||||
end
|
end
|
||||||
|
|
||||||
local spawntr = {}
|
-- local spawntr = {}
|
||||||
local spawntrout = {}
|
-- local spawntrout = {}
|
||||||
|
|
||||||
function ENT:Initialize()
|
function ENT:Initialize()
|
||||||
local entstable = player.GetAll()
|
local entstable = player.GetAll()
|
||||||
local ang = self:GetAngles()
|
local ang = self:GetAngles()
|
||||||
entstable[#entstable+1] = self
|
|
||||||
self:SetEndPos(util.QuickTrace(self:GetPos(), ang:Up()*self.LaserLength, entstable).HitPos)
|
entstable[#entstable + 1] = self
|
||||||
self:SetModel(self.Model)
|
|
||||||
local mins, maxs = Vector(0,-1,-1), Vector(0, 1, self:GetPos():Distance(self:GetEndPos()))
|
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
|
if SERVER then
|
||||||
self:PhysicsInitBox(mins,maxs)
|
self:PhysicsInitBox(mins, maxs)
|
||||||
self:SetSolid(SOLID_VPHYSICS)
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
self:GetPhysicsObject():EnableMotion(false)
|
self:GetPhysicsObject():EnableMotion(false)
|
||||||
end
|
end
|
||||||
self.NoPlayerCollisions=true
|
|
||||||
|
self.NoPlayerCollisions = true
|
||||||
self:EnableCustomCollisions(true)
|
self:EnableCustomCollisions(true)
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
self:SetRenderBounds(mins,maxs)
|
self:SetRenderBounds(mins, maxs)
|
||||||
self:SetCollisionBounds(mins,maxs)
|
self:SetCollisionBounds(mins, maxs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:OnRemove()
|
function ENT:OnRemove()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:BRCollisionFunc(ent)
|
function ENT:BRCollisionFunc(ent)
|
||||||
if CLIENT then return false end
|
if CLIENT then return false end
|
||||||
if ent:Health() <= 0 or (ent:IsPlayer() and ent:HasGodMode()) then return false end
|
if ent:Health() <= 0 or (ent:IsPlayer() and ent:HasGodMode()) then return false end
|
||||||
|
|
||||||
local ang = self:GetAngles()
|
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()
|
local dmginfo = DamageInfo()
|
||||||
dmginfo:SetAttacker(self)
|
dmginfo:SetAttacker(self)
|
||||||
dmginfo:SetDamage(100)
|
dmginfo:SetDamage(1000)
|
||||||
dmginfo:SetDamageType(DMG_DISSOLVE)
|
dmginfo:SetDamageType(DMG_DISSOLVE)
|
||||||
|
|
||||||
ent:TakeDamageInfo(dmginfo)
|
ent:TakeDamageInfo(dmginfo)
|
||||||
ent:EmitSound("bigspark"..math.random(1,2)..".wav")
|
ent:EmitSound("bigspark" .. math.random(1, 2) .. ".wav")
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:Think()
|
function ENT:Think()
|
||||||
if CLIENT then return end
|
if CLIENT then return end
|
||||||
|
|
||||||
local entstable = player.GetAll()
|
local entstable = player.GetAll()
|
||||||
local ang = self:GetAngles()
|
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
|
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:SetEndPos(trpos)
|
||||||
self:PhysicsInitBox(mins,maxs)
|
self:PhysicsInitBox(mins, maxs)
|
||||||
self:SetSolid(SOLID_VPHYSICS)
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
self.NoPlayerCollisions=true
|
self.NoPlayerCollisions = true
|
||||||
self:EnableCustomCollisions(true)
|
self:EnableCustomCollisions(true)
|
||||||
self:GetPhysicsObject():EnableMotion(false)
|
self:GetPhysicsObject():EnableMotion(false)
|
||||||
end
|
end
|
||||||
self:NextThink(CurTime()+5)
|
|
||||||
|
self:NextThink(CurTime() + 5)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -92,10 +105,12 @@ function ENT:UpdateTransmitState()
|
||||||
end
|
end
|
||||||
|
|
||||||
local ropemat = Material("cable/physbeam")
|
local ropemat = Material("cable/physbeam")
|
||||||
local color_red = Color(255,0,0)
|
local color_red = Color(255, 0, 0)
|
||||||
|
|
||||||
function ENT:Draw()
|
function ENT:Draw()
|
||||||
local mins, maxs = self:GetCollisionBounds()
|
local mins, maxs = self:GetCollisionBounds()
|
||||||
self:SetRenderBounds(mins,maxs)
|
|
||||||
|
self:SetRenderBounds(mins, maxs)
|
||||||
self:DrawModel()
|
self:DrawModel()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -106,7 +121,9 @@ end
|
||||||
|
|
||||||
function ENT:DrawLOC()
|
function ENT:DrawLOC()
|
||||||
local mins, maxs = self:GetCollisionBounds()
|
local mins, maxs = self:GetCollisionBounds()
|
||||||
self:SetRenderBounds(mins,maxs)
|
|
||||||
|
self:SetRenderBounds(mins, maxs)
|
||||||
|
|
||||||
render.SetMaterial(ropemat)
|
render.SetMaterial(ropemat)
|
||||||
render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_red)
|
render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_red)
|
||||||
end
|
end
|
|
@ -1,27 +1,24 @@
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
ENT.Base = "base_entity"
|
ENT.Base = "base_entity"
|
||||||
ENT.PrintName = "Mat"
|
ENT.PrintName = "Mat"
|
||||||
ENT.Author = ""
|
ENT.Author = ""
|
||||||
ENT.Information = ""
|
ENT.Category = "Beatrun"
|
||||||
|
|
||||||
ENT.Spawnable = true
|
|
||||||
|
|
||||||
|
ENT.Information = ""
|
||||||
|
ENT.Spawnable = true
|
||||||
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
||||||
|
|
||||||
ENT.Category = "Beatrun"
|
|
||||||
|
|
||||||
AddCSLuaFile()
|
AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Model = "models/mechanics/robotics/stand.mdl"
|
ENT.Model = "models/mechanics/robotics/stand.mdl"
|
||||||
|
|
||||||
function ENT:SetupDataTables()
|
function ENT:SetupDataTables()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:Initialize()
|
function ENT:Initialize()
|
||||||
self:SetModel(self.Model)
|
self:SetModel(self.Model)
|
||||||
self:SetMoveType( MOVETYPE_VPHYSICS )
|
self:SetMoveType(MOVETYPE_VPHYSICS)
|
||||||
self:SetSolid( SOLID_VPHYSICS )
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
self:PhysicsInit(SOLID_VPHYSICS)
|
self:PhysicsInit(SOLID_VPHYSICS)
|
||||||
self:GetPhysicsObject():EnableMotion(false)
|
self:GetPhysicsObject():EnableMotion(false)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,45 +1,48 @@
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
ENT.Base = "base_entity"
|
ENT.Base = "base_entity"
|
||||||
ENT.PrintName = "Rabbitfrog"
|
ENT.PrintName = "Rabbitfrog"
|
||||||
ENT.Author = ""
|
ENT.Author = ""
|
||||||
ENT.Information = ""
|
ENT.Category = "Beatrun"
|
||||||
|
|
||||||
ENT.Spawnable = true
|
|
||||||
|
|
||||||
|
ENT.Information = ""
|
||||||
|
ENT.Spawnable = true
|
||||||
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
||||||
|
|
||||||
ENT.Category = "Beatrun"
|
|
||||||
|
|
||||||
AddCSLuaFile()
|
AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Model = "models/nt/props_vehicles/rabbitfrog_dynamic.mdl"
|
ENT.Model = "models/nt/props_vehicles/rabbitfrog_dynamic.mdl"
|
||||||
ENT.AutomaticFrameAdvance = true
|
ENT.AutomaticFrameAdvance = true
|
||||||
|
|
||||||
function ENT:SetupDataTables()
|
function ENT:SetupDataTables()
|
||||||
self:NetworkVar( "Entity", 0, "Passenger1" )
|
self:NetworkVar("Entity", 0, "Passenger1")
|
||||||
self:NetworkVar( "Entity", 1, "Passenger2" )
|
self:NetworkVar("Entity", 1, "Passenger2")
|
||||||
self:NetworkVar( "Entity", 2, "Passenger3" )
|
self:NetworkVar("Entity", 2, "Passenger3")
|
||||||
self:NetworkVar( "Entity", 3, "Passenger4" )
|
self:NetworkVar("Entity", 3, "Passenger4")
|
||||||
|
self:NetworkVar("Vector", 0, "DestinationPos")
|
||||||
self:NetworkVar( "Vector", 0, "DestinationPos" )
|
self:NetworkVar("Angle", 1, "DestinationAngle")
|
||||||
self:NetworkVar( "Angle", 1, "DestinationAngle" )
|
|
||||||
end
|
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()
|
function ENT:Initialize()
|
||||||
self:SetModel(self.Model)
|
self:SetModel(self.Model)
|
||||||
-- self:SetMoveType(MOVETYPE_NONE)
|
-- self:SetMoveType(MOVETYPE_NONE)
|
||||||
-- self:SetSolid(SOLID_BBOX)
|
-- self:SetSolid(SOLID_BBOX)
|
||||||
-- self:SetCollisionBounds(mins, maxs)
|
-- 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:SetMoveType(MOVETYPE_VPHYSICS)
|
||||||
self:ResetSequence(1)
|
self:ResetSequence(1)
|
||||||
if SERVER then self:SetUseType( SIMPLE_USE ) end
|
|
||||||
|
if SERVER then
|
||||||
|
self:SetUseType(SIMPLE_USE)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ENT:OnRemove()
|
function ENT:OnRemove()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:UpdateTransmitState()
|
function ENT:UpdateTransmitState()
|
||||||
|
@ -47,43 +50,44 @@ function ENT:UpdateTransmitState()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:Think()
|
function ENT:Think()
|
||||||
self:NextThink( CurTime() )
|
self:NextThink(CurTime())
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local blur = Material("pp/blurscreen")
|
local blur = Material("pp/blurscreen")
|
||||||
local function draw_blur( a, d )
|
|
||||||
|
|
||||||
surface.SetDrawColor( 255, 255, 255 )
|
local function draw_blur(a, d)
|
||||||
surface.SetMaterial( blur )
|
surface.SetDrawColor(255, 255, 255)
|
||||||
|
surface.SetMaterial(blur)
|
||||||
|
|
||||||
for i = 1, d do
|
for i = 1, d do
|
||||||
|
blur:SetFloat("$blur", (i / d) * a)
|
||||||
blur:SetFloat( "$blur", (i / d ) * ( a ) )
|
|
||||||
blur:Recompute()
|
blur:Recompute()
|
||||||
|
|
||||||
render.UpdateScreenEffectTexture()
|
render.UpdateScreenEffectTexture()
|
||||||
surface.DrawTexturedRect( 0, 0, ScrW(), ScrH() )
|
surface.DrawTexturedRect(0, 0, ScrW(), ScrH())
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local blurint = 4
|
local blurint = 4
|
||||||
local rabbitpos, rabbitang = Vector(), Angle()
|
-- local rabbitpos, rabbitang = Vector(), Angle()
|
||||||
local landseq = {[1]=true,[4]=true}
|
|
||||||
local initseq = 1
|
|
||||||
|
|
||||||
|
local landseq = {
|
||||||
|
[1] = true,
|
||||||
|
[4] = true
|
||||||
|
}
|
||||||
|
|
||||||
local offset = Vector(-30,5,0)
|
-- local initseq = 1
|
||||||
local offsetdraw = Vector(0,70,0)
|
-- local offset = Vector(-30, 5, 0)
|
||||||
local angoffset = Angle(0,90,90)
|
-- local offsetdraw = Vector(0, 70, 0)
|
||||||
|
-- local angoffset = Angle(0, 90, 90)
|
||||||
local lastpos = Vector()
|
-- local lastpos = Vector()
|
||||||
local lastang = Angle()
|
-- local lastang = Angle()
|
||||||
local endlerp = 0
|
-- local endlerp = 0
|
||||||
local endlerppos = Vector()
|
-- local endlerppos = Vector()
|
||||||
local neweye = false
|
-- local neweye = false
|
||||||
|
-- local fx = false
|
||||||
local fx = false
|
|
||||||
local diff = 1
|
local diff = 1
|
||||||
|
|
||||||
local function IsLanding(ent)
|
local function IsLanding(ent)
|
||||||
|
@ -91,10 +95,12 @@ local function IsLanding(ent)
|
||||||
end
|
end
|
||||||
|
|
||||||
local introalpha = 255
|
local introalpha = 255
|
||||||
|
|
||||||
local function LandingHUDPaint()
|
local function LandingHUDPaint()
|
||||||
introalpha = introalpha-(FrameTime()*50)
|
introalpha = introalpha - (FrameTime() * 50)
|
||||||
surface.SetDrawColor(0,0,0,introalpha)
|
|
||||||
surface.DrawRect(0,0,ScrW(),ScrH())
|
surface.SetDrawColor(0, 0, 0, introalpha)
|
||||||
|
surface.DrawRect(0, 0, ScrW(), ScrH())
|
||||||
|
|
||||||
if introalpha <= 0 then
|
if introalpha <= 0 then
|
||||||
hook.Remove("HUDPaint", "LandingHUDPaint")
|
hook.Remove("HUDPaint", "LandingHUDPaint")
|
||||||
|
@ -110,7 +116,6 @@ local function LandingIntro()
|
||||||
fx = false
|
fx = false
|
||||||
neweye = false
|
neweye = false
|
||||||
endlerp = 0
|
endlerp = 0
|
||||||
|
|
||||||
surface.PlaySound("hopperland.mp3")
|
surface.PlaySound("hopperland.mp3")
|
||||||
LandingHUDIntro()
|
LandingHUDIntro()
|
||||||
end
|
end
|
||||||
|
@ -118,68 +123,67 @@ end
|
||||||
|
|
||||||
function ENT:Draw()
|
function ENT:Draw()
|
||||||
-- Reset everything to known good
|
-- Reset everything to known good
|
||||||
render.SetStencilWriteMask( 0xFF )
|
render.SetStencilWriteMask(0xFF)
|
||||||
render.SetStencilTestMask( 0xFF )
|
render.SetStencilTestMask(0xFF)
|
||||||
render.SetStencilReferenceValue( 0 )
|
render.SetStencilReferenceValue(0)
|
||||||
-- render.SetStencilCompareFunction( STENCIL_ALWAYS )
|
-- render.SetStencilCompareFunction( STENCIL_ALWAYS )
|
||||||
render.SetStencilPassOperation( STENCIL_KEEP )
|
render.SetStencilPassOperation(STENCIL_KEEP)
|
||||||
-- render.SetStencilFailOperation( STENCIL_KEEP )
|
-- render.SetStencilFailOperation( STENCIL_KEEP )
|
||||||
render.SetStencilZFailOperation( STENCIL_KEEP )
|
render.SetStencilZFailOperation(STENCIL_KEEP)
|
||||||
render.ClearStencil()
|
render.ClearStencil()
|
||||||
|
|
||||||
-- Enable stencils
|
render.SetStencilEnable(true) -- Enable stencils
|
||||||
render.SetStencilEnable( true )
|
render.SetStencilReferenceValue(1) -- Set the reference value to 1. This is what the compare function tests against
|
||||||
-- Set the reference value to 1. This is what the compare function tests against
|
render.SetStencilCompareFunction(STENCIL_NEVER) -- Force everything to fail
|
||||||
render.SetStencilReferenceValue( 1 )
|
render.SetStencilFailOperation(STENCIL_REPLACE) -- Save all the things we don't draw
|
||||||
-- Force everything to fail
|
|
||||||
render.SetStencilCompareFunction( STENCIL_NEVER )
|
|
||||||
-- Save all the things we don't draw
|
|
||||||
render.SetStencilFailOperation( STENCIL_REPLACE )
|
|
||||||
|
|
||||||
-- Fail to draw our entities.
|
self:DrawModel() -- Fail to draw our entities.
|
||||||
self:DrawModel()
|
|
||||||
-- Render all pixels that don't have their stencil value as 1
|
render.SetStencilCompareFunction(STENCIL_EQUAL) -- Render all pixels that don't have their stencil value as 1
|
||||||
render.SetStencilCompareFunction( STENCIL_EQUAL )
|
render.SetStencilFailOperation(STENCIL_KEEP) -- Don't modify the stencil buffer when things fail
|
||||||
-- Don't modify the stencil buffer when things fail
|
|
||||||
render.SetStencilFailOperation( STENCIL_KEEP )
|
|
||||||
|
|
||||||
-- 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
|
-- for _, ent in pairs( ents.FindByClass( "sent_stencil_test_big" ) ) do
|
||||||
render.PushFilterMag( 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 )
|
render.PushFilterMin(TEXFILTER.ANISOTROPIC)
|
||||||
self:DrawModel()
|
self:DrawModel()
|
||||||
cam.Start2D(vector_origin,angle_zero)
|
cam.Start2D(vector_origin, angle_zero)
|
||||||
draw_blur(math.max(blurint*-diff,0),5)
|
draw_blur(math.max(blurint * -diff, 0), 5)
|
||||||
-- DrawBokehDOF(5,0.99,8)
|
-- DrawBokehDOF(5,0.99,8)
|
||||||
render.PopFilterMag()
|
render.PopFilterMag()
|
||||||
render.PopFilterMin()
|
render.PopFilterMin()
|
||||||
cam.End2D()
|
cam.End2D()
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
-- Let everything render normally again
|
render.SetStencilEnable(false) -- Let everything render normally again
|
||||||
render.SetStencilEnable( false )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function RabbitCalcView(ply, origin, ang)
|
local function RabbitCalcView(ply, origin, ang)
|
||||||
local rabbit = ply:GetRabbit()
|
local rabbit = ply:GetRabbit()
|
||||||
|
|
||||||
if IsValid(rabbit) and rabbit:GetCycle() < 1 and IsLanding(rabbit) then
|
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 matrix = rabbit:GetBoneMatrix(0)
|
||||||
local pos = matrix:GetTranslation()
|
local pos = matrix:GetTranslation()
|
||||||
local angles = matrix:GetAngles()
|
local angles = matrix:GetAngles()
|
||||||
local npos, nang = LocalToWorld(offset, angles, pos, angles)
|
local npos, _ = LocalToWorld(offset, angles, pos, angles)
|
||||||
angles:Sub(angoffset)
|
angles:Sub(angoffset)
|
||||||
angles.x = -angles.x
|
angles.x = -angles.x
|
||||||
angles.y = angles.y-90
|
angles.y = angles.y - 90
|
||||||
angles.z = angles.x
|
angles.z = angles.x
|
||||||
|
|
||||||
local oldangx = ang.x
|
local oldangx = ang.x
|
||||||
ang.x = 0
|
ang.x = 0
|
||||||
|
|
||||||
diff = ang:Forward():Dot(angles:Right())
|
diff = ang:Forward():Dot(angles:Right())
|
||||||
|
|
||||||
local absdiff = math.abs(diff)
|
local absdiff = math.abs(diff)
|
||||||
ang.x = oldangx
|
ang.x = oldangx
|
||||||
angles.z = angles.z * absdiff
|
angles.z = angles.z * absdiff
|
||||||
-- angles.x = angles.x * absdiff
|
-- angles.x = angles.x * absdiff
|
||||||
|
|
||||||
-- angles.x = angles.x*ang:Forward():Dot(ang:Forward())
|
-- angles.x = angles.x*ang:Forward():Dot(ang:Forward())
|
||||||
-- angles.z = angles.z*math.abs(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)
|
lastpos:Set(origin)
|
||||||
lastang:Set(ang)
|
lastang:Set(ang)
|
||||||
elseif endlerp < 1 then
|
elseif endlerp < 1 then
|
||||||
if !neweye then
|
if not neweye then
|
||||||
lastang.z = 0
|
lastang.z = 0
|
||||||
|
|
||||||
ang:Set(lastang)
|
ang:Set(lastang)
|
||||||
|
|
||||||
ply:SetEyeAngles(lastang)
|
ply:SetEyeAngles(lastang)
|
||||||
neweye = true
|
neweye = true
|
||||||
ply:CLViewPunch(Angle(12,0,0))
|
|
||||||
|
ply:CLViewPunch(Angle(12, 0, 0))
|
||||||
VManip:PlayAnim("vault")
|
VManip:PlayAnim("vault")
|
||||||
end
|
end
|
||||||
|
|
||||||
origin:Set(LerpVector(endlerp, lastpos, origin))
|
origin:Set(LerpVector(endlerp, lastpos, origin))
|
||||||
|
|
||||||
endlerp = endlerp + (FrameTime() * 4)
|
endlerp = endlerp + (FrameTime() * 4)
|
||||||
|
|
||||||
endlerppos:Set(origin)
|
endlerppos:Set(origin)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function RabbitVM(wep, vm, oldpos, oldang, pos, ang)
|
local function RabbitVM(wep, vm, oldpos, oldang, pos, ang)
|
||||||
local rabbit = LocalPlayer():GetRabbit()
|
local rabbit = LocalPlayer():GetRabbit()
|
||||||
local diffpos = pos-oldpos
|
local diffpos = pos - oldpos
|
||||||
local diffang = ang-oldang
|
local diffang = ang - oldang
|
||||||
|
|
||||||
if IsValid(rabbit) and rabbit:GetCycle() < 1 and IsLanding(rabbit) then
|
if IsValid(rabbit) and rabbit:GetCycle() < 1 and IsLanding(rabbit) then
|
||||||
pos:Set(lastpos)
|
pos:Set(lastpos)
|
||||||
ang:Set(lastang)
|
ang:Set(lastang)
|
||||||
|
|
||||||
pos:Sub(diffpos)
|
pos:Sub(diffpos)
|
||||||
ang:Sub(diffang)
|
ang:Sub(diffang)
|
||||||
elseif endlerp < 1 then
|
elseif endlerp < 1 then
|
||||||
pos:Set(endlerppos)
|
pos:Set(endlerppos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hook.Add("CalcViewModelView", "RabbitVM", RabbitVM)
|
-- hook.Add("CalcViewModelView", "RabbitVM", RabbitVM)
|
||||||
|
|
||||||
-- hook.Add("BeatrunDrawHUD", "Rabbit", function()
|
-- hook.Add("BeatrunDrawHUD", "Rabbit", function()
|
||||||
-- if IsValid(rabbit) and rabbit:GetCycle() < 1 and IsLanding(rabbit) then
|
-- if IsValid(rabbit) and rabbit:GetCycle() < 1 and IsLanding(rabbit) then return false end
|
||||||
-- return false
|
|
||||||
-- end
|
|
||||||
-- end)
|
-- end)
|
||||||
|
|
||||||
|
|
||||||
function ENT:Use(ply, caller, usetype, value)
|
function ENT:Use(ply, caller, usetype, value)
|
||||||
if !ply:IsPlayer() then return end
|
if not ply:IsPlayer() then return end
|
||||||
|
|
||||||
print("hi")
|
print("hi")
|
||||||
|
|
||||||
ply:SetRabbit(self)
|
ply:SetRabbit(self)
|
||||||
ply:SetRabbitSeat(1)
|
ply:SetRabbitSeat(1)
|
||||||
end
|
end
|
||||||
|
@ -239,13 +249,15 @@ end
|
||||||
|
|
||||||
local function RabbitPlayerMove(ply, mv, cmd)
|
local function RabbitPlayerMove(ply, mv, cmd)
|
||||||
local rabbit = ply:GetRabbit()
|
local rabbit = ply:GetRabbit()
|
||||||
|
|
||||||
if IsValid(rabbit) then
|
if IsValid(rabbit) then
|
||||||
local matrix = rabbit:GetBoneMatrix(0)
|
local matrix = rabbit:GetBoneMatrix(0)
|
||||||
local pos = matrix:GetTranslation()-ply:GetViewOffset()
|
local pos = matrix:GetTranslation() - ply:GetViewOffset()
|
||||||
local angles = matrix:GetAngles()
|
local angles = matrix:GetAngles()
|
||||||
local npos, nang = LocalToWorld(offset, angles, pos, angles)
|
local npos, _ = LocalToWorld(offset, angles, pos, angles)
|
||||||
ply:SetMoveType(MOVETYPE_NOCLIP)
|
ply:SetMoveType(MOVETYPE_NOCLIP)
|
||||||
mv:SetOrigin(npos)
|
mv:SetOrigin(npos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hook.Add("SetupMove", "RabbitPlayerMove", RabbitPlayerMove)
|
-- hook.Add("SetupMove", "RabbitPlayerMove", RabbitPlayerMove)
|
|
@ -1,71 +1,75 @@
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
ENT.Base = "base_entity"
|
ENT.Base = "base_entity"
|
||||||
ENT.PrintName = "Swingbar"
|
ENT.PrintName = "Swingbar"
|
||||||
ENT.Author = ""
|
ENT.Author = ""
|
||||||
ENT.Information = ""
|
ENT.Category = "Beatrun"
|
||||||
|
ENT.Information = ""
|
||||||
ENT.Spawnable = true
|
|
||||||
|
|
||||||
|
ENT.Spawnable = true
|
||||||
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
||||||
|
|
||||||
ENT.Category = "Beatrun"
|
|
||||||
|
|
||||||
AddCSLuaFile()
|
AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Model = "models/hunter/plates/plate2.mdl"
|
ENT.Model = "models/hunter/plates/plate2.mdl"
|
||||||
|
|
||||||
ENT.NoWallrun = true
|
ENT.NoWallrun = true
|
||||||
ENT.NoClimbing = 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()
|
function ENT:Initialize()
|
||||||
self:DrawShadow(false)
|
self:DrawShadow(false)
|
||||||
self:SetColor(red)
|
self:SetColor(red)
|
||||||
self:SetModel(self.Model)
|
self:SetModel(self.Model)
|
||||||
-- self:SetMoveType(MOVETYPE_NONE)
|
-- self:SetMoveType(MOVETYPE_NONE)
|
||||||
if SERVER then self:PhysicsInit(SOLID_VPHYSICS) end
|
|
||||||
|
if SERVER then
|
||||||
|
self:PhysicsInit(SOLID_VPHYSICS)
|
||||||
|
end
|
||||||
|
|
||||||
self:SetSolid(SOLID_VPHYSICS)
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||||
self:SetCustomCollisionCheck(true)
|
self:SetCustomCollisionCheck(true)
|
||||||
self.NoPlayerCollisions = true
|
self.NoPlayerCollisions = true
|
||||||
|
|
||||||
-- local mins, maxs = self:GetCollisionBounds()*4
|
-- local mins, maxs = self:GetCollisionBounds() * 4
|
||||||
|
|
||||||
-- spawntr.start = self:GetPos()
|
-- spawntr.start = self:GetPos()
|
||||||
-- spawntr.endpos = spawntr.start
|
-- spawntr.endpos = spawntr.start
|
||||||
-- spawntr.filter = self
|
-- spawntr.filter = self
|
||||||
-- spawntr.output = spawntrout
|
-- spawntr.output = spawntrout
|
||||||
-- spawntr.mins, spawntr.maxs = mins, maxs
|
-- spawntr.mins, spawntr.maxs = mins, maxs
|
||||||
|
|
||||||
-- util.TraceHull(spawntr)
|
-- util.TraceHull(spawntr)
|
||||||
|
|
||||||
-- if spawntrout.Hit then
|
-- if spawntrout.Hit then
|
||||||
-- local ang = spawntrout.HitNormal:Angle()
|
-- local ang = spawntrout.HitNormal:Angle()
|
||||||
-- ang.x = 0
|
-- ang.x = 0
|
||||||
-- self:SetAngles(ang)
|
-- self:SetAngles(ang)
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:CollisionFunc(ent)
|
function ENT:CollisionFunc(ent)
|
||||||
-- if ent:GetPos().z+64>self:GetPos().z then
|
|
||||||
-- print("huh")
|
|
||||||
-- return true
|
|
||||||
-- else
|
|
||||||
-- return false
|
|
||||||
-- end
|
|
||||||
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
|
end
|
||||||
|
|
||||||
function ENT:Think()
|
function ENT:Think()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local matrix
|
-- local matrix
|
||||||
local vecscale
|
-- local vecscale
|
||||||
|
|
||||||
function ENT:Draw()
|
function ENT:Draw()
|
||||||
self:DrawModel()
|
self:DrawModel()
|
||||||
end
|
end
|
|
@ -1,15 +1,13 @@
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
ENT.Base = "base_entity"
|
ENT.Base = "base_entity"
|
||||||
ENT.PrintName = "Swingpipe"
|
ENT.PrintName = "Swingpipe"
|
||||||
ENT.Author = ""
|
ENT.Author = ""
|
||||||
ENT.Information = ""
|
ENT.Category = "Beatrun"
|
||||||
|
ENT.Information = ""
|
||||||
ENT.Spawnable = true
|
|
||||||
|
|
||||||
|
ENT.Spawnable = true
|
||||||
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
||||||
|
|
||||||
ENT.Category = "Beatrun"
|
|
||||||
|
|
||||||
AddCSLuaFile()
|
AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Model = "models/parkoursource/pipe_standard.mdl"
|
ENT.Model = "models/parkoursource/pipe_standard.mdl"
|
||||||
|
@ -17,53 +15,57 @@ ENT.Model = "models/parkoursource/pipe_standard.mdl"
|
||||||
function ENT:SetupDataTables()
|
function ENT:SetupDataTables()
|
||||||
end
|
end
|
||||||
|
|
||||||
local spawntr = {}
|
-- local spawntr = {}
|
||||||
local spawntrout = {}
|
-- local spawntrout = {}
|
||||||
|
|
||||||
function ENT:Initialize()
|
function ENT:Initialize()
|
||||||
self:DrawShadow(false)
|
self:DrawShadow(false)
|
||||||
self:SetModel(self.Model)
|
self:SetModel(self.Model)
|
||||||
self:SetMoveType(MOVETYPE_NONE)
|
self:SetMoveType(MOVETYPE_NONE)
|
||||||
local mins, maxs = Vector(-15,-15,0), Vector(15, 15,180)
|
|
||||||
self:SetCollisionBounds(mins,maxs)
|
local mins, maxs = Vector(-15, -15, 0), Vector(15, 15, 180)
|
||||||
self:PhysicsInitBox(mins,maxs)
|
|
||||||
self:SetSolid(SOLID_VPHYSICS)
|
self:SetCollisionBounds(mins, maxs)
|
||||||
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
self:PhysicsInitBox(mins, maxs)
|
||||||
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
|
self:SetCollisionGroup(COLLISION_GROUP_WEAPON)
|
||||||
self:EnableCustomCollisions(true)
|
self:EnableCustomCollisions(true)
|
||||||
|
|
||||||
if SERVER then
|
if SERVER then
|
||||||
self:GetPhysicsObject():EnableMotion(false)
|
self:GetPhysicsObject():EnableMotion(false)
|
||||||
else
|
else
|
||||||
-- self:SetRenderOrigin(self:GetPos() - self:GetAngles():Forward()*15)
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- self:SetRenderOrigin(self:GetPos() - self:GetAngles():Forward() * 15)
|
||||||
self:SetMaterial("medge/plain/redbrickvertex")
|
self:SetMaterial("medge/plain/redbrickvertex")
|
||||||
self.NoPlayerCollisions=true
|
self.NoPlayerCollisions = true
|
||||||
|
-- local mins, maxs = self:GetCollisionBounds() * 4
|
||||||
-- local mins, maxs = self:GetCollisionBounds()*4
|
|
||||||
-- spawntr.start = self:GetPos()
|
-- spawntr.start = self:GetPos()
|
||||||
-- spawntr.endpos = spawntr.start
|
-- spawntr.endpos = spawntr.start
|
||||||
-- spawntr.filter = self
|
-- spawntr.filter = self
|
||||||
-- spawntr.output = spawntrout
|
-- spawntr.output = spawntrout
|
||||||
-- spawntr.mins, spawntr.maxs = mins, maxs
|
-- 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()
|
function ENT:OnRemove()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ENT:Think()
|
function ENT:Think()
|
||||||
end
|
end
|
||||||
|
|
||||||
local matrix
|
-- local matrix
|
||||||
local vecscale
|
-- local vecscale
|
||||||
|
|
||||||
function ENT:Draw()
|
function ENT:Draw()
|
||||||
self:DrawModel()
|
self:DrawModel()
|
||||||
-- local mins, maxs = self:GetCollisionBounds()
|
-- local mins, maxs = self:GetCollisionBounds()
|
||||||
|
|
|
@ -1,68 +1,71 @@
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
ENT.Base = "base_entity"
|
ENT.Base = "base_entity"
|
||||||
ENT.PrintName = "Swingrope"
|
ENT.PrintName = "Swingrope"
|
||||||
ENT.Author = ""
|
ENT.Author = ""
|
||||||
ENT.Information = ""
|
ENT.Category = "Beatrun"
|
||||||
|
|
||||||
ENT.Spawnable = true
|
|
||||||
|
|
||||||
|
ENT.Information = ""
|
||||||
|
ENT.Spawnable = true
|
||||||
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
||||||
|
|
||||||
ENT.Category = "Beatrun"
|
|
||||||
|
|
||||||
AddCSLuaFile()
|
AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Model = "models/parkoursource/pipe_standard.mdl"
|
ENT.Model = "models/parkoursource/pipe_standard.mdl"
|
||||||
|
|
||||||
|
|
||||||
ENT.NoClimbing = true
|
ENT.NoClimbing = true
|
||||||
ENT.NoWallrun = true
|
ENT.NoWallrun = true
|
||||||
|
|
||||||
function ENT:SetupDataTables()
|
function ENT:SetupDataTables()
|
||||||
self:NetworkVar( "Vector", 0, "StartPos" )
|
self:NetworkVar("Vector", 0, "StartPos")
|
||||||
self:NetworkVar( "Vector", 1, "EndPos" )
|
self:NetworkVar("Vector", 1, "EndPos")
|
||||||
end
|
end
|
||||||
|
|
||||||
local spawntr = {}
|
-- local spawntr = {}
|
||||||
local spawntrout = {}
|
-- local spawntrout = {}
|
||||||
|
|
||||||
function ENT:Initialize()
|
function ENT:Initialize()
|
||||||
self:SetPos(self:GetStartPos())
|
self:SetPos(self:GetStartPos())
|
||||||
self:SetModel(self.Model)
|
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)
|
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:SetAngles(ang)
|
||||||
self:PhysicsInitBox(mins,maxs)
|
self:PhysicsInitBox(mins, maxs)
|
||||||
self:SetSolid(SOLID_VPHYSICS)
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
self.NoPlayerCollisions=true
|
self.NoPlayerCollisions = true
|
||||||
self:EnableCustomCollisions(true)
|
self:EnableCustomCollisions(true)
|
||||||
self:GetPhysicsObject():EnableMotion(false)
|
self:GetPhysicsObject():EnableMotion(false)
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
self:SetRenderBounds(mins,maxs)
|
self:SetRenderBounds(mins, maxs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:OnRemove()
|
function ENT:OnRemove()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ENT:Think()
|
function ENT:Think()
|
||||||
if self:GetPos() != self:GetStartPos() then
|
if self:GetPos() ~= self:GetStartPos() then
|
||||||
self:SetStartPos(self:GetPos())
|
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)
|
self:SetAngles(ang)
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
self:SetRenderAngles(ang)
|
self:SetRenderAngles(ang)
|
||||||
end
|
end
|
||||||
self:PhysicsInitBox(mins,maxs)
|
|
||||||
|
self:PhysicsInitBox(mins, maxs)
|
||||||
self:SetSolid(SOLID_VPHYSICS)
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
self.NoPlayerCollisions=true
|
self.NoPlayerCollisions = true
|
||||||
self:EnableCustomCollisions(true)
|
self:EnableCustomCollisions(true)
|
||||||
self:GetPhysicsObject():EnableMotion(false)
|
self:GetPhysicsObject():EnableMotion(false)
|
||||||
end
|
end
|
||||||
self:NextThink(CurTime()+5)
|
|
||||||
|
self:NextThink(CurTime() + 5)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -71,23 +74,28 @@ function ENT:UpdateTransmitState()
|
||||||
end
|
end
|
||||||
|
|
||||||
local ropemat = Material("cable/cable2")
|
local ropemat = Material("cable/cable2")
|
||||||
local color_red = Color(255,0,0)
|
local color_red = Color(255, 0, 0)
|
||||||
|
|
||||||
function ENT:Draw()
|
function ENT:Draw()
|
||||||
if LocalPlayer():GetGrappling() then
|
if LocalPlayer():GetGrappling() then
|
||||||
local grapplepos = LocalPlayer():GetGrapplePos()
|
local grapplepos = LocalPlayer():GetGrapplePos()
|
||||||
if grapplepos == self:GetStartPos() or grapplepos == self:GetEndPos() then
|
|
||||||
return
|
if grapplepos == self:GetStartPos() or grapplepos == self:GetEndPos() then return end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local mins, maxs = self:GetCollisionBounds()
|
local mins, maxs = self:GetCollisionBounds()
|
||||||
self:SetRenderBounds(mins,maxs)
|
|
||||||
|
self:SetRenderBounds(mins, maxs)
|
||||||
|
|
||||||
render.SetMaterial(ropemat)
|
render.SetMaterial(ropemat)
|
||||||
render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_white)
|
render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_white)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:DrawLOC()
|
function ENT:DrawLOC()
|
||||||
local mins, maxs = self:GetCollisionBounds()
|
local mins, maxs = self:GetCollisionBounds()
|
||||||
self:SetRenderBounds(mins,maxs)
|
|
||||||
|
self:SetRenderBounds(mins, maxs)
|
||||||
|
|
||||||
render.SetMaterial(ropemat)
|
render.SetMaterial(ropemat)
|
||||||
render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_red)
|
render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_red)
|
||||||
end
|
end
|
|
@ -1,68 +1,71 @@
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
ENT.Base = "base_entity"
|
ENT.Base = "base_entity"
|
||||||
ENT.PrintName = "Zipline"
|
ENT.PrintName = "Zipline"
|
||||||
ENT.Author = ""
|
ENT.Author = ""
|
||||||
ENT.Information = ""
|
ENT.Category = "Beatrun"
|
||||||
|
|
||||||
ENT.Spawnable = true
|
|
||||||
|
|
||||||
|
ENT.Information = ""
|
||||||
|
ENT.Spawnable = true
|
||||||
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
||||||
|
|
||||||
ENT.Category = "Beatrun"
|
|
||||||
|
|
||||||
AddCSLuaFile()
|
AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Model = "models/parkoursource/pipe_standard.mdl"
|
ENT.Model = "models/parkoursource/pipe_standard.mdl"
|
||||||
|
|
||||||
|
|
||||||
ENT.NoClimbing = true
|
ENT.NoClimbing = true
|
||||||
|
|
||||||
function ENT:SetupDataTables()
|
function ENT:SetupDataTables()
|
||||||
self:NetworkVar( "Vector", 0, "StartPos" )
|
self:NetworkVar("Vector", 0, "StartPos")
|
||||||
self:NetworkVar( "Vector", 1, "EndPos" )
|
self:NetworkVar("Vector", 1, "EndPos")
|
||||||
self:NetworkVar( "Bool", 0, "TwoWay" )
|
self:NetworkVar("Bool", 0, "TwoWay")
|
||||||
end
|
end
|
||||||
|
|
||||||
local spawntr = {}
|
-- local spawntr = {}
|
||||||
local spawntrout = {}
|
-- local spawntrout = {}
|
||||||
|
|
||||||
function ENT:Initialize()
|
function ENT:Initialize()
|
||||||
self:SetPos(self:GetStartPos())
|
self:SetPos(self:GetStartPos())
|
||||||
self:SetModel(self.Model)
|
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)
|
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:SetAngles(ang)
|
||||||
self:PhysicsInitBox(mins,maxs)
|
self:PhysicsInitBox(mins, maxs)
|
||||||
self:SetSolid(SOLID_VPHYSICS)
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
self.NoPlayerCollisions=true
|
self.NoPlayerCollisions = true
|
||||||
self:EnableCustomCollisions(true)
|
self:EnableCustomCollisions(true)
|
||||||
self:GetPhysicsObject():EnableMotion(false)
|
self:GetPhysicsObject():EnableMotion(false)
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
self:SetRenderBounds(mins,maxs)
|
self:SetRenderBounds(mins, maxs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:OnRemove()
|
function ENT:OnRemove()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ENT:Think()
|
function ENT:Think()
|
||||||
if self:GetPos() != self:GetStartPos() then
|
if self:GetPos() ~= self:GetStartPos() then
|
||||||
self:SetStartPos(self:GetPos())
|
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)
|
self:SetAngles(ang)
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
self:SetRenderAngles(ang)
|
self:SetRenderAngles(ang)
|
||||||
end
|
end
|
||||||
self:PhysicsInitBox(mins,maxs)
|
|
||||||
|
self:PhysicsInitBox(mins, maxs)
|
||||||
self:SetSolid(SOLID_VPHYSICS)
|
self:SetSolid(SOLID_VPHYSICS)
|
||||||
self.NoPlayerCollisions=true
|
self.NoPlayerCollisions = true
|
||||||
self:EnableCustomCollisions(true)
|
self:EnableCustomCollisions(true)
|
||||||
self:GetPhysicsObject():EnableMotion(false)
|
self:GetPhysicsObject():EnableMotion(false)
|
||||||
end
|
end
|
||||||
self:NextThink(CurTime()+5)
|
|
||||||
|
self:NextThink(CurTime() + 5)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -71,17 +74,22 @@ function ENT:UpdateTransmitState()
|
||||||
end
|
end
|
||||||
|
|
||||||
local ropemat = Material("cable/cable2")
|
local ropemat = Material("cable/cable2")
|
||||||
local color_red = Color(255,0,0)
|
local color_red = Color(255, 0, 0)
|
||||||
|
|
||||||
function ENT:Draw()
|
function ENT:Draw()
|
||||||
local mins, maxs = self:GetCollisionBounds()
|
local mins, maxs = self:GetCollisionBounds()
|
||||||
self:SetRenderBounds(mins,maxs)
|
|
||||||
|
self:SetRenderBounds(mins, maxs)
|
||||||
|
|
||||||
render.SetMaterial(ropemat)
|
render.SetMaterial(ropemat)
|
||||||
render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_white)
|
render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_white)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:DrawLOC()
|
function ENT:DrawLOC()
|
||||||
local mins, maxs = self:GetCollisionBounds()
|
local mins, maxs = self:GetCollisionBounds()
|
||||||
self:SetRenderBounds(mins,maxs)
|
|
||||||
|
self:SetRenderBounds(mins, maxs)
|
||||||
|
|
||||||
render.SetMaterial(ropemat)
|
render.SetMaterial(ropemat)
|
||||||
render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_red)
|
render.DrawBeam(self:GetPos(), self:GetEndPos(), 5, 0, 1, color_red)
|
||||||
end
|
end
|
|
@ -1,39 +1,38 @@
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
ENT.Base = "base_entity"
|
ENT.Base = "base_entity"
|
||||||
ENT.PrintName = "Block"
|
ENT.PrintName = "Block"
|
||||||
ENT.Author = ""
|
ENT.Author = ""
|
||||||
ENT.Information = ""
|
ENT.Category = "Beatrun"
|
||||||
|
|
||||||
ENT.Spawnable = true
|
|
||||||
|
|
||||||
|
ENT.Information = ""
|
||||||
|
ENT.Spawnable = true
|
||||||
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
ENT.RenderGroup = RENDERGROUP_OPAQUE
|
||||||
|
|
||||||
ENT.Category = "Beatrun"
|
|
||||||
|
|
||||||
AddCSLuaFile()
|
AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Model = "models/hunter/blocks/cube025x025x025.mdl"
|
ENT.Model = "models/hunter/blocks/cube025x025x025.mdl"
|
||||||
|
|
||||||
local mat
|
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
|
end
|
||||||
|
|
||||||
function ENT:Initialize()
|
function ENT:Initialize()
|
||||||
self:DrawShadow(false)
|
self:DrawShadow(false)
|
||||||
self:SetModel(self.Model)
|
self:SetModel(self.Model)
|
||||||
self:SetMoveType(MOVETYPE_NONE)
|
self:SetMoveType(MOVETYPE_NONE)
|
||||||
self:SetSolid(SOLID_BBOX)
|
self:SetSolid(SOLID_BBOX)
|
||||||
self:SetCollisionBounds(Vector(-75, -75, 0), Vector(75, 75, 100))
|
self:SetCollisionBounds(Vector(-75, -75, 0), Vector(75, 75, 100))
|
||||||
self:AddSolidFlags(FSOLID_CUSTOMRAYTEST)
|
self:AddSolidFlags(FSOLID_CUSTOMRAYTEST)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ENT:OnRemove()
|
function ENT:OnRemove()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:DrawTranslucent()
|
function ENT:DrawTranslucent()
|
||||||
|
@ -42,25 +41,33 @@ end
|
||||||
function ENT:Think()
|
function ENT:Think()
|
||||||
if SERVER then
|
if SERVER then
|
||||||
local mins, maxs = self:GetCollisionBounds()
|
local mins, maxs = self:GetCollisionBounds()
|
||||||
|
|
||||||
mins:Rotate(self:GetAngles())
|
mins:Rotate(self:GetAngles())
|
||||||
maxs:Rotate(self:GetAngles())
|
maxs:Rotate(self:GetAngles())
|
||||||
|
|
||||||
self:SetCollisionBounds(mins, maxs)
|
self:SetCollisionBounds(mins, maxs)
|
||||||
self:NextThink(CurTime()+1)
|
self:NextThink(CurTime() + 1)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local matrix
|
local matrix
|
||||||
local vecscale
|
local vecscale
|
||||||
|
|
||||||
function ENT:Draw()
|
function ENT:Draw()
|
||||||
local mins, maxs = self:GetCollisionBounds()
|
local mins, maxs = self:GetCollisionBounds()
|
||||||
matrix = matrix or Matrix()
|
matrix = matrix or Matrix()
|
||||||
vecscale = vecscale or Vector()
|
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)
|
matrix:SetScale(vecscale)
|
||||||
mat:SetMatrix("$basetexturetransform",matrix)
|
|
||||||
|
mat:SetMatrix("$basetexturetransform", matrix)
|
||||||
|
|
||||||
self:SetRenderBounds(mins, maxs)
|
self:SetRenderBounds(mins, maxs)
|
||||||
render.SetColorModulation(1,1,1)
|
|
||||||
|
render.SetColorModulation(1, 1, 1)
|
||||||
render.SetMaterial(mat)
|
render.SetMaterial(mat)
|
||||||
render.DrawBox(self:GetPos(), self:GetAngles(), mins, maxs, color_white)
|
render.DrawBox(self:GetPos(), self:GetAngles(), mins, maxs, color_white)
|
||||||
end
|
end
|
|
@ -1,35 +1,32 @@
|
||||||
ENT.Type = "anim"
|
ENT.Type = "anim"
|
||||||
ENT.Base = "base_entity"
|
ENT.Base = "base_entity"
|
||||||
ENT.PrintName = "Checkpoint"
|
ENT.PrintName = "Checkpoint"
|
||||||
ENT.Author = ""
|
ENT.Author = ""
|
||||||
ENT.Information = ""
|
ENT.Category = "Beatrun"
|
||||||
|
|
||||||
ENT.Spawnable = true
|
|
||||||
|
|
||||||
|
ENT.Information = ""
|
||||||
|
ENT.Spawnable = true
|
||||||
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
ENT.RenderGroup = RENDERGROUP_TRANSLUCENT
|
||||||
|
|
||||||
ENT.Category = "Beatrun"
|
|
||||||
|
|
||||||
AddCSLuaFile()
|
AddCSLuaFile()
|
||||||
|
|
||||||
ENT.Model = "models/hunter/blocks/cube025x025x025.mdl"
|
ENT.Model = "models/hunter/blocks/cube025x025x025.mdl"
|
||||||
|
|
||||||
ENT.IsFinish = false
|
ENT.IsFinish = false
|
||||||
|
|
||||||
function ENT:SetupDataTables()
|
function ENT:SetupDataTables()
|
||||||
|
self:NetworkVar("Int", 0, "CPNum")
|
||||||
self:NetworkVar( "Int", 0, "CPNum" )
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local minb, maxb = Vector(-75, -75, 0), Vector(75, 75, 10000)
|
local minb, maxb = Vector(-75, -75, 0), Vector(75, 75, 10000)
|
||||||
|
|
||||||
function ENT:Initialize()
|
function ENT:Initialize()
|
||||||
self:SetModel(self.Model)
|
self:SetModel(self.Model)
|
||||||
self:DrawShadow(false)
|
self:DrawShadow(false)
|
||||||
self:SetMoveType(MOVETYPE_NONE)
|
self:SetMoveType(MOVETYPE_NONE)
|
||||||
self:SetSolid(SOLID_BBOX)
|
self:SetSolid(SOLID_BBOX)
|
||||||
self:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE)
|
self:SetCollisionGroup(COLLISION_GROUP_IN_VEHICLE)
|
||||||
self:SetCollisionBounds(minb, maxb)
|
self:SetCollisionBounds(minb, maxb)
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
self:SetRenderBounds(minb, maxb)
|
self:SetRenderBounds(minb, maxb)
|
||||||
self.offset = 0
|
self.offset = 0
|
||||||
|
@ -41,9 +38,11 @@ function ENT:Initialize()
|
||||||
end
|
end
|
||||||
|
|
||||||
local screencolor = Color(64, 0, 0, 64)
|
local screencolor = Color(64, 0, 0, 64)
|
||||||
|
|
||||||
function ENT:StartTouch(ent)
|
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)
|
ent:SetNW2Int("CPNum", ent:GetNW2Int("CPNum", 1) + 1)
|
||||||
|
|
||||||
if ent:GetNW2Int("CPNum", 1) > table.Count(Checkpoints) then
|
if ent:GetNW2Int("CPNum", 1) > table.Count(Checkpoints) then
|
||||||
ReplayStop(ent)
|
ReplayStop(ent)
|
||||||
FinishCourse(ent)
|
FinishCourse(ent)
|
||||||
|
@ -51,11 +50,14 @@ function ENT:StartTouch(ent)
|
||||||
ent.CPSavePos = ent:GetPos()
|
ent.CPSavePos = ent:GetPos()
|
||||||
ent.CPSaveAng = ent:EyeAngles()
|
ent.CPSaveAng = ent:EyeAngles()
|
||||||
ent.CPSaveVel = ent:GetVelocity()
|
ent.CPSaveVel = ent:GetVelocity()
|
||||||
|
|
||||||
ent:SaveParkourState()
|
ent:SaveParkourState()
|
||||||
|
|
||||||
net.Start("Checkpoint_Hit")
|
net.Start("Checkpoint_Hit")
|
||||||
net.WriteUInt(ent:GetNW2Int("CPNum", 1), 8)
|
net.WriteUInt(ent:GetNW2Int("CPNum", 1), 8)
|
||||||
net.Send(ent)
|
net.Send(ent)
|
||||||
end
|
end
|
||||||
|
|
||||||
ent:ScreenFade(SCREENFADE.IN, screencolor, 0.25, 0)
|
ent:ScreenFade(SCREENFADE.IN, screencolor, 0.25, 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -65,57 +67,73 @@ function ENT:UpdateTransmitState()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:Use(activator, caller, usetype)
|
function ENT:Use(activator, caller, usetype)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ENT:OnRemove()
|
function ENT:OnRemove()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local radius = 75
|
local radius = 75
|
||||||
local red = Color(255, 0, 0, 200)
|
local red = Color(255, 0, 0, 200)
|
||||||
local circlepos = Vector()
|
local circlepos = Vector()
|
||||||
local circleup = Vector(0,0,10000)
|
local circleup = Vector(0, 0, 10000)
|
||||||
|
|
||||||
function ENT:DrawTranslucent()
|
function ENT:DrawTranslucent()
|
||||||
self:SetRenderBounds(minb, maxb)
|
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()
|
render.SetColorMaterial()
|
||||||
|
|
||||||
red.a = math.Clamp(LocalPlayer():GetPos():Distance(self:GetPos()) * 0.2, 25, 200)
|
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
|
for i = 0, 16 do
|
||||||
circlepos:SetUnpacked(math.cos(angle)*radius, math.sin(angle)*radius, 0)
|
local angle = i * math.pi * 2 / 16 + self.offset
|
||||||
local newpos = self:GetPos()+circlepos
|
|
||||||
render.DrawBeam(newpos, newpos+circleup, 8, 0, 1, red, true)
|
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
|
end
|
||||||
|
|
||||||
-- local bmin, bmax = self:GetRenderBounds()
|
-- local bmin, bmax = self:GetRenderBounds()
|
||||||
-- render.DrawWireframeBox(self:GetPos(), angle_zero, bmin, bmax)
|
-- 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
|
if self.offset >= 180 then
|
||||||
self.offset = 0
|
self.offset = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ENT:Draw()
|
function ENT:Draw()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local circlesprite = Material("circle.png","nocull")
|
local circlesprite = Material("circle.png", "nocull")
|
||||||
|
|
||||||
function ENT:DrawLOC()
|
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)
|
render.SetMaterial(circlesprite)
|
||||||
|
|
||||||
red.a = math.Clamp(LocalPlayer():GetPos():Distance(self:GetPos()) * 0.2, 25, 200)
|
red.a = math.Clamp(LocalPlayer():GetPos():Distance(self:GetPos()) * 0.2, 25, 200)
|
||||||
|
|
||||||
local f = LocalPlayer():EyeAngles():Forward()
|
local f = LocalPlayer():EyeAngles():Forward()
|
||||||
for i=0, 16 do
|
|
||||||
local angle = i * math.pi*2 / 16 + self.offset
|
for i = 0, 16 do
|
||||||
circlepos:SetUnpacked(math.cos(angle)*radius, math.sin(angle)*radius, 0)
|
local angle = i * math.pi * 2 / 16 + self.offset
|
||||||
local newpos = self:GetPos()+circlepos
|
|
||||||
|
circlepos:SetUnpacked(math.cos(angle) * radius, math.sin(angle) * radius, 0)
|
||||||
|
|
||||||
|
local newpos = self:GetPos() + circlepos
|
||||||
-- render.DrawLine(newpos, newpos+VectorRand()*5, red)
|
-- render.DrawLine(newpos, newpos+VectorRand()*5, red)
|
||||||
render.DrawQuadEasy(newpos,f,6,6,red)
|
|
||||||
|
render.DrawQuadEasy(newpos, f, 6, 6, red)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- local bmin, bmax = self:GetRenderBounds()
|
-- local bmin, bmax = self:GetRenderBounds()
|
||||||
-- render.DrawWireframeBox(self:GetPos(), angle_zero, bmin, bmax)
|
-- 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
|
if self.offset >= 180 then
|
||||||
self.offset = 0
|
self.offset = 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,35 +1,35 @@
|
||||||
SWEP.ViewModel = "models/weapons/c_357.mdl"
|
SWEP.ViewModel = "models/weapons/c_357.mdl"
|
||||||
SWEP.WorldModel = "models/weapons/w_357.mdl"
|
SWEP.WorldModel = "models/weapons/w_357.mdl"
|
||||||
|
|
||||||
SWEP.Weight = 5
|
SWEP.Weight = 5
|
||||||
SWEP.AutoSwitchTo = false
|
SWEP.AutoSwitchTo = false
|
||||||
SWEP.AutoSwitchFrom = false
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
SWEP.Slot = 1
|
SWEP.Slot = 1
|
||||||
SWEP.SlotPos = 2
|
SWEP.SlotPos = 2
|
||||||
SWEP.DrawAmmo = true
|
SWEP.DrawAmmo = true
|
||||||
SWEP.DrawCrosshair = true
|
SWEP.DrawCrosshair = true
|
||||||
|
|
||||||
SWEP.Primary.ClipSize = 6
|
SWEP.Primary.ClipSize = 6
|
||||||
SWEP.Primary.DefaultClip = 0
|
SWEP.Primary.DefaultClip = 0
|
||||||
SWEP.Primary.Automatic = false
|
SWEP.Primary.Automatic = false
|
||||||
SWEP.Primary.Ammo = "357"
|
SWEP.Primary.Ammo = "357"
|
||||||
|
|
||||||
|
SWEP.Secondary.ClipSize = -1
|
||||||
|
SWEP.Secondary.DefaultClip = -1
|
||||||
|
SWEP.Secondary.Automatic = false
|
||||||
|
SWEP.Secondary.Ammo = "none"
|
||||||
|
|
||||||
SWEP.UseHands = true
|
SWEP.UseHands = true
|
||||||
|
|
||||||
SWEP.Secondary.ClipSize = -1
|
|
||||||
SWEP.Secondary.DefaultClip = -1
|
|
||||||
SWEP.Secondary.Automatic = false
|
|
||||||
SWEP.Secondary.Ammo = "none"
|
|
||||||
|
|
||||||
SWEP.Spawnable = true
|
SWEP.Spawnable = true
|
||||||
SWEP.BobScale = 0
|
SWEP.BobScale = 0
|
||||||
SWEP.SwayScale = 0
|
SWEP.SwayScale = 0
|
||||||
SWEP.ViewModelFOV = 70
|
SWEP.ViewModelFOV = 70
|
||||||
|
|
||||||
SWEP.PrintName = "357" -- This will be shown in the spawn menu, and in the weapon selection menu
|
SWEP.PrintName = "357"
|
||||||
SWEP.Author = "datae" -- These two options will be shown when you have the weapon highlighted in the weapon selection menu
|
SWEP.Author = "datae"
|
||||||
SWEP.Instructions = ""
|
SWEP.Instructions = ""
|
||||||
|
|
||||||
SWEP.BulletData = {}
|
SWEP.BulletData = {}
|
||||||
SWEP.Damage = 150
|
SWEP.Damage = 150
|
||||||
|
@ -67,173 +67,172 @@ SWEP.OffsetPos = Vector(0,0,-2)
|
||||||
SWEP.OffsetAng = Angle()
|
SWEP.OffsetAng = Angle()
|
||||||
|
|
||||||
local coolswayCT = 0
|
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
|
end
|
||||||
|
|
||||||
function SWEP:Move_Process(EyePos, EyeAng, velocity)
|
function SWEP:Move_Process(EyePos, EyeAng, velocity)
|
||||||
local VMPos, VMAng = self.VMPos, self.VMAng
|
local VMPos, VMAng = self.VMPos, self.VMAng
|
||||||
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
||||||
local VMPosOffset_Lerp, VMAngOffset_Lerp = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
|
local VMPosOffset_Lerp, VMAngOffset_Lerp = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
|
||||||
local FT = FrameTime()
|
local FT = FrameTime()
|
||||||
local sightedmult = 1
|
local sightedmult = 1
|
||||||
|
|
||||||
VMPos:Set(vector_origin)
|
VMPos:Set(vector_origin)
|
||||||
VMAng:Set(angle_zero)
|
VMAng:Set(angle_zero)
|
||||||
|
|
||||||
VMPosOffset.x = self:GetOwner():GetVelocity().z*0.0015 * sightedmult
|
VMPosOffset.x = self:GetOwner():GetVelocity().z * 0.0015 * sightedmult
|
||||||
VMPosOffset.y = math.Clamp(velocity.y*-0.004, -1, 1) * 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.x = Lerp(8 * FT, VMPosOffset_Lerp.x, VMPosOffset.x)
|
||||||
VMPosOffset_Lerp.y = Lerp(8*FT, VMPosOffset_Lerp.y, VMPosOffset.y)
|
VMPosOffset_Lerp.y = Lerp(8 * FT, VMPosOffset_Lerp.y, VMPosOffset.y)
|
||||||
|
|
||||||
VMAngOffset.x = math.Clamp(VMPosOffset.x * 8, -4, 4)
|
|
||||||
VMAngOffset.y = VMPosOffset.y * 5
|
|
||||||
VMAngOffset.z = VMPosOffset.y * 0.5 + (VMPosOffset.x * -5)
|
|
||||||
|
|
||||||
VMAngOffset_Lerp.x = LerpC(10*FT, VMAngOffset_Lerp.x, VMAngOffset.x, 0.75)
|
|
||||||
VMAngOffset_Lerp.y = LerpC(5*FT, VMAngOffset_Lerp.y, VMAngOffset.y, 0.6)
|
|
||||||
VMAngOffset_Lerp.z = Lerp(25*FT, VMAngOffset_Lerp.z, VMAngOffset.z)
|
|
||||||
|
|
||||||
VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x)
|
VMAngOffset.x = math.Clamp(VMPosOffset.x * 8, -4, 4)
|
||||||
VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y)
|
VMAngOffset.y = VMPosOffset.y * 5
|
||||||
|
VMAngOffset.z = VMPosOffset.y * 0.5 + (VMPosOffset.x * -5)
|
||||||
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
|
end
|
||||||
|
|
||||||
local stepend = math.pi*4
|
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)
|
|
||||||
|
|
||||||
if self.StepBob >= stepend then
|
function SWEP:Step_Process(EyePos, EyeAng, velocity)
|
||||||
self.StepBob = 0
|
local CT = CurTime()
|
||||||
self.StepRandomX = math.Rand(1,1.5)
|
|
||||||
self.StepRandomY = math.Rand(1,1.5)
|
if CT > coolswayCT then
|
||||||
end
|
coolswayCT = CT
|
||||||
|
else
|
||||||
if velocity == 0 then
|
return
|
||||||
self.StepBob = 0
|
end
|
||||||
end
|
|
||||||
|
local VMPos, VMAng = self.VMPos, self.VMAng
|
||||||
if onground then
|
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
||||||
VMPosOffset.x = (math.sin(self.StepBob) * velocity * 0.000375 * sightedmult) * self.StepRandomX
|
local VMPosOffset_Lerp, _ = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
|
||||||
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
|
velocity = math.min(velocity:Length(), 500)
|
||||||
end
|
|
||||||
|
local delta = math.abs(self.StepBob * 2 / stepend - 1)
|
||||||
VMPosOffset_Lerp.x = Lerp(16*FT, VMPosOffset_Lerp.x, VMPosOffset.x)
|
local FT = FrameTime()
|
||||||
VMPosOffset_Lerp.y = Lerp(4*FT, VMPosOffset_Lerp.y, VMPosOffset.y)
|
local FTMult = 300 * FT
|
||||||
VMPosOffset_Lerp.z = Lerp(2*FT, VMPosOffset_Lerp.z, VMPosOffset.z)
|
local sightedmult = 1
|
||||||
|
-- local sprintmult = 1
|
||||||
VMAngOffset.x = VMPosOffset_Lerp.x * 2
|
local onground = self:GetOwner():OnGround()
|
||||||
VMAngOffset.y = VMPosOffset_Lerp.y * -7.5
|
self.StepBob = self.StepBob + (velocity * 0.00015 + (math.pow(delta, 0.01) * 0.03)) * FTMult
|
||||||
VMAngOffset.z = VMPosOffset_Lerp.y * 5
|
|
||||||
|
if self.StepBob >= stepend then
|
||||||
|
self.StepBob = 0
|
||||||
VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x)
|
self.StepRandomX = math.Rand(1, 1.5)
|
||||||
VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y)
|
self.StepRandomY = math.Rand(1, 1.5)
|
||||||
VMPos:Add(VMAng:Forward() * VMPosOffset_Lerp.z)
|
end
|
||||||
|
|
||||||
VMAng:Add(VMAngOffset)
|
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
|
end
|
||||||
|
|
||||||
function SWEP:Breath_Health()
|
function SWEP:Breath_Health()
|
||||||
local owner = self:GetOwner()
|
local owner = self:GetOwner()
|
||||||
if !IsValid(owner) then return end
|
|
||||||
local health = owner:Health()
|
if not IsValid(owner) then return end
|
||||||
local maxhealth = owner:GetMaxHealth()
|
|
||||||
|
local health = owner:Health()
|
||||||
self.Breath_Intensity = math.Clamp( maxhealth / health, 0, 2 )
|
local maxhealth = owner:GetMaxHealth()
|
||||||
self.Breath_Rate = math.Clamp( ((maxhealth*0.5) / health ), 1, 1.5 )
|
|
||||||
|
self.Breath_Intensity = math.Clamp(maxhealth / health, 0, 2)
|
||||||
|
self.Breath_Rate = math.Clamp((maxhealth * 0.5) / health, 1, 1.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Breath_StateMult()
|
function SWEP:Breath_StateMult()
|
||||||
local owner = self:GetOwner()
|
local owner = self:GetOwner()
|
||||||
if !IsValid(owner) then return end
|
|
||||||
local sightedmult = 1
|
if not IsValid(owner) then return end
|
||||||
|
|
||||||
self.Breath_Intensity = self.Breath_Intensity * sightedmult
|
local sightedmult = 1
|
||||||
|
|
||||||
|
self.Breath_Intensity = self.Breath_Intensity * sightedmult
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Breath_Process(EyePos, EyeAng)
|
function SWEP:Breath_Process(EyePos, EyeAng)
|
||||||
local VMPos, VMAng = self.VMPos, self.VMAng
|
local VMPos, VMAng = self.VMPos, self.VMAng
|
||||||
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
|
||||||
|
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
||||||
self:Breath_Health()
|
|
||||||
self:Breath_StateMult()
|
self:Breath_Health()
|
||||||
VMPosOffset.x = (math.sin(CurTime() * 2 * self.Breath_Rate) * 0.1) * self.Breath_Intensity
|
self:Breath_StateMult()
|
||||||
VMPosOffset.y = (math.sin(CurTime() * 2.5 * self.Breath_Rate) * 0.025) * self.Breath_Intensity
|
|
||||||
|
VMPosOffset.x = (math.sin(CurTime() * 2 * self.Breath_Rate) * 0.1) * self.Breath_Intensity
|
||||||
VMAngOffset.x = VMPosOffset.x * 1.5
|
VMPosOffset.y = (math.sin(CurTime() * 2.5 * self.Breath_Rate) * 0.025) * self.Breath_Intensity
|
||||||
VMAngOffset.y = VMPosOffset.y * 2
|
VMAngOffset.x = VMPosOffset.x * 1.5
|
||||||
|
VMAngOffset.y = VMPosOffset.y * 2
|
||||||
VMPos:Add(VMAng:Up() * VMPosOffset.x)
|
|
||||||
VMPos:Add(VMAng:Right() * VMPosOffset.y)
|
VMPos:Add(VMAng:Up() * VMPosOffset.x)
|
||||||
|
VMPos:Add(VMAng:Right() * VMPosOffset.y)
|
||||||
VMAng:Add(VMAngOffset)
|
VMAng:Add(VMAngOffset)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Look_Process(EyePos, EyeAng)
|
function SWEP:Look_Process(EyePos, EyeAng)
|
||||||
local VMPos, VMAng = self.VMPos, self.VMAng
|
local VMPos, VMAng = self.VMPos, self.VMAng
|
||||||
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
||||||
local FT = FrameTime()
|
local FT = FrameTime()
|
||||||
local sightedmult = 1
|
local sightedmult = 1
|
||||||
self.SmoothEyeAng = LerpAngle(0.05, self.SmoothEyeAng, EyeAng-self.LastEyeAng)
|
|
||||||
|
|
||||||
VMPosOffset.x = -self.SmoothEyeAng.x * -1 * sightedmult
|
self.SmoothEyeAng = LerpAngle(0.05, self.SmoothEyeAng, EyeAng - self.LastEyeAng)
|
||||||
VMPosOffset.y = self.SmoothEyeAng.y * 0.5 * sightedmult
|
|
||||||
|
|
||||||
VMAngOffset.x = VMPosOffset.x * 2.5
|
VMPosOffset.x = -self.SmoothEyeAng.x * -1 * sightedmult
|
||||||
VMAngOffset.y = VMPosOffset.y * 1.25
|
VMPosOffset.y = self.SmoothEyeAng.y * 0.5 * sightedmult
|
||||||
VMAngOffset.z = VMPosOffset.y * 2
|
|
||||||
|
VMAngOffset.x = VMPosOffset.x * 2.5
|
||||||
self.VMLookLerp.y = Lerp(FT*10, self.VMLookLerp.y, VMAngOffset.y * 1.5 + self.SmoothEyeAng.y)
|
VMAngOffset.y = VMPosOffset.y * 1.25
|
||||||
|
VMAngOffset.z = VMPosOffset.y * 2
|
||||||
VMAng.y = VMAng.y - self.VMLookLerp.y
|
|
||||||
|
self.VMLookLerp.y = Lerp(FT * 10, self.VMLookLerp.y, VMAngOffset.y * 1.5 + self.SmoothEyeAng.y)
|
||||||
VMPos:Add(VMAng:Up() * VMPosOffset.x)
|
|
||||||
VMPos:Add(VMAng:Right() * VMPosOffset.y)
|
VMAng.y = VMAng.y - self.VMLookLerp.y
|
||||||
|
|
||||||
VMAng:Add(VMAngOffset)
|
VMPos:Add(VMAng:Up() * VMPosOffset.x)
|
||||||
|
VMPos:Add(VMAng:Right() * VMPosOffset.y)
|
||||||
|
VMAng:Add(VMAngOffset)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:GetVMPosition(EyePos, EyeAng)
|
function SWEP:GetVMPosition(EyePos, EyeAng)
|
||||||
return self.VMPos, self.VMAng
|
return self.VMPos, self.VMAng
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:GetViewModelPosition(eyepos, eyeang)
|
function SWEP:GetViewModelPosition(eyepos, eyeang)
|
||||||
return self:GetVMPosition(eyepos, eyeang)
|
return self:GetVMPosition(eyepos, eyeang)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function SWEP:Deploy()
|
function SWEP:Deploy()
|
||||||
self:SendWeaponAnim(ACT_VM_DRAW)
|
self:SendWeaponAnim(ACT_VM_DRAW)
|
||||||
self:SetNextPrimaryFire(CurTime()+0.5)
|
self:SetNextPrimaryFire(CurTime() + 0.5)
|
||||||
self:SetHoldType( "revolver" )
|
self:SetHoldType("revolver")
|
||||||
|
|
||||||
if CLIENT then
|
if CLIENT then
|
||||||
self.CLVM = ClientsideModel(self.ViewModel)
|
self.CLVM = ClientsideModel(self.ViewModel)
|
||||||
self:SetNoDraw(true)
|
self:SetNoDraw(true)
|
||||||
|
@ -244,6 +243,7 @@ function SWEP:Holster()
|
||||||
if IsValid(self.CLVM) then
|
if IsValid(self.CLVM) then
|
||||||
self.CLVM:Remove()
|
self.CLVM:Remove()
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -255,22 +255,23 @@ end
|
||||||
|
|
||||||
function SWEP:GenerateBullet()
|
function SWEP:GenerateBullet()
|
||||||
local tbl = self.BulletData
|
local tbl = self.BulletData
|
||||||
tbl.Attacker = self.Owner
|
tbl.Attacker = self:GetOwner()
|
||||||
tbl.Damage = self.Damage
|
tbl.Damage = self.Damage
|
||||||
tbl.Force = self.Force
|
tbl.Force = self.Force
|
||||||
tbl.Distance = self.Distance
|
tbl.Distance = self.Distance
|
||||||
tbl.Num = 1
|
tbl.Num = 1
|
||||||
tbl.Spread = vector_origin
|
tbl.Spread = vector_origin
|
||||||
|
tbl.Src = self:GetOwner():GetShootPos()
|
||||||
tbl.Src = self.Owner:GetShootPos()
|
tbl.Dir = self:GetOwner():EyeAngles():Forward()
|
||||||
tbl.Dir = self.Owner:EyeAngles():Forward()
|
|
||||||
return tbl
|
return tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:MuzzleFlash()
|
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()
|
local ed = EffectData()
|
||||||
ed:SetOrigin( vPoint )
|
|
||||||
|
ed:SetOrigin(vPoint)
|
||||||
ed:SetScale(1)
|
ed:SetScale(1)
|
||||||
ed:SetEntity(self)
|
ed:SetEntity(self)
|
||||||
end
|
end
|
||||||
|
@ -280,11 +281,15 @@ function SWEP:DryFire()
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Reload()
|
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
|
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.ReloadTime = CurTime() + AnimationTime
|
||||||
|
|
||||||
self:SetNextPrimaryFire(CurTime() + AnimationTime)
|
self:SetNextPrimaryFire(CurTime() + AnimationTime)
|
||||||
self:SetNextSecondaryFire(CurTime() + AnimationTime)
|
self:SetNextSecondaryFire(CurTime() + AnimationTime)
|
||||||
self:EmitSound("Weapon_357.Reload")
|
self:EmitSound("Weapon_357.Reload")
|
||||||
|
@ -299,47 +304,52 @@ end
|
||||||
|
|
||||||
function SWEP:PostDrawViewModel(vm, wep, ply)
|
function SWEP:PostDrawViewModel(vm, wep, ply)
|
||||||
local EyePos, EyeAng = EyePos(), EyeAngles()
|
local EyePos, EyeAng = EyePos(), EyeAngles()
|
||||||
local velocity = self:GetOwner():GetVelocity()
|
local velocity = self:GetOwner():GetVelocity()
|
||||||
velocity = WorldToLocal(velocity, angle_zero, vector_origin, EyeAng)
|
|
||||||
self:Move_Process(EyePos, EyeAng, velocity)
|
velocity = WorldToLocal(velocity, angle_zero, vector_origin, EyeAng)
|
||||||
self:Step_Process(EyePos, EyeAng, velocity)
|
|
||||||
self:Breath_Process(EyePos, EyeAng)
|
self:Move_Process(EyePos, EyeAng, velocity)
|
||||||
self:Look_Process(EyePos, EyeAng)
|
self:Step_Process(EyePos, EyeAng, velocity)
|
||||||
|
self:Breath_Process(EyePos, EyeAng)
|
||||||
self.LastEyeAng = EyeAng
|
self:Look_Process(EyePos, EyeAng)
|
||||||
self.LastEyePos = EyePos
|
self.LastEyeAng = EyeAng
|
||||||
self.LastVelocity = velocity
|
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)
|
self.VMPos:Set(offsetpos)
|
||||||
|
|
||||||
if CLIENT and IsValid(self.CLVM) then
|
if CLIENT and IsValid(self.CLVM) then
|
||||||
cam.Start3D(vector_origin, angle_zero, self.Owner:GetFOV()*0.8)
|
cam.Start3D(vector_origin, angle_zero, self:GetOwner():GetFOV() * 0.8)
|
||||||
cam.IgnoreZ(true)
|
cam.IgnoreZ(true)
|
||||||
self.CLVM:SetPos(self.VMPos)
|
|
||||||
self.CLVM:SetAngles(self.VMAng)
|
self.CLVM:SetPos(self.VMPos)
|
||||||
|
self.CLVM:SetAngles(self.VMAng)
|
||||||
ply:GetHands():SetParent(self.CLVM)
|
|
||||||
ply:GetHands():SetupBones()
|
ply:GetHands():SetParent(self.CLVM)
|
||||||
ply:GetHands():DrawModel()
|
ply:GetHands():SetupBones()
|
||||||
|
ply:GetHands():DrawModel()
|
||||||
self.CLVM:SetSequence(vm:GetSequence())
|
|
||||||
self.CLVM:SetCycle(vm:GetCycle())
|
self.CLVM:SetSequence(vm:GetSequence())
|
||||||
|
self.CLVM:SetCycle(vm:GetCycle())
|
||||||
self.CLVM:SetupBones()
|
self.CLVM:SetupBones()
|
||||||
self.CLVM:DrawModel()
|
self.CLVM:DrawModel()
|
||||||
cam.IgnoreZ(false)
|
|
||||||
|
cam.IgnoreZ(false)
|
||||||
cam.End3D()
|
cam.End3D()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:PreDrawViewModel(vm, wep, ply)
|
function SWEP:PreDrawViewModel(vm, wep, ply)
|
||||||
-- self:PostDrawViewModel(vm, wep, ply)
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
hook.Add("PreDrawTranslucentRenderables","ae", function()
|
-- self:PostDrawViewModel(vm, wep, ply)
|
||||||
|
hook.Add("PreDrawTranslucentRenderables", "ae", function()
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
local activewep = ply:GetActiveWeapon()
|
local activewep = ply:GetActiveWeapon()
|
||||||
|
|
||||||
if activewep.CLVM then
|
if activewep.CLVM then
|
||||||
activewep:PostDrawViewModel(ply:GetViewModel(), activewep, ply)
|
activewep:PostDrawViewModel(ply:GetViewModel(), activewep, ply)
|
||||||
end
|
end
|
||||||
|
@ -348,33 +358,36 @@ end)
|
||||||
hook.Add("VManipVMEntity", "ae", function()
|
hook.Add("VManipVMEntity", "ae", function()
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
local activewep = ply:GetActiveWeapon()
|
local activewep = ply:GetActiveWeapon()
|
||||||
if activewep.CLVM then
|
|
||||||
return activewep.CLVM
|
if activewep.CLVM then return activewep.CLVM end
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hook.Add("VManipLegsVMEntity", "ae", function()
|
hook.Add("VManipLegsVMEntity", "ae", function()
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
local activewep = ply:GetActiveWeapon()
|
local activewep = ply:GetActiveWeapon()
|
||||||
if activewep.CLVM then
|
|
||||||
return activewep.CLVM
|
if activewep.CLVM then return activewep.CLVM end
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function SWEP:PrimaryAttack()
|
function SWEP:PrimaryAttack()
|
||||||
if self:Clip1() < 1 then
|
if self:Clip1() < 1 then
|
||||||
self:DryFire()
|
self:DryFire()
|
||||||
self:SetNextPrimaryFire(CurTime()+1)
|
self:SetNextPrimaryFire(CurTime() + 1)
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self:SetClip1(self:Clip1()-1)
|
|
||||||
self.Owner:MuzzleFlash()
|
self:SetClip1(self:Clip1() - 1)
|
||||||
|
self:GetOwner():MuzzleFlash()
|
||||||
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
|
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
|
||||||
self:SetNextPrimaryFire(CurTime()+0.65)
|
self:SetNextPrimaryFire(CurTime() + 0.65)
|
||||||
self:EmitSound("Weapon_357.Single")
|
self:EmitSound("Weapon_357.Single")
|
||||||
self:FireBullets( self:GenerateBullet() )
|
self:FireBullets(self:GenerateBullet())
|
||||||
self.Owner:ViewPunch(Angle(-10,0,0))
|
self:GetOwner():ViewPunch(Angle(-10, 0, 0))
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:SecondaryAttack()
|
function SWEP:SecondaryAttack()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
|
@ -1,35 +1,35 @@
|
||||||
SWEP.ViewModel = "models/weapons/c_smg1.mdl"
|
SWEP.ViewModel = "models/weapons/c_smg1.mdl"
|
||||||
SWEP.WorldModel = "models/weapons/w_357.mdl"
|
SWEP.WorldModel = "models/weapons/w_357.mdl"
|
||||||
|
|
||||||
SWEP.Weight = 5
|
SWEP.Weight = 5
|
||||||
SWEP.AutoSwitchTo = false
|
SWEP.AutoSwitchTo = false
|
||||||
SWEP.AutoSwitchFrom = false
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
SWEP.Slot = 1
|
SWEP.Slot = 1
|
||||||
SWEP.SlotPos = 2
|
SWEP.SlotPos = 2
|
||||||
SWEP.DrawAmmo = true
|
SWEP.DrawAmmo = true
|
||||||
SWEP.DrawCrosshair = true
|
SWEP.DrawCrosshair = true
|
||||||
|
|
||||||
SWEP.Primary.ClipSize = 45
|
SWEP.Primary.ClipSize = 45
|
||||||
SWEP.Primary.DefaultClip = 45
|
SWEP.Primary.DefaultClip = 45
|
||||||
SWEP.Primary.Automatic = true
|
SWEP.Primary.Automatic = true
|
||||||
SWEP.Primary.Ammo = "smg1"
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
|
||||||
SWEP.UseHands = true
|
SWEP.UseHands = true
|
||||||
|
|
||||||
SWEP.Secondary.ClipSize = -1
|
SWEP.Secondary.ClipSize = -1
|
||||||
SWEP.Secondary.DefaultClip = -1
|
SWEP.Secondary.DefaultClip = -1
|
||||||
SWEP.Secondary.Automatic = false
|
SWEP.Secondary.Automatic = false
|
||||||
SWEP.Secondary.Ammo = "none"
|
SWEP.Secondary.Ammo = "none"
|
||||||
|
|
||||||
SWEP.Spawnable = true
|
SWEP.Spawnable = true
|
||||||
SWEP.BobScale = 0
|
SWEP.BobScale = 0
|
||||||
SWEP.SwayScale = 0
|
SWEP.SwayScale = 0
|
||||||
SWEP.ViewModelFOV = 70
|
SWEP.ViewModelFOV = 70
|
||||||
|
|
||||||
SWEP.PrintName = "AE" -- This will be shown in the spawn menu, and in the weapon selection menu
|
SWEP.PrintName = "AE"
|
||||||
SWEP.Author = "datae" -- These two options will be shown when you have the weapon highlighted in the weapon selection menu
|
SWEP.Author = "datae"
|
||||||
SWEP.Instructions = ""
|
SWEP.Instructions = ""
|
||||||
|
|
||||||
SWEP.BulletData = {}
|
SWEP.BulletData = {}
|
||||||
SWEP.Damage = 15
|
SWEP.Damage = 15
|
||||||
|
@ -68,210 +68,212 @@ SWEP.OffsetAng = Angle()
|
||||||
|
|
||||||
local coolswayCT = 0
|
local coolswayCT = 0
|
||||||
local oldCT = 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
|
end
|
||||||
|
|
||||||
function SWEP:Move_Process(EyePos, EyeAng, velocity)
|
function SWEP:Move_Process(EyePos, EyeAng, velocity)
|
||||||
local VMPos, VMAng = self.VMPos, self.VMAng
|
local VMPos, VMAng = self.VMPos, self.VMAng
|
||||||
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
||||||
local VMPosOffset_Lerp, VMAngOffset_Lerp = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
|
local VMPosOffset_Lerp, VMAngOffset_Lerp = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
|
||||||
local FT = FrameTime()
|
local FT = FrameTime()
|
||||||
local sightedmult = 1
|
local sightedmult = 1
|
||||||
|
|
||||||
VMPos:Set(EyePos)
|
VMPos:Set(EyePos)
|
||||||
VMAng:Set(EyeAng)
|
VMAng:Set(EyeAng)
|
||||||
|
|
||||||
VMPosOffset.x = self:GetOwner():GetVelocity().z*0.0015 * sightedmult
|
VMPosOffset.x = self:GetOwner():GetVelocity().z * 0.0015 * sightedmult
|
||||||
VMPosOffset.y = math.Clamp(velocity.y*-0.004, -1, 1) * 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)
|
VMAngOffset.x = math.Clamp(VMPosOffset.x * 8, -4, 4)
|
||||||
VMPosOffset_Lerp.y = Lerp(8*FT, VMPosOffset_Lerp.y, VMPosOffset.y)
|
VMAngOffset.y = VMPosOffset.y * -1
|
||||||
|
VMAngOffset.z = VMPosOffset.y * 0.5 + (VMPosOffset.x * -5)
|
||||||
VMAngOffset.x = math.Clamp(VMPosOffset.x * 8, -4, 4)
|
|
||||||
VMAngOffset.y = VMPosOffset.y * -1
|
|
||||||
VMAngOffset.z = VMPosOffset.y * 0.5 + (VMPosOffset.x * -5)
|
|
||||||
|
|
||||||
VMAngOffset_Lerp.x = LerpC(10*FT, VMAngOffset_Lerp.x, VMAngOffset.x, 0.75)
|
|
||||||
VMAngOffset_Lerp.y = LerpC(5*FT, VMAngOffset_Lerp.y, VMAngOffset.y, 0.6)
|
|
||||||
VMAngOffset_Lerp.z = Lerp(25*FT, VMAngOffset_Lerp.z, VMAngOffset.z)
|
|
||||||
|
|
||||||
VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x)
|
VMAngOffset_Lerp.x = LerpC(10 * FT, VMAngOffset_Lerp.x, VMAngOffset.x, 0.75)
|
||||||
VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y)
|
VMAngOffset_Lerp.y = LerpC(5 * FT, VMAngOffset_Lerp.y, VMAngOffset.y, 0.6)
|
||||||
|
VMAngOffset_Lerp.z = Lerp(25 * FT, VMAngOffset_Lerp.z, VMAngOffset.z)
|
||||||
VMAng:Add(VMAngOffset_Lerp)
|
|
||||||
|
VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x)
|
||||||
|
VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y)
|
||||||
|
VMAng:Add(VMAngOffset_Lerp)
|
||||||
end
|
end
|
||||||
|
|
||||||
local stepend = math.pi*4
|
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)
|
|
||||||
|
|
||||||
if self.StepBob >= stepend then
|
function SWEP:Step_Process(EyePos, EyeAng, velocity)
|
||||||
self.StepBob = 0
|
local CT = CurTime()
|
||||||
self.StepRandomX = math.Rand(1,1.5)
|
|
||||||
self.StepRandomY = math.Rand(1,1.5)
|
if CT > coolswayCT then
|
||||||
end
|
coolswayCT = CT
|
||||||
|
else
|
||||||
if velocity == 0 then
|
return
|
||||||
self.StepBob = 0
|
end
|
||||||
end
|
|
||||||
|
local VMPos, VMAng = self.VMPos, self.VMAng
|
||||||
if onground then
|
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
||||||
VMPosOffset.x = (math.sin(self.StepBob) * velocity * 0.000375 * sightedmult) * self.StepRandomX
|
local VMPosOffset_Lerp, _ = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
|
||||||
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
|
velocity = math.min(velocity:Length(), 500)
|
||||||
end
|
|
||||||
|
local delta = math.abs(self.StepBob * 2 / stepend - 1)
|
||||||
VMPosOffset_Lerp.x = Lerp(16*FT, VMPosOffset_Lerp.x, VMPosOffset.x)
|
local FT = FrameTime()
|
||||||
VMPosOffset_Lerp.y = Lerp(4*FT, VMPosOffset_Lerp.y, VMPosOffset.y)
|
local FTMult = 300 * FT
|
||||||
VMPosOffset_Lerp.z = Lerp(2*FT, VMPosOffset_Lerp.z, VMPosOffset.z)
|
local sightedmult = 1
|
||||||
|
-- local sprintmult = 1
|
||||||
VMAngOffset.x = VMPosOffset_Lerp.x * 2
|
local onground = self:GetOwner():OnGround()
|
||||||
VMAngOffset.y = VMPosOffset_Lerp.y * -7.5
|
self.StepBob = self.StepBob + (velocity * 0.00015 + (math.pow(delta, 0.01) * 0.03)) * FTMult
|
||||||
VMAngOffset.z = VMPosOffset_Lerp.y * 5
|
|
||||||
|
if self.StepBob >= stepend then
|
||||||
|
self.StepBob = 0
|
||||||
VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x)
|
self.StepRandomX = math.Rand(1, 1.5)
|
||||||
VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y)
|
self.StepRandomY = math.Rand(1, 1.5)
|
||||||
VMPos:Add(VMAng:Forward() * VMPosOffset_Lerp.z)
|
end
|
||||||
|
|
||||||
VMAng:Add(VMAngOffset)
|
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
|
end
|
||||||
|
|
||||||
function SWEP:Breath_Health()
|
function SWEP:Breath_Health()
|
||||||
local owner = self:GetOwner()
|
local owner = self:GetOwner()
|
||||||
if !IsValid(owner) then return end
|
|
||||||
local health = owner:Health()
|
if not IsValid(owner) then return end
|
||||||
local maxhealth = owner:GetMaxHealth()
|
|
||||||
|
local health = owner:Health()
|
||||||
self.Breath_Intensity = math.Clamp( maxhealth / health, 0, 2 )
|
local maxhealth = owner:GetMaxHealth()
|
||||||
self.Breath_Rate = math.Clamp( ((maxhealth*0.5) / health ), 1, 1.5 )
|
|
||||||
|
self.Breath_Intensity = math.Clamp(maxhealth / health, 0, 2)
|
||||||
|
self.Breath_Rate = math.Clamp((maxhealth * 0.5) / health, 1, 1.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Breath_StateMult()
|
function SWEP:Breath_StateMult()
|
||||||
local owner = self:GetOwner()
|
local owner = self:GetOwner()
|
||||||
if !IsValid(owner) then return end
|
|
||||||
local sightedmult = 1
|
if not IsValid(owner) then return end
|
||||||
|
|
||||||
self.Breath_Intensity = self.Breath_Intensity * sightedmult
|
local sightedmult = 1
|
||||||
|
|
||||||
|
self.Breath_Intensity = self.Breath_Intensity * sightedmult
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Breath_Process(EyePos, EyeAng)
|
function SWEP:Breath_Process(EyePos, EyeAng)
|
||||||
local VMPos, VMAng = self.VMPos, self.VMAng
|
local VMPos, VMAng = self.VMPos, self.VMAng
|
||||||
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
||||||
|
|
||||||
self:Breath_Health()
|
self:Breath_Health()
|
||||||
self:Breath_StateMult()
|
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
|
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.x = VMPosOffset.x * 1.5
|
||||||
VMAngOffset.y = VMPosOffset.y * 2
|
VMAngOffset.y = VMPosOffset.y * 2
|
||||||
|
|
||||||
VMPos:Add(VMAng:Up() * VMPosOffset.x)
|
VMPos:Add(VMAng:Up() * VMPosOffset.x)
|
||||||
VMPos:Add(VMAng:Right() * VMPosOffset.y)
|
VMPos:Add(VMAng:Right() * VMPosOffset.y)
|
||||||
|
VMAng:Add(VMAngOffset)
|
||||||
VMAng:Add(VMAngOffset)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Look_Process(EyePos, EyeAng)
|
function SWEP:Look_Process(EyePos, EyeAng)
|
||||||
local VMPos, VMAng = self.VMPos, self.VMAng
|
local VMPos, VMAng = self.VMPos, self.VMAng
|
||||||
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
||||||
local FT = FrameTime()
|
local FT = FrameTime()
|
||||||
local sightedmult = 1
|
local sightedmult = 1
|
||||||
self.SmoothEyeAng = LerpAngle(FT*5, self.SmoothEyeAng, EyeAng-self.LastEyeAng)
|
|
||||||
|
|
||||||
VMPosOffset.x = -self.SmoothEyeAng.x * -1 * sightedmult
|
self.SmoothEyeAng = LerpAngle(FT * 5, self.SmoothEyeAng, EyeAng - self.LastEyeAng)
|
||||||
VMPosOffset.y = self.SmoothEyeAng.y * 0.5 * sightedmult
|
|
||||||
|
|
||||||
VMAngOffset.x = VMPosOffset.x * 2.5
|
VMPosOffset.x = -self.SmoothEyeAng.x * -1 * sightedmult
|
||||||
VMAngOffset.y = VMPosOffset.y * 1.25
|
VMPosOffset.y = self.SmoothEyeAng.y * 0.5 * sightedmult
|
||||||
VMAngOffset.z = VMPosOffset.y * 2
|
|
||||||
|
VMAngOffset.x = VMPosOffset.x * 2.5
|
||||||
self.VMLookLerp.y = Lerp(FT*10, self.VMLookLerp.y, VMAngOffset.y * 1.5 + self.SmoothEyeAng.y)
|
VMAngOffset.y = VMPosOffset.y * 1.25
|
||||||
|
VMAngOffset.z = VMPosOffset.y * 2
|
||||||
VMAng.y = VMAng.y - self.VMLookLerp.y
|
|
||||||
|
self.VMLookLerp.y = Lerp(FT * 10, self.VMLookLerp.y, VMAngOffset.y * 1.5 + self.SmoothEyeAng.y)
|
||||||
VMPos:Add(VMAng:Up() * VMPosOffset.x)
|
|
||||||
VMPos:Add(VMAng:Right() * VMPosOffset.y)
|
VMAng.y = VMAng.y - self.VMLookLerp.y
|
||||||
|
|
||||||
VMAng:Add(VMAngOffset)
|
VMPos:Add(VMAng:Up() * VMPosOffset.x)
|
||||||
|
VMPos:Add(VMAng:Right() * VMPosOffset.y)
|
||||||
|
VMAng:Add(VMAngOffset)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:GetVMPosition(EyePos, EyeAng)
|
function SWEP:GetVMPosition(EyePos, EyeAng)
|
||||||
if CurTime() == oldCT then return self.VMPos, self.VMAng end
|
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.VMPos:Set(offsetpos)
|
||||||
-- self.VMAng:Add(offsetang)
|
-- self.VMAng:Add(offsetang)
|
||||||
oldCT = CurTime()
|
oldCT = CurTime()
|
||||||
return self.VMPos, self.VMAng
|
|
||||||
|
return self.VMPos, self.VMAng
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:GetViewModelPosition(eyepos, eyeang)
|
function SWEP:GetViewModelPosition(eyepos, eyeang)
|
||||||
return self:GetVMPosition(eyepos, eyeang)
|
return self:GetVMPosition(eyepos, eyeang)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function SWEP:Deploy()
|
function SWEP:Deploy()
|
||||||
self:SendWeaponAnim(ACT_VM_DRAW)
|
self:SendWeaponAnim(ACT_VM_DRAW)
|
||||||
self:SetNextPrimaryFire(CurTime()+0.5)
|
self:SetNextPrimaryFire(CurTime() + 0.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:GenerateBullet()
|
function SWEP:GenerateBullet()
|
||||||
local tbl = self.BulletData
|
local tbl = self.BulletData
|
||||||
tbl.Attacker = self.Owner
|
tbl.Attacker = self:GetOwner()
|
||||||
tbl.Damage = self.Damage
|
tbl.Damage = self.Damage
|
||||||
tbl.Force = self.Force
|
tbl.Force = self.Force
|
||||||
tbl.Distance = self.Distance
|
tbl.Distance = self.Distance
|
||||||
tbl.Num = 1
|
tbl.Num = 1
|
||||||
tbl.Spread = Vector(0.05,0.05,0)
|
tbl.Spread = Vector(0.05, 0.05, 0)
|
||||||
|
tbl.Src = self:GetOwner():GetShootPos()
|
||||||
tbl.Src = self.Owner:GetShootPos()
|
tbl.Dir = self:GetOwner():EyeAngles():Forward()
|
||||||
tbl.Dir = self.Owner:EyeAngles():Forward()
|
|
||||||
return tbl
|
return tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:MuzzleFlash()
|
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()
|
local ed = EffectData()
|
||||||
ed:SetOrigin( vPoint )
|
|
||||||
|
ed:SetOrigin(vPoint)
|
||||||
ed:SetScale(1)
|
ed:SetScale(1)
|
||||||
ed:SetEntity(self)
|
ed:SetEntity(self)
|
||||||
util.Effect( "arccw_shelleffect", ed )
|
|
||||||
|
util.Effect("arccw_shelleffect", ed)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:DryFire()
|
function SWEP:DryFire()
|
||||||
|
@ -279,10 +281,13 @@ function SWEP:DryFire()
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Reload()
|
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
|
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.ReloadTime = CurTime() + AnimationTime
|
||||||
self:SetNextPrimaryFire(CurTime() + AnimationTime)
|
self:SetNextPrimaryFire(CurTime() + AnimationTime)
|
||||||
self:SetNextSecondaryFire(CurTime() + AnimationTime)
|
self:SetNextSecondaryFire(CurTime() + AnimationTime)
|
||||||
|
@ -292,19 +297,26 @@ end
|
||||||
function SWEP:PrimaryAttack()
|
function SWEP:PrimaryAttack()
|
||||||
if self:Clip1() < 1 then
|
if self:Clip1() < 1 then
|
||||||
self:DryFire()
|
self:DryFire()
|
||||||
self:SetNextPrimaryFire(CurTime()+0.5)
|
self:SetNextPrimaryFire(CurTime() + 0.5)
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self:SetClip1(self:Clip1()-1)
|
|
||||||
self.Owner:MuzzleFlash()
|
self:SetClip1(self:Clip1() - 1)
|
||||||
|
self:GetOwner():MuzzleFlash()
|
||||||
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
|
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
|
||||||
self:SetNextPrimaryFire(CurTime()+0.065)
|
self:SetNextPrimaryFire(CurTime() + 0.065)
|
||||||
self:EmitSound("weapons/smg1/smg1_fire1.wav")
|
self:EmitSound("weapons/smg1/smg1_fire1.wav")
|
||||||
self:FireBullets( self:GenerateBullet() )
|
self:FireBullets(self:GenerateBullet())
|
||||||
self.Owner:ViewPunch(Angle(-0.1,0,0))
|
self:GetOwner():ViewPunch(Angle(-0.1, 0, 0))
|
||||||
if IsFirstTimePredicted() then self:MuzzleFlash() end
|
|
||||||
|
if IsFirstTimePredicted() then
|
||||||
|
self:MuzzleFlash()
|
||||||
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:SecondaryAttack()
|
function SWEP:SecondaryAttack()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
|
@ -1,35 +1,35 @@
|
||||||
SWEP.ViewModel = "models/weapons/v_jinrai_srm_s.mdl"
|
SWEP.ViewModel = "models/weapons/v_jinrai_srm_s.mdl"
|
||||||
SWEP.WorldModel = "models/weapons/w_357.mdl"
|
SWEP.WorldModel = "models/weapons/w_357.mdl"
|
||||||
|
|
||||||
SWEP.Weight = 5
|
SWEP.Weight = 5
|
||||||
SWEP.AutoSwitchTo = false
|
SWEP.AutoSwitchTo = false
|
||||||
SWEP.AutoSwitchFrom = false
|
SWEP.AutoSwitchFrom = false
|
||||||
|
|
||||||
SWEP.Slot = 1
|
SWEP.Slot = 1
|
||||||
SWEP.SlotPos = 2
|
SWEP.SlotPos = 2
|
||||||
SWEP.DrawAmmo = true
|
SWEP.DrawAmmo = true
|
||||||
SWEP.DrawCrosshair = true
|
SWEP.DrawCrosshair = true
|
||||||
|
|
||||||
SWEP.Primary.ClipSize = 45
|
SWEP.Primary.ClipSize = 45
|
||||||
SWEP.Primary.DefaultClip = 45
|
SWEP.Primary.DefaultClip = 45
|
||||||
SWEP.Primary.Automatic = true
|
SWEP.Primary.Automatic = true
|
||||||
SWEP.Primary.Ammo = "smg1"
|
SWEP.Primary.Ammo = "smg1"
|
||||||
|
|
||||||
SWEP.UseHands = true
|
SWEP.UseHands = true
|
||||||
|
|
||||||
SWEP.Secondary.ClipSize = -1
|
SWEP.Secondary.ClipSize = -1
|
||||||
SWEP.Secondary.DefaultClip = -1
|
SWEP.Secondary.DefaultClip = -1
|
||||||
SWEP.Secondary.Automatic = false
|
SWEP.Secondary.Automatic = false
|
||||||
SWEP.Secondary.Ammo = "none"
|
SWEP.Secondary.Ammo = "none"
|
||||||
|
|
||||||
SWEP.Spawnable = true
|
SWEP.Spawnable = true
|
||||||
SWEP.BobScale = 0
|
SWEP.BobScale = 0
|
||||||
SWEP.SwayScale = 0
|
SWEP.SwayScale = 0
|
||||||
SWEP.ViewModelFOV = 70
|
SWEP.ViewModelFOV = 70
|
||||||
|
|
||||||
SWEP.PrintName = "AE" -- This will be shown in the spawn menu, and in the weapon selection menu
|
SWEP.PrintName = "AE"
|
||||||
SWEP.Author = "datae" -- These two options will be shown when you have the weapon highlighted in the weapon selection menu
|
SWEP.Author = "datae"
|
||||||
SWEP.Instructions = ""
|
SWEP.Instructions = ""
|
||||||
|
|
||||||
SWEP.BulletData = {}
|
SWEP.BulletData = {}
|
||||||
SWEP.Damage = 15
|
SWEP.Damage = 15
|
||||||
|
@ -62,216 +62,219 @@ SWEP.VelocityLastDiff = 0
|
||||||
SWEP.Breath_Intensity = 1
|
SWEP.Breath_Intensity = 1
|
||||||
SWEP.Breath_Rate = 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.OffsetPos = Vector(0,0,-2)
|
||||||
SWEP.OffsetAng = Angle()
|
SWEP.OffsetAng = Angle()
|
||||||
|
|
||||||
local coolswayCT = 0
|
local coolswayCT = 0
|
||||||
local oldCT = 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
|
end
|
||||||
|
|
||||||
function SWEP:Move_Process(EyePos, EyeAng, velocity)
|
function SWEP:Move_Process(EyePos, EyeAng, velocity)
|
||||||
local VMPos, VMAng = self.VMPos, self.VMAng
|
local VMPos, VMAng = self.VMPos, self.VMAng
|
||||||
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
||||||
local VMPosOffset_Lerp, VMAngOffset_Lerp = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
|
local VMPosOffset_Lerp, VMAngOffset_Lerp = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
|
||||||
local FT = FrameTime()
|
local FT = FrameTime()
|
||||||
local sightedmult = 1
|
local sightedmult = 1
|
||||||
|
|
||||||
VMPos:Set(EyePos)
|
VMPos:Set(EyePos)
|
||||||
VMAng:Set(EyeAng)
|
VMAng:Set(EyeAng)
|
||||||
|
|
||||||
VMPosOffset.x = self:GetOwner():GetVelocity().z*0.0015 * sightedmult
|
VMPosOffset.x = self:GetOwner():GetVelocity().z * 0.0015 * sightedmult
|
||||||
VMPosOffset.y = math.Clamp(velocity.y*-0.004, -1, 1) * 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)
|
VMAngOffset.x = math.Clamp(VMPosOffset.x * 8, -4, 4)
|
||||||
VMPosOffset_Lerp.y = Lerp(8*FT, VMPosOffset_Lerp.y, VMPosOffset.y)
|
VMAngOffset.y = VMPosOffset.y * -1
|
||||||
|
VMAngOffset.z = VMPosOffset.y * 0.5 + (VMPosOffset.x * -5)
|
||||||
VMAngOffset.x = math.Clamp(VMPosOffset.x * 8, -4, 4)
|
|
||||||
VMAngOffset.y = VMPosOffset.y * -1
|
|
||||||
VMAngOffset.z = VMPosOffset.y * 0.5 + (VMPosOffset.x * -5)
|
|
||||||
|
|
||||||
VMAngOffset_Lerp.x = LerpC(10*FT, VMAngOffset_Lerp.x, VMAngOffset.x, 0.75)
|
|
||||||
VMAngOffset_Lerp.y = LerpC(5*FT, VMAngOffset_Lerp.y, VMAngOffset.y, 0.6)
|
|
||||||
VMAngOffset_Lerp.z = Lerp(25*FT, VMAngOffset_Lerp.z, VMAngOffset.z)
|
|
||||||
|
|
||||||
VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x)
|
VMAngOffset_Lerp.x = LerpC(10 * FT, VMAngOffset_Lerp.x, VMAngOffset.x, 0.75)
|
||||||
VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y)
|
VMAngOffset_Lerp.y = LerpC(5 * FT, VMAngOffset_Lerp.y, VMAngOffset.y, 0.6)
|
||||||
|
VMAngOffset_Lerp.z = Lerp(25 * FT, VMAngOffset_Lerp.z, VMAngOffset.z)
|
||||||
VMAng:Add(VMAngOffset_Lerp)
|
|
||||||
|
VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x)
|
||||||
|
VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y)
|
||||||
|
VMAng:Add(VMAngOffset_Lerp)
|
||||||
end
|
end
|
||||||
|
|
||||||
local stepend = math.pi*4
|
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)
|
|
||||||
|
|
||||||
if self.StepBob >= stepend then
|
function SWEP:Step_Process(EyePos, EyeAng, velocity)
|
||||||
self.StepBob = 0
|
local CT = CurTime()
|
||||||
self.StepRandomX = math.Rand(1,1.5)
|
|
||||||
self.StepRandomY = math.Rand(1,1.5)
|
if CT > coolswayCT then
|
||||||
end
|
coolswayCT = CT
|
||||||
|
else
|
||||||
if velocity == 0 then
|
return
|
||||||
self.StepBob = 0
|
end
|
||||||
end
|
|
||||||
|
local VMPos, VMAng = self.VMPos, self.VMAng
|
||||||
if onground then
|
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
||||||
VMPosOffset.x = (math.sin(self.StepBob) * velocity * 0.000375 * sightedmult) * self.StepRandomX
|
local VMPosOffset_Lerp, _ = self.VMPosOffset_Lerp, self.VMAngOffset_Lerp
|
||||||
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
|
velocity = math.min(velocity:Length(), 500)
|
||||||
end
|
|
||||||
|
local delta = math.abs(self.StepBob * 2 / stepend - 1)
|
||||||
VMPosOffset_Lerp.x = Lerp(16*FT, VMPosOffset_Lerp.x, VMPosOffset.x)
|
local FT = FrameTime()
|
||||||
VMPosOffset_Lerp.y = Lerp(4*FT, VMPosOffset_Lerp.y, VMPosOffset.y)
|
local FTMult = 300 * FT
|
||||||
VMPosOffset_Lerp.z = Lerp(2*FT, VMPosOffset_Lerp.z, VMPosOffset.z)
|
local sightedmult = 1
|
||||||
|
-- local sprintmult = 1
|
||||||
VMAngOffset.x = VMPosOffset_Lerp.x * 2
|
local onground = self:GetOwner():OnGround()
|
||||||
VMAngOffset.y = VMPosOffset_Lerp.y * -7.5
|
|
||||||
VMAngOffset.z = VMPosOffset_Lerp.y * 5
|
self.StepBob = self.StepBob + (velocity * 0.00015 + (math.pow(delta, 0.01) * 0.03)) * FTMult
|
||||||
|
|
||||||
|
if self.StepBob >= stepend then
|
||||||
VMPos:Add(VMAng:Up() * VMPosOffset_Lerp.x)
|
self.StepBob = 0
|
||||||
VMPos:Add(VMAng:Right() * VMPosOffset_Lerp.y)
|
self.StepRandomX = math.Rand(1, 1.5)
|
||||||
VMPos:Add(VMAng:Forward() * VMPosOffset_Lerp.z)
|
self.StepRandomY = math.Rand(1, 1.5)
|
||||||
|
end
|
||||||
VMAng:Add(VMAngOffset)
|
|
||||||
|
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
|
end
|
||||||
|
|
||||||
function SWEP:Breath_Health()
|
function SWEP:Breath_Health()
|
||||||
local owner = self:GetOwner()
|
local owner = self:GetOwner()
|
||||||
if !IsValid(owner) then return end
|
|
||||||
local health = owner:Health()
|
if not IsValid(owner) then return end
|
||||||
local maxhealth = owner:GetMaxHealth()
|
|
||||||
|
local health = owner:Health()
|
||||||
self.Breath_Intensity = math.Clamp( maxhealth / health, 0, 2 )
|
local maxhealth = owner:GetMaxHealth()
|
||||||
self.Breath_Rate = math.Clamp( ((maxhealth*0.5) / health ), 1, 1.5 )
|
|
||||||
|
self.Breath_Intensity = math.Clamp(maxhealth / health, 0, 2)
|
||||||
|
self.Breath_Rate = math.Clamp((maxhealth * 0.5) / health, 1, 1.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Breath_StateMult()
|
function SWEP:Breath_StateMult()
|
||||||
local owner = self:GetOwner()
|
local owner = self:GetOwner()
|
||||||
if !IsValid(owner) then return end
|
|
||||||
local sightedmult = 1
|
if not IsValid(owner) then return end
|
||||||
|
|
||||||
self.Breath_Intensity = self.Breath_Intensity * sightedmult
|
local sightedmult = 1
|
||||||
|
|
||||||
|
self.Breath_Intensity = self.Breath_Intensity * sightedmult
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Breath_Process(EyePos, EyeAng)
|
function SWEP:Breath_Process(EyePos, EyeAng)
|
||||||
local VMPos, VMAng = self.VMPos, self.VMAng
|
local VMPos, VMAng = self.VMPos, self.VMAng
|
||||||
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
||||||
|
|
||||||
self:Breath_Health()
|
self:Breath_Health()
|
||||||
self:Breath_StateMult()
|
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
|
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.x = VMPosOffset.x * 1.5
|
||||||
VMAngOffset.y = VMPosOffset.y * 2
|
VMAngOffset.y = VMPosOffset.y * 2
|
||||||
|
|
||||||
VMPos:Add(VMAng:Up() * VMPosOffset.x)
|
VMPos:Add(VMAng:Up() * VMPosOffset.x)
|
||||||
VMPos:Add(VMAng:Right() * VMPosOffset.y)
|
VMPos:Add(VMAng:Right() * VMPosOffset.y)
|
||||||
|
VMAng:Add(VMAngOffset)
|
||||||
VMAng:Add(VMAngOffset)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Look_Process(EyePos, EyeAng)
|
function SWEP:Look_Process(EyePos, EyeAng)
|
||||||
local VMPos, VMAng = self.VMPos, self.VMAng
|
local VMPos, VMAng = self.VMPos, self.VMAng
|
||||||
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
local VMPosOffset, VMAngOffset = self.VMPosOffset, self.VMAngOffset
|
||||||
local FT = FrameTime()
|
local FT = FrameTime()
|
||||||
local sightedmult = 1
|
local sightedmult = 1
|
||||||
self.SmoothEyeAng = LerpAngle(FT*5, self.SmoothEyeAng, EyeAng-self.LastEyeAng)
|
|
||||||
|
|
||||||
VMPosOffset.x = -self.SmoothEyeAng.x * -1 * sightedmult
|
self.SmoothEyeAng = LerpAngle(FT * 5, self.SmoothEyeAng, EyeAng - self.LastEyeAng)
|
||||||
VMPosOffset.y = self.SmoothEyeAng.y * 0.5 * sightedmult
|
|
||||||
|
|
||||||
VMAngOffset.x = VMPosOffset.x * 2.5
|
VMPosOffset.x = -self.SmoothEyeAng.x * -1 * sightedmult
|
||||||
VMAngOffset.y = VMPosOffset.y * 1.25
|
VMPosOffset.y = self.SmoothEyeAng.y * 0.5 * sightedmult
|
||||||
VMAngOffset.z = VMPosOffset.y * 2
|
VMAngOffset.x = VMPosOffset.x * 2.5
|
||||||
|
VMAngOffset.y = VMPosOffset.y * 1.25
|
||||||
self.VMLookLerp.y = Lerp(FT*10, self.VMLookLerp.y, VMAngOffset.y * 1.5 + self.SmoothEyeAng.y)
|
VMAngOffset.z = VMPosOffset.y * 2
|
||||||
|
|
||||||
VMAng.y = VMAng.y - self.VMLookLerp.y
|
self.VMLookLerp.y = Lerp(FT * 10, self.VMLookLerp.y, VMAngOffset.y * 1.5 + self.SmoothEyeAng.y)
|
||||||
|
|
||||||
VMPos:Add(VMAng:Up() * VMPosOffset.x)
|
VMAng.y = VMAng.y - self.VMLookLerp.y
|
||||||
VMPos:Add(VMAng:Right() * VMPosOffset.y)
|
|
||||||
|
VMPos:Add(VMAng:Up() * VMPosOffset.x)
|
||||||
VMAng:Add(VMAngOffset)
|
VMPos:Add(VMAng:Right() * VMPosOffset.y)
|
||||||
|
VMAng:Add(VMAngOffset)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:GetVMPosition(EyePos, EyeAng)
|
function SWEP:GetVMPosition(EyePos, EyeAng)
|
||||||
if CurTime() == oldCT then return self.VMPos, self.VMAng end
|
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.VMPos:Set(offsetpos)
|
||||||
-- self.VMAng:Add(offsetang)
|
-- self.VMAng:Add(offsetang)
|
||||||
oldCT = CurTime()
|
oldCT = CurTime()
|
||||||
return self.VMPos, self.VMAng
|
|
||||||
|
return self.VMPos, self.VMAng
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:CalcViewModelView(vm, oldeyepos, oldeyeang, eyepos, eyeang)
|
function SWEP:CalcViewModelView(vm, oldeyepos, oldeyeang, eyepos, eyeang)
|
||||||
return self:GetVMPosition(eyepos, eyeang)
|
return self:GetVMPosition(eyepos, eyeang)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function SWEP:Deploy()
|
function SWEP:Deploy()
|
||||||
self:SendWeaponAnim(ACT_VM_DRAW)
|
self:SendWeaponAnim(ACT_VM_DRAW)
|
||||||
self:SetNextPrimaryFire(CurTime()+0.5)
|
self:SetNextPrimaryFire(CurTime() + 0.5)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:GenerateBullet()
|
function SWEP:GenerateBullet()
|
||||||
local tbl = self.BulletData
|
local tbl = self.BulletData
|
||||||
tbl.Attacker = self.Owner
|
tbl.Attacker = self:GetOwner()
|
||||||
tbl.Damage = self.Damage
|
tbl.Damage = self.Damage
|
||||||
tbl.Force = self.Force
|
tbl.Force = self.Force
|
||||||
tbl.Distance = self.Distance
|
tbl.Distance = self.Distance
|
||||||
tbl.Num = 1
|
tbl.Num = 1
|
||||||
tbl.Spread = Vector(0.05,0.05,0)
|
tbl.Spread = Vector(0.05, 0.05, 0)
|
||||||
|
tbl.Src = self:GetOwner():GetShootPos()
|
||||||
tbl.Src = self.Owner:GetShootPos()
|
tbl.Dir = self:GetOwner():GetEyeTrace().Normal
|
||||||
tbl.Dir = self.Owner:GetEyeTrace().Normal
|
|
||||||
return tbl
|
return tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:MuzzleFlash()
|
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()
|
local ed = EffectData()
|
||||||
ed:SetOrigin( vPoint )
|
|
||||||
|
ed:SetOrigin(vPoint)
|
||||||
ed:SetScale(1)
|
ed:SetScale(1)
|
||||||
ed:SetEntity(self)
|
ed:SetEntity(self)
|
||||||
util.Effect( "arccw_shelleffect", ed )
|
|
||||||
|
util.Effect("arccw_shelleffect", ed)
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:DryFire()
|
function SWEP:DryFire()
|
||||||
|
@ -279,10 +282,13 @@ function SWEP:DryFire()
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Reload()
|
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
|
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.ReloadTime = CurTime() + AnimationTime
|
||||||
self:SetNextPrimaryFire(CurTime() + AnimationTime)
|
self:SetNextPrimaryFire(CurTime() + AnimationTime)
|
||||||
self:SetNextSecondaryFire(CurTime() + AnimationTime)
|
self:SetNextSecondaryFire(CurTime() + AnimationTime)
|
||||||
|
@ -292,19 +298,26 @@ end
|
||||||
function SWEP:PrimaryAttack()
|
function SWEP:PrimaryAttack()
|
||||||
if self:Clip1() < 1 then
|
if self:Clip1() < 1 then
|
||||||
self:DryFire()
|
self:DryFire()
|
||||||
self:SetNextPrimaryFire(CurTime()+0.5)
|
self:SetNextPrimaryFire(CurTime() + 0.5)
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self:SetClip1(self:Clip1()-1)
|
|
||||||
self.Owner:MuzzleFlash()
|
self:SetClip1(self:Clip1() - 1)
|
||||||
|
self:GetOwner():MuzzleFlash()
|
||||||
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
|
self:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
|
||||||
self:SetNextPrimaryFire(CurTime()+0.065)
|
self:SetNextPrimaryFire(CurTime() + 0.065)
|
||||||
self:EmitSound("weapons/smg1/smg1_fire1.wav")
|
self:EmitSound("weapons/smg1/smg1_fire1.wav")
|
||||||
self:FireBullets( self:GenerateBullet() )
|
self:FireBullets(self:GenerateBullet())
|
||||||
self.Owner:ViewPunch(Angle(-0.1,0,0))
|
self:GetOwner():ViewPunch(Angle(-0.1, 0, 0))
|
||||||
if IsFirstTimePredicted() then self:MuzzleFlash() end
|
|
||||||
|
if IsFirstTimePredicted() then
|
||||||
|
self:MuzzleFlash()
|
||||||
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:SecondaryAttack()
|
function SWEP:SecondaryAttack()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
|
@ -1,4 +1,4 @@
|
||||||
SWEP.PrintName = "X"
|
SWEP.PrintName = "X"
|
||||||
SWEP.Slot = 0
|
SWEP.Slot = 0
|
||||||
SWEP.SlotPos = 1
|
SWEP.SlotPos = 1
|
||||||
SWEP.DrawAmmo = false
|
SWEP.DrawAmmo = false
|
||||||
|
@ -14,13 +14,13 @@ SWEP.BounceWeaponIcon = false
|
||||||
SWEP.DrawWeaponInfoBox = false
|
SWEP.DrawWeaponInfoBox = false
|
||||||
|
|
||||||
SWEP.HoldType = "crossbow"
|
SWEP.HoldType = "crossbow"
|
||||||
|
|
||||||
SWEP.Spawnable = true
|
SWEP.Spawnable = true
|
||||||
SWEP.AdminSpawnable = true
|
SWEP.AdminSpawnable = true
|
||||||
SWEP.Category = "Beatrun"
|
SWEP.Category = "Beatrun"
|
||||||
|
|
||||||
SWEP.UseHands = true
|
SWEP.UseHands = true
|
||||||
|
|
||||||
SWEP.ViewModel = "models/weapons/c_pistol.mdl"
|
SWEP.ViewModel = "models/weapons/c_pistol.mdl"
|
||||||
SWEP.WorldModel = "models/weapons/w_crossbow.mdl"
|
SWEP.WorldModel = "models/weapons/w_crossbow.mdl"
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ SWEP.Primary.ClipSize = -1
|
||||||
SWEP.Primary.DefaultClip = -1
|
SWEP.Primary.DefaultClip = -1
|
||||||
SWEP.Primary.Automatic = true
|
SWEP.Primary.Automatic = true
|
||||||
SWEP.Primary.Ammo = "none"
|
SWEP.Primary.Ammo = "none"
|
||||||
|
|
||||||
SWEP.Secondary.ClipSize = -1
|
SWEP.Secondary.ClipSize = -1
|
||||||
SWEP.Secondary.DefaultClip = -1
|
SWEP.Secondary.DefaultClip = -1
|
||||||
SWEP.Secondary.Automatic = false
|
SWEP.Secondary.Automatic = false
|
||||||
|
@ -74,7 +74,7 @@ function SWEP:PrimaryAttack()
|
||||||
table.insert(self.points, ply:EyePos()+ply:EyeAngles():Forward()*50)
|
table.insert(self.points, ply:EyePos()+ply:EyeAngles():Forward()*50)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function SWEP:SecondaryAttack()
|
function SWEP:SecondaryAttack()
|
||||||
self:CallOnClient("SecondaryAttack")
|
self:CallOnClient("SecondaryAttack")
|
||||||
|
@ -84,7 +84,7 @@ end
|
||||||
|
|
||||||
hook.Add("PostDrawTranslucentRenderables","ShapeGun",function()
|
hook.Add("PostDrawTranslucentRenderables","ShapeGun",function()
|
||||||
local ply = Entity(1)
|
local ply = Entity(1)
|
||||||
local wep = ply:GetActiveWeapon()
|
local wep = ply:GetActiveWeapon() or nil
|
||||||
if IsValid(wep) and wep:GetClass()=="shapedrawer" then
|
if IsValid(wep) and wep:GetClass()=="shapedrawer" then
|
||||||
for k,v in ipairs(wep.points) do
|
for k,v in ipairs(wep.points) do
|
||||||
render.DrawWireframeBox(v,angle_zero,Vector(-1,-1,-1),Vector(1,1,1))
|
render.DrawWireframeBox(v,angle_zero,Vector(-1,-1,-1),Vector(1,1,1))
|
||||||
|
|
|
@ -1,46 +1,45 @@
|
||||||
SWEP.PrintName = "Zipline Gun"
|
SWEP.PrintName = "Zipline Gun"
|
||||||
SWEP.Slot = 0
|
SWEP.Slot = 0
|
||||||
SWEP.SlotPos = 1
|
SWEP.SlotPos = 1
|
||||||
SWEP.DrawAmmo = false
|
SWEP.DrawAmmo = false
|
||||||
SWEP.DrawCrosshair = true
|
SWEP.DrawCrosshair = true
|
||||||
|
|
||||||
|
SWEP.Author = ""
|
||||||
SWEP.Author = ""
|
SWEP.Contact = ""
|
||||||
SWEP.Contact = ""
|
SWEP.Purpose = ""
|
||||||
SWEP.Purpose = ""
|
SWEP.Instructions = ""
|
||||||
SWEP.Instructions = ""
|
|
||||||
|
|
||||||
SWEP.BounceWeaponIcon = false
|
SWEP.BounceWeaponIcon = false
|
||||||
SWEP.DrawWeaponInfoBox = false
|
SWEP.DrawWeaponInfoBox = false
|
||||||
|
|
||||||
SWEP.HoldType = "crossbow"
|
SWEP.HoldType = "crossbow"
|
||||||
|
|
||||||
SWEP.Spawnable = true
|
SWEP.Spawnable = true
|
||||||
SWEP.AdminSpawnable = true
|
SWEP.AdminSpawnable = true
|
||||||
SWEP.Category = "Beatrun"
|
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.ViewModel = "models/weapons/c_crossbow.mdl"
|
||||||
SWEP.Primary.DefaultClip = -1
|
SWEP.WorldModel = "models/weapons/w_crossbow.mdl"
|
||||||
SWEP.Primary.Automatic = false
|
|
||||||
SWEP.Primary.Ammo = "none"
|
SWEP.ViewModelFOV = 75 -- 65
|
||||||
|
|
||||||
SWEP.Secondary.ClipSize = -1
|
SWEP.Primary.ClipSize = -1
|
||||||
SWEP.Secondary.DefaultClip = -1
|
SWEP.Primary.DefaultClip = -1
|
||||||
SWEP.Secondary.Automatic = false
|
SWEP.Primary.Automatic = false
|
||||||
SWEP.Secondary.Ammo = "none"
|
SWEP.Primary.Ammo = "none"
|
||||||
|
|
||||||
|
SWEP.Secondary.ClipSize = -1
|
||||||
|
SWEP.Secondary.DefaultClip = -1
|
||||||
|
SWEP.Secondary.Automatic = false
|
||||||
|
SWEP.Secondary.Ammo = "none"
|
||||||
|
|
||||||
function SWEP:SetupDataTables()
|
function SWEP:SetupDataTables()
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Deploy()
|
function SWEP:Deploy()
|
||||||
self:SetHoldType( self.HoldType )
|
self:SetHoldType(self.HoldType)
|
||||||
self:SendWeaponAnim(ACT_VM_DRAW)
|
self:SendWeaponAnim(ACT_VM_DRAW)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -48,10 +47,8 @@ function SWEP:Initialize()
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:Think()
|
function SWEP:Think()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function SWEP:Holster()
|
function SWEP:Holster()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -63,13 +60,15 @@ function SWEP:Reload()
|
||||||
end
|
end
|
||||||
|
|
||||||
function SWEP:PrimaryAttack()
|
function SWEP:PrimaryAttack()
|
||||||
local ply = self.Owner
|
local ply = self:GetOwner()
|
||||||
|
|
||||||
if SERVER then
|
if SERVER then
|
||||||
CreateZipline(ply:EyePos(), ply:GetEyeTrace().HitPos)
|
CreateZipline(ply:EyePos(), ply:GetEyeTrace().HitPos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function SWEP:SecondaryAttack()
|
function SWEP:SecondaryAttack()
|
||||||
|
-- for k, v in pairs(ziplines) do
|
||||||
|
-- v:Remove()
|
||||||
|
-- end
|
||||||
end
|
end
|
|
@ -129,7 +129,7 @@ if CLIENT then
|
||||||
|
|
||||||
LocalPlayer():EmitSound("A_TT_Finish_Positive.wav")
|
LocalPlayer():EmitSound("A_TT_Finish_Positive.wav")
|
||||||
SaveCheckpointTime()
|
SaveCheckpointTime()
|
||||||
SaveReplayData()
|
-- SaveReplayData()
|
||||||
else
|
else
|
||||||
timetext = "+" .. string.FormattedTime(math.abs(timestr), "%02i:%02i:%02i")
|
timetext = "+" .. string.FormattedTime(math.abs(timestr), "%02i:%02i:%02i")
|
||||||
timecolor = color_negative
|
timecolor = color_negative
|
||||||
|
@ -300,13 +300,13 @@ function LoadCheckpointTime()
|
||||||
end
|
end
|
||||||
|
|
||||||
function SaveReplayData()
|
function SaveReplayData()
|
||||||
local replay = util.TableToJSON(LocalPlayer().ReplayTicks)
|
local replay = util.Compress(util.TableToJSON(LocalPlayer().ReplayTicks))
|
||||||
local dir = "beatrun/replays/" .. game.GetMap() .. "/"
|
local dir = "beatrun/replays/" .. game.GetMap() .. "/"
|
||||||
|
|
||||||
if not replay then return end
|
if not replay then return end
|
||||||
|
|
||||||
file.CreateDir(dir)
|
file.CreateDir(dir)
|
||||||
file.Write(dir .. Course_ID .. ".txt", util.Compress(replay))
|
file.Write(dir .. Course_ID .. ".txt", replay)
|
||||||
end
|
end
|
||||||
|
|
||||||
function LoadReplayData()
|
function LoadReplayData()
|
||||||
|
|
|
@ -673,6 +673,7 @@ hook.Add("StartCommand", "qslidespeed", function(ply, cmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
cmd:ClearMovement()
|
cmd:ClearMovement()
|
||||||
|
|
||||||
local slidetime = math.max(0.1, qslide_duration)
|
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
|
if (ply:GetSlidingTime() - CurTime()) / slidetime > 0.8 and (ply.SlidingInitTime > CurTime() - 0.25 or ply:GetSlidingSlippery()) then
|
||||||
|
|
|
@ -936,6 +936,7 @@ if CLIENT then
|
||||||
local jsonsave = util.TableToJSON(save)
|
local jsonsave = util.TableToJSON(save)
|
||||||
local crc = util.CRC(jsonsave)
|
local crc = util.CRC(jsonsave)
|
||||||
local dir = "beatrun/courses/" .. game.GetMap() .. "/"
|
local dir = "beatrun/courses/" .. game.GetMap() .. "/"
|
||||||
|
compress = compress or true
|
||||||
|
|
||||||
file.CreateDir(dir)
|
file.CreateDir(dir)
|
||||||
|
|
||||||
|
@ -1620,7 +1621,7 @@ if CLIENT then
|
||||||
|
|
||||||
gui.EnableScreenClicker(false)
|
gui.EnableScreenClicker(false)
|
||||||
|
|
||||||
LocalPlayer():SetFOV(LocalPlayer():GetInfoNum("Beatrun_FOV"))
|
LocalPlayer():SetFOV(0)
|
||||||
|
|
||||||
CheckpointNumber = 1
|
CheckpointNumber = 1
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
local quakejump = CreateConVar("Beatrun_QuakeJump", 1, {FCVAR_REPLICATED, FCVAR_ARCHIVE})
|
local quakejump = CreateConVar("Beatrun_QuakeJump", 1, {FCVAR_REPLICATED, FCVAR_ARCHIVE})
|
||||||
|
|
||||||
local sidestep = CreateConVar("Beatrun_SideStep", 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 function Hardland(jt)
|
||||||
local ply = LocalPlayer()
|
local ply = LocalPlayer()
|
||||||
|
@ -230,8 +230,8 @@ hook.Add("SetupMove", "MESetupMove", function(ply, mv, cmd)
|
||||||
ply.FootstepLand = true
|
ply.FootstepLand = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if ply:GetRunSpeed() ~= 325 * ply:GetOverdriveMult() then
|
if ply:GetRunSpeed() ~= max_speed:GetInt() * ply:GetOverdriveMult() then
|
||||||
ply:SetRunSpeed(325 * ply:GetOverdriveMult())
|
ply:SetRunSpeed(max_speed:GetInt() * ply:GetOverdriveMult())
|
||||||
end
|
end
|
||||||
|
|
||||||
if not ply:GetMEMoveLimit() then
|
if not ply:GetMEMoveLimit() then
|
||||||
|
@ -275,9 +275,9 @@ hook.Add("SetupMove", "MESetupMove", function(ply, mv, cmd)
|
||||||
mult = mult * ply:GetMEMoveLimit() / 1000
|
mult = mult * ply:GetMEMoveLimit() / 1000
|
||||||
end
|
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
|
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
|
end
|
||||||
|
|
||||||
if MEAngDiff > 1.25 and ply:GetWallrun() == 0 then
|
if MEAngDiff > 1.25 and ply:GetWallrun() == 0 then
|
||||||
|
|
BIN
lua/bin/gmcl_gdiscord_win64.dll
Normal file
BIN
lua/bin/gmcl_gdiscord_win64.dll
Normal file
Binary file not shown.
Loading…
Reference in a new issue