Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
TwistedTail committed May 18, 2024
2 parents 6698813 + 2acb097 commit 2f39f97
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workshop-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Upload to Workshop
uses: CFC-Servers/gmod-upload@master
with:
id: 3182731439
id: 3248769787
changelog: "${{ github.event.head_commit.message }}"
title: "[ACF-3] Armored Combat Framework - Missiles"
type: "tool"
Expand Down
13 changes: 7 additions & 6 deletions lua/acf/core/utilities/entity_tracking_sv.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
local ACF = ACF
local Clock = ACF.Utilities.Clock
local NextUpdate = 0
local Entities = {}
local Ancestors = {}
local ACF = ACF
local Clock = ACF.Utilities.Clock
local Contraption = ACF.Contraption
local NextUpdate = 0
local Entities = {}
local Ancestors = {}

local Whitelist = {
-- Garry's Mod entities
Expand Down Expand Up @@ -40,7 +41,7 @@ local Whitelist = {
}

local function GetAncestor(Entity)
local Ancestor = ACF_GetAncestor(Entity)
local Ancestor = Contraption.GetAncestor(Entity)

if not IsValid(Ancestor) then return end
if Ancestor == Entity then return end
Expand Down
5 changes: 3 additions & 2 deletions lua/acf/entities/guidance/wire_mclos.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
local ACF = ACF
local Guidances = ACF.Classes.Guidances
local Sounds = ACF.Utilities.Sounds
local Guidance = Guidances.Register("Wire (MCLOS)", "Radio (MCLOS)")

function Guidance:Configure(Missile)
Expand Down Expand Up @@ -30,7 +31,7 @@ else
LastFired.GuidanceData:SnapRope(LastFired)
end

self.Rope = constraint.CreateKeyframeRope(Vector(), 0.1, "cable/cable2", nil, self.Source, self.InPos, 0, Missile, self.OutPos, 0)
self.Rope = constraint.CreateKeyframeRope(Vector(), 0.1, "acf/core/wire", nil, self.Source, self.InPos, 0, Missile, self.OutPos, 0)
self.Rope:SetKeyValue("Width", 0.1)
end

Expand All @@ -54,7 +55,7 @@ else
self.Rope = nil

if IsValid(self.Source) then
self.Source:EmitSound(SnapSound:format(math.random(3)), nil, nil, ACF.Volume)
Sounds.SendSound(self.Source, SnapSound:format(math.random(3)), nil, nil, 1)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lua/effects/acf_glatgmexplosion.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local TraceData = { start = true, endpos = true, mask = true }
local TraceLine = util.TraceLine

local Sounds = ACF.Utilities.Sounds

function EFFECT:Init(Data)
self.DirVec = Data:GetNormal()
Expand Down Expand Up @@ -31,8 +31,8 @@ function EFFECT:Airburst()
local Mult = self.ParticleMul
local sndrad = math.Clamp(Radius * 20, 75, 165)
local sndradp = 300 - Radius
sound.Play("ambient/explosions/explode_4.wav", self.Origin, sndrad, math.Clamp(sndradp * 25, 15, 170), ACF.Volume)
sound.Play("ambient/explosions/explode_9.wav", self.Origin, sndrad, math.Clamp(sndradp * 22, 15, 120), ACF.Volume)
Sounds.PlaySound(self.Origin, "ambient/explosions/explode_4.wav", sndrad, math.Clamp(sndradp * 25, 15, 170), 1)
Sounds.PlaySound(self.Origin, "ambient/explosions/explode_9.wav", sndrad, math.Clamp(sndradp * 22, 15, 120), 1)
local EF = self.Emitter:Add("effects/muzzleflash" .. math.random(1, 4), Origin )
if EF then
EF:SetVelocity(self.DirVec * 100)
Expand Down
15 changes: 6 additions & 9 deletions lua/entities/acf_computer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ AddCSLuaFile("cl_init.lua")
include("shared.lua")

local ACF = ACF
local Contraption = ACF.Contraption
local Damage = ACF.Damage
local Utilities = ACF.Utilities
local Clock = Utilities.Clock
local Sounds = Utilities.Sounds

ACF.RegisterClassLink("acf_computer", "acf_rack", function(Computer, Target)
if Computer.Weapons[Target] then return false, "This rack is already linked to this computer!" end
Expand Down Expand Up @@ -79,8 +81,8 @@ local function CheckDistantLinks(Entity, Source)
if Position:DistToSqr(Link:GetPos()) > MaxDistance then
local Sound = UnlinkSound:format(math.random(1, 3))

Entity:EmitSound(Sound, 70, 100, ACF.Volume)
Link:EmitSound(Sound, 70, 100, ACF.Volume)
Sounds.SendSound(Entity, Sound, 70, 100, 1)
Sounds.SendSound(Link, Sound, 70, 100, 1)

Entity:Unlink(Link)
end
Expand Down Expand Up @@ -121,9 +123,8 @@ do -- Spawn and update function

local function UpdateComputer(Entity, Data, Class, Computer)
Entity.ACF = Entity.ACF or {}
Entity.ACF.Model = Computer.Model -- Must be set before changing model

Entity:SetModel(Computer.Model)
Contraption.SetModel(Entity, Computer.Model)

Entity:PhysicsInit(SOLID_VPHYSICS)
Entity:SetMoveType(MOVETYPE_VPHYSICS)
Expand Down Expand Up @@ -158,11 +159,7 @@ do -- Spawn and update function

ACF.Activate(Entity, true)

Entity.ACF.LegalMass = Computer.Mass
Entity.ACF.Model = Computer.Model

local Phys = Entity:GetPhysicsObject()
if IsValid(Phys) then Phys:SetMass(Computer.Mass) end
Contraption.SetMass(Entity, Computer.Mass)

if Entity.OnUpdate then
Entity:OnUpdate(Data, Class, Computer)
Expand Down
5 changes: 3 additions & 2 deletions lua/entities/acf_missile/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local ActiveMissiles = ACF.ActiveMissiles
local Ballistics = ACF.Ballistics
local Classes = ACF.Classes
local Clock = ACF.Utilities.Clock
local Sounds = ACF.Utilities.Sounds
local Damage = ACF.Damage
local Missiles = Classes.Missiles
local InputActions = ACF.GetInputActions("acf_missile")
Expand Down Expand Up @@ -69,7 +70,7 @@ local function LaunchEffect(Missile)
if ACF_SOUND_EXT then
hook.Run("ACF_SOUND_MISSILE", Missile, Sound)
else
Missile:EmitSound(Sound, 180, math.random(99, 101), ACF.Volume)
Sounds.SendSound(Missile, Sound, 180, math.random(99, 101), 1)
end
end

Expand Down Expand Up @@ -512,7 +513,7 @@ function ENT:Launch(Delay, IsMisfire)
self.Filter[#self.Filter + 1] = Missile
end

self:EmitSound("phx/epicmetal_hard.wav", 70, math.random(99, 101), ACF.Volume)
Sounds.SendSound(self, "phx/epicmetal_hard.wav", 70, math.random(99, 101), 1)
self:SetNotSolid(false)
self:SetNoDraw(false)
self:SetParent()
Expand Down
25 changes: 11 additions & 14 deletions lua/entities/acf_rack/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ include("shared.lua")
local EMPTY = { Type = "Empty", PropMass = 0, ProjMass = 0, Tracer = 0 }
local HookRun = hook.Run
local ACF = ACF
local Contraption = ACF.Contraption
local Classes = ACF.Classes
local Utilities = ACF.Utilities
local Clock = Utilities.Clock
local Sounds = Utilities.Sounds
local MaxDistance = ACF.LinkDistance * ACF.LinkDistance
local UnlinkSound = "physics/metal/metal_box_impact_bullet%s.wav"

Expand All @@ -34,8 +36,8 @@ local function CheckDistantLink(Entity, Crate, EntPos)
if EntPos:DistToSqr(Crate:GetPos()) > MaxDistance then
local Sound = UnlinkSound:format(math.random(1, 3))

Entity:EmitSound(Sound, 70, math.random(99, 109), ACF.Volume)
Crate:EmitSound(Sound, 70, math.random(99, 109), ACF.Volume)
Sounds.SendSound(Entity, Sound, 70, math.random(99, 109), 1)
Sounds.SendSound(Crate, Sound, 70, math.random(99, 109), 1)

CrateUnlinked = Entity:Unlink(Crate)
end
Expand Down Expand Up @@ -93,9 +95,8 @@ do -- Spawning and Updating --------------------

local function UpdateRack(Entity, Data, Rack)
Entity.ACF = Entity.ACF or {}
Entity.ACF.Model = Rack.Model -- Must be set before changing model

Entity:SetModel(Rack.Model)
Contraption.SetModel(Entity, Rack.Model)

Entity:PhysicsInit(SOLID_VPHYSICS)
Entity:SetMoveType(MOVETYPE_VPHYSICS)
Expand Down Expand Up @@ -130,11 +131,7 @@ do -- Spawning and Updating --------------------

ACF.Activate(Entity, true)

Entity.ACF.Model = Rack.Model
Entity.ACF.LegalMass = Rack.Mass

local Phys = Entity:GetPhysicsObject()
if IsValid(Phys) then Phys:SetMass(Rack.Mass) end
Contraption.SetMass(Entity, Rack.Mass)

do -- Removing old missiles
local Missiles = Entity.Missiles
Expand Down Expand Up @@ -324,7 +321,7 @@ do -- Custom ACF damage ------------------------

util.Effect("Sparks", Effect, true, true)

Rack:EmitSound(SparkSound:format(math.random(6)), math.random(55, 65), math.random(99, 101), ACF.Volume)
Sounds.SendSound(Rack, SparkSound:format(math.random(6)), math.random(55, 65), math.random(99, 101), 1)

timer.Simple(math.Rand(0.5, 2), function()
if not IsValid(Rack) then return end
Expand Down Expand Up @@ -477,7 +474,7 @@ do -- Entity Inputs ----------------------------
Entity:UpdatePoint()

if Entity.ForcedIndex then
Entity:EmitSound("buttons/blip2.wav", 70, math.random(99, 101), ACF.Volume)
Sounds.SendSound(Entity, "buttons/blip2.wav", 70, math.random(99, 101), 1)
end
end)

Expand Down Expand Up @@ -558,7 +555,7 @@ do -- Firing -----------------------------------

self:UpdatePoint()
else
self:EmitSound("weapons/pistol/pistol_empty.wav", 70, math.random(99, 101), ACF.Volume)
Sounds.SendSound(self, "weapons/pistol/pistol_empty.wav", 70, math.random(99, 101), 1)

Delay = 1
end
Expand Down Expand Up @@ -617,7 +614,7 @@ do -- Loading ----------------------------------
local Pos, Ang = GetMissileAngPos(Crate.BulletData, Point)
local Missile = MakeACF_Missile(Rack.Owner, Pos, Ang, Rack, Point, Crate)

Rack:EmitSound("acf_missiles/fx/bomb_reload.mp3", 70, math.random(99, 101), ACF.Volume)
Sounds.SendSound(Rack, "acf_missiles/fx/bomb_reload.mp3", 70, math.random(99, 101), 1)

return Missile
end
Expand Down Expand Up @@ -663,7 +660,7 @@ do -- Loading ----------------------------------
if not IsValid(Missile) then
Missile = nil
else
self:EmitSound("acf_missiles/fx/weapon_select.mp3", 70, math.random(99, 101), ACF.Volume)
Sounds.SendSound(self, "acf_missiles/fx/weapon_select.mp3", 70, math.random(99, 101), 1)

Point.State = "Loaded"
Point.NextFire = nil
Expand Down
17 changes: 7 additions & 10 deletions lua/entities/acf_radar/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ AddCSLuaFile("shared.lua")
include("shared.lua")

local ACF = ACF
local Contraption = ACF.Contraption

ACF.RegisterClassLink("acf_radar", "acf_rack", function(Radar, Target)
if Radar.Weapons[Target] then return false, "This rack is already linked to this radar!" end
Expand Down Expand Up @@ -39,6 +40,7 @@ end)
local Radars = ACF.ActiveRadars
local Damage = ACF.Damage
local CheckLegal = ACF.CheckLegal
local Sounds = ACF.Utilities.Sounds
local UnlinkSound = "physics/metal/metal_box_impact_bullet%s.wav"
local MaxDistance = ACF.LinkDistance * ACF.LinkDistance
local TraceData = { start = true, endpos = true, mask = MASK_SOLID_BRUSHONLY }
Expand Down Expand Up @@ -212,7 +214,7 @@ local function ScanForEntities(Entity)

if Count ~= Entity.TargetCount then
if Count > Entity.TargetCount then
Entity:EmitSound(Entity.SoundPath, 70, 100, ACF.Volume)
Sounds.SendSound(Entity, Entity.SoundPath, 70, 100, 1)
end

Entity.TargetCount = Count
Expand Down Expand Up @@ -271,8 +273,8 @@ local function CheckDistantLinks(Entity, Source)
if Position:DistToSqr(Link:GetPos()) > MaxDistance then
local Sound = UnlinkSound:format(math.random(1, 3))

Entity:EmitSound(Sound, 70, 100, ACF.Volume)
Link:EmitSound(Sound, 70, 100, ACF.Volume)
Sounds.SendSound(Entity, Sound, 70, 100, 1)
Sounds.SendSound(Link, Sound, 70, 100, 1)

Entity:Unlink(Link)
end
Expand Down Expand Up @@ -332,9 +334,8 @@ do -- Spawn and Update functions
local Delay = Radar.ThinkDelay

Entity.ACF = Entity.ACF or {}
Entity.ACF.Model = Radar.Model -- Must be set before changing model

Entity:SetModel(Radar.Model)
Contraption.SetModel(Entity, Radar.Model)

Entity:PhysicsInit(SOLID_VPHYSICS)
Entity:SetMoveType(MOVETYPE_VPHYSICS)
Expand Down Expand Up @@ -370,11 +371,7 @@ do -- Spawn and Update functions

ACF.Activate(Entity, true)

Entity.ACF.Model = Radar.Model
Entity.ACF.LegalMass = Radar.Mass

local Phys = Entity:GetPhysicsObject()
if IsValid(Phys) then Phys:SetMass(Radar.Mass) end
Contraption.SetMass(Entity, Radar.Mass)
end

function MakeACF_Radar(Player, Pos, Angle, Data)
Expand Down
13 changes: 5 additions & 8 deletions lua/entities/acf_receiver/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ AddCSLuaFile("shared.lua")
include("shared.lua")

local ACF = ACF
local Contraption = ACF.Contraption

--===============================================================================================--
-- Local Funcs and Vars
--===============================================================================================--

local Damage = ACF.Damage
local CheckLegal = ACF.CheckLegal
local Sounds = ACF.Utilities.Sounds
local TimerExists = timer.Exists
local TimerCreate = timer.Create
local TimerRemove = timer.Remove
Expand Down Expand Up @@ -60,7 +62,7 @@ local function CheckReceive(Entity)
WireLib.TriggerOutput(Entity, "Detected", IsDetected and 1 or 0)

if IsDetected then
Entity:EmitSound(Entity.SoundPath, 70, 100, ACF.Volume)
Sounds.SendSound(Entity, Entity.SoundPath, 70, 100, 1)
end

Entity:UpdateOverlay()
Expand Down Expand Up @@ -131,9 +133,8 @@ do -- Spawn and Update functions
local Delay = Receiver.ThinkDelay

Entity.ACF = Entity.ACF or {}
Entity.ACF.Model = Receiver.Model -- Must be set before changing model

Entity:SetModel(Receiver.Model)
Contraption.SetModel(Entity, Receiver.Model)

Entity:PhysicsInit(SOLID_VPHYSICS)
Entity:SetMoveType(MOVETYPE_VPHYSICS)
Expand Down Expand Up @@ -169,11 +170,7 @@ do -- Spawn and Update functions

ACF.Activate(Entity, true)

Entity.ACF.Model = Receiver.Model
Entity.ACF.LegalMass = Receiver.Mass

local Phys = Entity:GetPhysicsObject()
if IsValid(Phys) then Phys:SetMass(Receiver.Mass) end
Contraption.SetMass(Entity, Receiver.Mass)
end

function MakeACF_Receiver(Player, Pos, Ang, Data)
Expand Down
9 changes: 9 additions & 0 deletions materials/acf/core/wire.vmt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"UnlitGeneric"
{
"$basetexture" "acf/core/wire"
"$basetexturetransform" "center 0 0 scale 1 10 rotate 0 translate 1 0"
"$nocull" 1
"$MinLight" 1
"$MaxLight" 1
"$additive" 1
}
Binary file added materials/acf/core/wire.vtf
Binary file not shown.

0 comments on commit 2f39f97

Please sign in to comment.