Skip to content

Commit

Permalink
Merge branch 'master' into hook-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
thecraftianman committed Dec 20, 2024
2 parents a058f4e + c97753d commit 3a92e1e
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 60 deletions.
2 changes: 1 addition & 1 deletion lua/acf/entities/racks/racks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Racks.Register("4x AGM-114", {

MountPoints = {
{ Name = "missile1", Position = Vector(0, -7.85, 4.9), Direction = Vector(0, 0, -1) },
{ Name = "missile2", Position = Vector(0, 8.05,4.9), Direction = Vector(0, 0, -1) },
{ Name = "missile2", Position = Vector(0, 8.05, 4.9), Direction = Vector(0, 0, -1) },
{ Name = "missile3", Position = Vector(0, -7.85, -13), Direction = Vector(0, 0, -1) },
{ Name = "missile4", Position = Vector(0, 8.05, -13), Direction = Vector(0, 0, -1) }
}
Expand Down
14 changes: 7 additions & 7 deletions lua/acf/entities/sensors/receivers/receivers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ do -- Laser Receiver

local ReceiverOrigin = Receiver:LocalToWorld(Receiver.Origin)

for k,v in pairs(ACF.ActiveLasers) do
for k, v in pairs(ACF.ActiveLasers) do
local Dir = k.Dir or k:GetForward()
if v.Distance > 0 then Dir = (v.HitPos - v.Origin):GetNormalized() end

if Dir:Dot((ReceiverOrigin - v.Origin):GetNormalized()) >= Receiver.Cone then Lasers[k] = true end
end

-- Wiremod laser pointer, because it's, you know, a laser
for _,ply in pairs(player.GetAll()) do
for _, ply in ipairs(player.GetAll()) do
local Wep = ply:GetWeapon("laserpointer")
if not IsValid(Wep) then continue end
if Wep ~= ply:GetActiveWeapon() then continue end

if Wep.Pointing then
local Las = {Dir = ply:EyeAngles():Forward(),Position = ply:EyePos(),Player = ply}
local Las = {Dir = ply:EyeAngles():Forward(), Position = ply:EyePos(), Player = ply}

if Las.Dir:Dot((ReceiverOrigin - Las.Position):GetNormalized()) >= Receiver.Cone then Lasers[Las] = true end
end
Expand All @@ -47,8 +47,8 @@ do -- Laser Receiver
TraceData.start = Start
TraceData.endpos = End
if IsValid(Source.Player) then
TraceData.filter = {Receiver,Source.Player}
else TraceData.filter = {Receiver,Source} end
TraceData.filter = {Receiver, Source.Player}
else TraceData.filter = {Receiver, Source} end

return not TraceLine(TraceData).Hit
end
Expand All @@ -61,7 +61,7 @@ do -- Laser Receiver
Mass = 25,
Health = 10,
Armor = 10,
Offset = Vector(0,0,3),
Offset = Vector(0, 0, 3),

ThinkDelay = 0.25,
Divisor = 2.5, -- Divisor (pre-floor) and then multiplier to give a choppy angle
Expand Down Expand Up @@ -125,7 +125,7 @@ do -- Radar Receiver
Mass = 25,
Health = 10,
Armor = 10,
Offset = Vector(0,0,6),
Offset = Vector(0, 0, 6),

ThinkDelay = 0.5,
Divisor = 30, -- Divisor (pre-floor) and then multiplier to give a choppy angle
Expand Down
26 changes: 13 additions & 13 deletions lua/effects/acf_glatgmexplosion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local Sounds = ACF.Utilities.Sounds
function EFFECT:Init(Data)
self.DirVec = Data:GetNormal()
self.Origin = Data:GetOrigin() + self.DirVec * -15
self.Radius = math.Clamp(Data:GetScale() * 0.042 ,0.1,10)
self.Radius = math.Clamp(Data:GetScale() * 0.042, 0.1, 10)

self.Emitter = ParticleEmitter(self.Origin)
self.ParticleMul = LocalPlayer():GetInfoNum("acf_cl_particlemul", 1)
Expand Down Expand Up @@ -44,7 +44,7 @@ function EFFECT:Airburst()
EF:SetEndSize(30 * Radius)
EF:SetRoll(800)
EF:SetRollDelta(math.random(-1, 1))
EF:SetColor(255,255,255)
EF:SetColor(255, 255, 255)
end
local EI = 20 * Radius * Mult
for E = 0, EI do
Expand All @@ -59,7 +59,7 @@ function EFFECT:Airburst()
EF:SetEndSize(0)
EF:SetRoll(800)
EF:SetRollDelta(math.random(-1, 1))
EF:SetColor(255,255,255)
EF:SetColor(255, 255, 255)
end
end
EI = 10 * Radius * Mult
Expand All @@ -75,18 +75,18 @@ function EFFECT:Airburst()
EF:SetEndSize(0)
EF:SetRoll(800)
EF:SetRollDelta(math.random(-1, 1))
EF:SetColor(255,255,255)
EF:SetColor(255, 255, 255)
end
end
local Angle = self.DirVec:Angle()
Angle:RotateAroundAxis(Angle:Forward(), math.random(1,300))
local rv = math.random(20,40) * Mult
Angle:RotateAroundAxis(Angle:Forward(), math.random(1, 300))
local rv = math.random(20, 40) * Mult
for _ = 0, rv do
Angle:RotateAroundAxis(Angle:Forward(), 360 / rv)
EF = self.Emitter:Add("particle/smokesprites_000" .. math.random(1, 9), Origin)
if EF then
EF:SetVelocity((Angle:Up() - self.DirVec * math.random(0.05,0.25)) * math.random(200,300) * Radius)
EF:SetDieTime(math.random(0.35,0.8))
EF:SetVelocity((Angle:Up() - self.DirVec * math.random(0.05, 0.25)) * math.random(200, 300) * Radius)
EF:SetDieTime(math.random(0.35, 0.8))
EF:SetStartAlpha(100)
EF:SetEndAlpha(0)
EF:SetStartSize(15 * Radius)
Expand All @@ -99,19 +99,19 @@ function EFFECT:Airburst()
end
local Spark = Emitter:Add("particles/flamelet" .. math.random(1, 5), self.Origin)
if Spark then
Spark:SetVelocity((Angle:Up() - self.DirVec * math.random(-0.5,1)) * math.random(40,100) * Radius)
Spark:SetVelocity((Angle:Up() - self.DirVec * math.random(-0.5, 1)) * math.random(40, 100) * Radius)
Spark:SetLifeTime(0)
Spark:SetDieTime(math.Rand(2, 8) * self.Radius)
Spark:SetStartAlpha(255)
Spark:SetEndAlpha(20)
Spark:SetStartSize(math.random(2,4) * 0.2 * self.Radius)
Spark:SetStartSize(math.random(2, 4) * 0.2 * self.Radius)
Spark:SetEndSize(0 * self.Radius)
Spark:SetStartLength(math.random(2,7) * 0.5 * self.Radius)
Spark:SetStartLength(math.random(2, 7) * 0.5 * self.Radius)
Spark:SetEndLength(0)
Spark:SetRoll(math.Rand(0, 360))
Spark:SetRollDelta(math.Rand(-0.2, 0.2))
Spark:SetAirResistance(10)
Spark:SetGravity(Vector(0,0,-400))
Spark:SetGravity(Vector(0, 0, -400))
Spark:SetColor(200, 200, 200)
Spark:SetCollide(true)
Spark:SetBounce(0.2)
Expand Down Expand Up @@ -145,7 +145,7 @@ function EFFECT:Airburst()
AirBurst:SetEndSize(100 * Radius)
AirBurst:SetRoll(math.Rand(150, 360))
AirBurst:SetRollDelta(math.Rand(-0.2, 0.2))
AirBurst:SetAirResistance(math.random(70,120))
AirBurst:SetAirResistance(math.random(70, 120))
AirBurst:SetGravity(Vector(math.random(-10, 10) * Radius, math.random(-10, 10) * Radius, 20))
AirBurst:SetColor(200, 200, 200)
end
Expand Down
36 changes: 18 additions & 18 deletions lua/entities/acf_rack/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ do -- Overlay/networking
net.SendToServer()
end

net.Receive("ACF.RequestRackInfo",function()
net.Receive("ACF.RequestRackInfo", function()
local Rack = net.ReadEntity()
if not IsValid(Rack) then return end

Expand All @@ -45,19 +45,19 @@ do -- Overlay/networking

Rack.MountPoints = {}
if next(RackInfo.MountPoints) then
for _,T in ipairs(RackInfo.MountPoints) do
local Dir = Vector(1,0,0)
for _, T in ipairs(RackInfo.MountPoints) do
local Dir = Vector(1, 0, 0)
Dir:Rotate(T.Ang)
Rack.MountPoints[#Rack.MountPoints + 1] = {Index = T.Index, Pos = T.Pos, Dir = Dir}
end
end

local CrateEnts = {}
for _,E in ipairs(CrateInfo) do
for _, E in ipairs(CrateInfo) do
local Crate = Entity(E)

if IsValid(Crate) then
local Col = ColorAlpha(Crate:GetColor(),25)
local Col = ColorAlpha(Crate:GetColor(), 25)
CrateEnts[#CrateEnts + 1] = {Ent = Crate, Col = Col}
end
end
Expand All @@ -71,9 +71,9 @@ do -- Overlay/networking
-- icon16/joystick.png controller sprite
local RadarSprite = Material("icon16/transmit.png")
local JoystickMat = Material("icon16/joystick.png")
local RadarColor = Color(255,255,0,25)
local ControllerColor = Color(0,255,0,25)
local ForwardColor = Color(255,0,0)
local RadarColor = Color(255, 255, 0, 25)
local ControllerColor = Color(0, 255, 0, 25)
local ForwardColor = Color(255, 0, 0)

function ENT:DrawOverlay()
local SelfTbl = self:GetTable()
Expand All @@ -86,37 +86,37 @@ do -- Overlay/networking
end

if next(SelfTbl.Crates) then
for _,T in ipairs(SelfTbl.Crates) do
for _, T in ipairs(SelfTbl.Crates) do
local E = T.Ent

if IsValid(E) then
render.DrawWireframeBox(E:GetPos(),E:GetAngles(),E:OBBMins(),E:OBBMaxs(),T.Col,true)
render.DrawBox(E:GetPos(),E:GetAngles(),E:OBBMins(),E:OBBMaxs(),T.Col)
render.DrawWireframeBox(E:GetPos(), E:GetAngles(), E:OBBMins(), E:OBBMaxs(), T.Col, true)
render.DrawBox(E:GetPos(), E:GetAngles(), E:OBBMins(), E:OBBMaxs(), T.Col)
end
end
end

if next(SelfTbl.MountPoints) then
for _,T in ipairs(SelfTbl.MountPoints) do
for _, T in ipairs(SelfTbl.MountPoints) do
local Pos1 = self:LocalToWorld(T.Pos - T.Dir * 6)
local Pos2 = self:LocalToWorld(T.Pos + T.Dir * 6)
render.DrawBeam(Pos1, Pos2, 2, 0, 0, color_black)
render.DrawBeam(Pos1, Pos2, 1.5, 0, 0, color_white)
end

cam.Start2D()
for _,T in ipairs(SelfTbl.MountPoints) do
for _, T in ipairs(SelfTbl.MountPoints) do
local Pos = self:LocalToWorld(T.Pos):ToScreen()
draw.SimpleTextOutlined("Mount " .. T.Index,"ACF_Title",Pos.x,Pos.y,color_white,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER,1,color_black)
draw.SimpleTextOutlined("Mount " .. T.Index, "ACF_Title", Pos.x, Pos.y, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, color_black)
end
cam.End2D()
end

if IsValid(SelfTbl.Radar) then
local Radar = SelfTbl.Radar
local RadPos, RadAng, OBBMin, OBBMax = Radar:GetPos(), Radar:GetAngles(), Radar:OBBMins(), Radar:OBBMaxs()
render.DrawWireframeBox(RadPos,RadAng,OBBMin,OBBMax,RadarColor,true)
render.DrawBox(RadPos,RadAng,OBBMin,OBBMax,RadarColor)
render.DrawWireframeBox(RadPos, RadAng, OBBMin, OBBMax, RadarColor, true)
render.DrawBox(RadPos, RadAng, OBBMin, OBBMax, RadarColor)

render.SetMaterial(RadarSprite)
render.DrawSprite(Radar:LocalToWorld(Radar:OBBCenter()), 12, 12, color_white)
Expand All @@ -127,8 +127,8 @@ do -- Overlay/networking
if IsValid(SelfTbl.Computer) then
local Computer = SelfTbl.Computer
local ComPos, ComAng, OBBMin, OBBMax = Computer:GetPos(), Computer:GetAngles(), Computer:OBBMins(), Computer:OBBMaxs()
render.DrawWireframeBox(ComPos,ComAng,OBBMin,OBBMax,ControllerColor,true)
render.DrawBox(ComPos,ComAng,OBBMin,OBBMax,ControllerColor)
render.DrawWireframeBox(ComPos, ComAng, OBBMin, OBBMax, ControllerColor, true)
render.DrawBox(ComPos, ComAng, OBBMin, OBBMax, ControllerColor)

render.SetMaterial(JoystickMat)
render.DrawSprite(Computer:LocalToWorld(Computer:OBBCenter()), 12, 12, color_white)
Expand Down
2 changes: 1 addition & 1 deletion lua/entities/acf_rack/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ do -- Overlay/networking

RackInfo.MountPoints = {}

for _,Point in pairs(Rack.MountPoints) do
for _, Point in pairs(Rack.MountPoints) do
RackInfo.MountPoints[#RackInfo.MountPoints + 1] = {Pos = Point.Position, Ang = Point.Angle, Index = Point.Index}
end

Expand Down
20 changes: 10 additions & 10 deletions lua/entities/acf_radar/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ do -- Overlay/networking
net.SendToServer()
end

net.Receive("ACF.RequestRadarInfo",function()
net.Receive("ACF.RequestRadarInfo", function()
local Radar = net.ReadEntity()
if not IsValid(Radar) then return end

Expand All @@ -37,8 +37,8 @@ do -- Overlay/networking
Radar.Age = Clock.CurTime + 5
end)

local Col = Color(255,255,0,25)
local Col2 = Color(255,255,0)
local Col = Color(255, 255, 0, 25)
local Col2 = Color(255, 255, 0)
function ENT:DrawOverlay()
local SelfTbl = self:GetTable()

Expand All @@ -51,17 +51,17 @@ do -- Overlay/networking

local Origin = self:LocalToWorld(SelfTbl.Origin)
if SelfTbl.Spherical then
render.DrawWireframeSphere(Origin,SelfTbl.Range,50,50,Col2)
render.DrawWireframeSphere(Origin, SelfTbl.Range, 50, 50, Col2)
else

for I = 0, 7 do
local Dir = Vector(16384,0,0)
Dir:Rotate(Angle(SelfTbl.Cone,0,0))
Dir:Rotate(Angle(0,0,45 * I))
local Dir = Vector(16384, 0, 0)
Dir:Rotate(Angle(SelfTbl.Cone, 0, 0))
Dir:Rotate(Angle(0, 0, 45 * I))
local Point = self:LocalToWorld(SelfTbl.Origin + Dir)
local Dir2 = Vector(16384,0,0)
Dir2:Rotate(Angle(SelfTbl.Cone,0,0))
Dir2:Rotate(Angle(0,0,45 * (I + 1)))
local Dir2 = Vector(16384, 0, 0)
Dir2:Rotate(Angle(SelfTbl.Cone, 0, 0))
Dir2:Rotate(Angle(0, 0, 45 * (I + 1)))
local Point2 = self:LocalToWorld(SelfTbl.Origin + Dir2)

render.DrawQuad(Origin, Point, Point2, Point, Col)
Expand Down
6 changes: 3 additions & 3 deletions lua/entities/acf_radar/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ local function ScanForEntities(Entity)
for Ent in pairs(Detected) do
local EntPos = Ent.Position or Ent:GetPos()

if CheckLOS(Origin, EntPos) and (math.Rand(0,1) >= (EntDamage / 10)) then
if CheckLOS(Origin, EntPos) and (math.Rand(0, 1) >= (EntDamage / 10)) then
local EntSpread = VectorRand(-Spread, Spread)
local EntVel = Ent.Velocity or Ent:GetVelocity()
local Owner = GetEntityOwner(Entity.Owner, Ent)
Expand Down Expand Up @@ -559,14 +559,14 @@ end

do -- Overlay/networking
util.AddNetworkString("ACF.RequestRadarInfo")
net.Receive("ACF.RequestRadarInfo",function(_,Ply)
net.Receive("ACF.RequestRadarInfo", function(_, Ply)
local Radar = net.ReadEntity()
if not IsValid(Radar) then return end

local RadarInfo = {}
RadarInfo.Spherical = (Radar.ConeDegs == nil) and true or false
RadarInfo.Cone = Radar.ConeDegs and math.Round(Radar.ConeDegs, 2) or 0
RadarInfo.Range = Radar.Range and math.Round(Radar.Range,2) or 0
RadarInfo.Range = Radar.Range and math.Round(Radar.Range, 2) or 0
RadarInfo.Origin = Radar.Origin

net.Start("ACF.RequestRadarInfo")
Expand Down
14 changes: 7 additions & 7 deletions lua/entities/acf_receiver/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ local function CheckReceive(Entity)
for Ent in pairs(Sources) do
local EntPos = Ent.Position or Ent:GetPos()
local EntDamage = Entity.Damage
local Spread = math.max(Entity.Divisor,15) * 2 * EntDamage
local Spread = math.max(Entity.Divisor, 15) * 2 * EntDamage

if Entity.CheckLOS(Entity, Ent, Origin, EntPos) and (math.Rand(0,1) >= (EntDamage / 5)) then
if Entity.CheckLOS(Entity, Ent, Origin, EntPos) and (math.Rand(0, 1) >= (EntDamage / 5)) then
IsDetected = true

local PreAng = (EntPos - Origin):GetNormalized():Angle()
Ang = Angle(math.Round((PreAng.p + math.random(-Spread,Spread)) / Entity.Divisor),math.Round((PreAng.y + math.random(-Spread,Spread)) / Entity.Divisor),0) * Entity.Divisor
Ang = Angle(math.Round((PreAng.p + math.random(-Spread, Spread)) / Entity.Divisor), math.Round((PreAng.y + math.random(-Spread, Spread)) / Entity.Divisor), 0) * Entity.Divisor
Dir = Ang:Forward()

break -- Stop at the first valid source
Expand All @@ -72,7 +72,7 @@ local function CheckReceive(Entity)
WireLib.TriggerOutput(Entity, "Angle", Ang)
end

local function SetActive(Entity,Bool)
local function SetActive(Entity, Bool)
ResetOutputs(Entity)

if Bool then
Expand Down Expand Up @@ -220,7 +220,7 @@ do -- Spawn and Update functions

CheckLegal(Receiver)

SetActive(Receiver,true)
SetActive(Receiver, true)

return Receiver
end
Expand Down Expand Up @@ -303,13 +303,13 @@ end
function ENT:Enable()
if not CheckLegal(self) then return end

SetActive(self,true)
SetActive(self, true)

self:UpdateOverlay()
end

function ENT:Disable()
SetActive(self,false)
SetActive(self, false)
end

local Text = "%s\n\n%s"
Expand Down

0 comments on commit 3a92e1e

Please sign in to comment.