Skip to content

Commit 2f39f97

Browse files
committed
Merge branch 'dev'
2 parents 6698813 + 2acb097 commit 2f39f97

File tree

11 files changed

+55
-55
lines changed

11 files changed

+55
-55
lines changed

.github/workflows/workshop-upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Upload to Workshop
2727
uses: CFC-Servers/gmod-upload@master
2828
with:
29-
id: 3182731439
29+
id: 3248769787
3030
changelog: "${{ github.event.head_commit.message }}"
3131
title: "[ACF-3] Armored Combat Framework - Missiles"
3232
type: "tool"

lua/acf/core/utilities/entity_tracking_sv.lua

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
local ACF = ACF
2-
local Clock = ACF.Utilities.Clock
3-
local NextUpdate = 0
4-
local Entities = {}
5-
local Ancestors = {}
1+
local ACF = ACF
2+
local Clock = ACF.Utilities.Clock
3+
local Contraption = ACF.Contraption
4+
local NextUpdate = 0
5+
local Entities = {}
6+
local Ancestors = {}
67

78
local Whitelist = {
89
-- Garry's Mod entities
@@ -40,7 +41,7 @@ local Whitelist = {
4041
}
4142

4243
local function GetAncestor(Entity)
43-
local Ancestor = ACF_GetAncestor(Entity)
44+
local Ancestor = Contraption.GetAncestor(Entity)
4445

4546
if not IsValid(Ancestor) then return end
4647
if Ancestor == Entity then return end

lua/acf/entities/guidance/wire_mclos.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
local ACF = ACF
22
local Guidances = ACF.Classes.Guidances
3+
local Sounds = ACF.Utilities.Sounds
34
local Guidance = Guidances.Register("Wire (MCLOS)", "Radio (MCLOS)")
45

56
function Guidance:Configure(Missile)
@@ -30,7 +31,7 @@ else
3031
LastFired.GuidanceData:SnapRope(LastFired)
3132
end
3233

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

@@ -54,7 +55,7 @@ else
5455
self.Rope = nil
5556

5657
if IsValid(self.Source) then
57-
self.Source:EmitSound(SnapSound:format(math.random(3)), nil, nil, ACF.Volume)
58+
Sounds.SendSound(self.Source, SnapSound:format(math.random(3)), nil, nil, 1)
5859
end
5960
end
6061
end

lua/effects/acf_glatgmexplosion.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
local TraceData = { start = true, endpos = true, mask = true }
22
local TraceLine = util.TraceLine
3-
3+
local Sounds = ACF.Utilities.Sounds
44

55
function EFFECT:Init(Data)
66
self.DirVec = Data:GetNormal()
@@ -31,8 +31,8 @@ function EFFECT:Airburst()
3131
local Mult = self.ParticleMul
3232
local sndrad = math.Clamp(Radius * 20, 75, 165)
3333
local sndradp = 300 - Radius
34-
sound.Play("ambient/explosions/explode_4.wav", self.Origin, sndrad, math.Clamp(sndradp * 25, 15, 170), ACF.Volume)
35-
sound.Play("ambient/explosions/explode_9.wav", self.Origin, sndrad, math.Clamp(sndradp * 22, 15, 120), ACF.Volume)
34+
Sounds.PlaySound(self.Origin, "ambient/explosions/explode_4.wav", sndrad, math.Clamp(sndradp * 25, 15, 170), 1)
35+
Sounds.PlaySound(self.Origin, "ambient/explosions/explode_9.wav", sndrad, math.Clamp(sndradp * 22, 15, 120), 1)
3636
local EF = self.Emitter:Add("effects/muzzleflash" .. math.random(1, 4), Origin )
3737
if EF then
3838
EF:SetVelocity(self.DirVec * 100)

lua/entities/acf_computer/init.lua

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ AddCSLuaFile("cl_init.lua")
55
include("shared.lua")
66

77
local ACF = ACF
8+
local Contraption = ACF.Contraption
89
local Damage = ACF.Damage
910
local Utilities = ACF.Utilities
1011
local Clock = Utilities.Clock
12+
local Sounds = Utilities.Sounds
1113

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

82-
Entity:EmitSound(Sound, 70, 100, ACF.Volume)
83-
Link:EmitSound(Sound, 70, 100, ACF.Volume)
84+
Sounds.SendSound(Entity, Sound, 70, 100, 1)
85+
Sounds.SendSound(Link, Sound, 70, 100, 1)
8486

8587
Entity:Unlink(Link)
8688
end
@@ -121,9 +123,8 @@ do -- Spawn and update function
121123

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

126-
Entity:SetModel(Computer.Model)
127+
Contraption.SetModel(Entity, Computer.Model)
127128

128129
Entity:PhysicsInit(SOLID_VPHYSICS)
129130
Entity:SetMoveType(MOVETYPE_VPHYSICS)
@@ -158,11 +159,7 @@ do -- Spawn and update function
158159

159160
ACF.Activate(Entity, true)
160161

161-
Entity.ACF.LegalMass = Computer.Mass
162-
Entity.ACF.Model = Computer.Model
163-
164-
local Phys = Entity:GetPhysicsObject()
165-
if IsValid(Phys) then Phys:SetMass(Computer.Mass) end
162+
Contraption.SetMass(Entity, Computer.Mass)
166163

167164
if Entity.OnUpdate then
168165
Entity:OnUpdate(Data, Class, Computer)

lua/entities/acf_missile/init.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ local ActiveMissiles = ACF.ActiveMissiles
1313
local Ballistics = ACF.Ballistics
1414
local Classes = ACF.Classes
1515
local Clock = ACF.Utilities.Clock
16+
local Sounds = ACF.Utilities.Sounds
1617
local Damage = ACF.Damage
1718
local Missiles = Classes.Missiles
1819
local InputActions = ACF.GetInputActions("acf_missile")
@@ -69,7 +70,7 @@ local function LaunchEffect(Missile)
6970
if ACF_SOUND_EXT then
7071
hook.Run("ACF_SOUND_MISSILE", Missile, Sound)
7172
else
72-
Missile:EmitSound(Sound, 180, math.random(99, 101), ACF.Volume)
73+
Sounds.SendSound(Missile, Sound, 180, math.random(99, 101), 1)
7374
end
7475
end
7576

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

515-
self:EmitSound("phx/epicmetal_hard.wav", 70, math.random(99, 101), ACF.Volume)
516+
Sounds.SendSound(self, "phx/epicmetal_hard.wav", 70, math.random(99, 101), 1)
516517
self:SetNotSolid(false)
517518
self:SetNoDraw(false)
518519
self:SetParent()

lua/entities/acf_rack/init.lua

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ include("shared.lua")
88
local EMPTY = { Type = "Empty", PropMass = 0, ProjMass = 0, Tracer = 0 }
99
local HookRun = hook.Run
1010
local ACF = ACF
11+
local Contraption = ACF.Contraption
1112
local Classes = ACF.Classes
1213
local Utilities = ACF.Utilities
1314
local Clock = Utilities.Clock
15+
local Sounds = Utilities.Sounds
1416
local MaxDistance = ACF.LinkDistance * ACF.LinkDistance
1517
local UnlinkSound = "physics/metal/metal_box_impact_bullet%s.wav"
1618

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

37-
Entity:EmitSound(Sound, 70, math.random(99, 109), ACF.Volume)
38-
Crate:EmitSound(Sound, 70, math.random(99, 109), ACF.Volume)
39+
Sounds.SendSound(Entity, Sound, 70, math.random(99, 109), 1)
40+
Sounds.SendSound(Crate, Sound, 70, math.random(99, 109), 1)
3941

4042
CrateUnlinked = Entity:Unlink(Crate)
4143
end
@@ -93,9 +95,8 @@ do -- Spawning and Updating --------------------
9395

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

98-
Entity:SetModel(Rack.Model)
99+
Contraption.SetModel(Entity, Rack.Model)
99100

100101
Entity:PhysicsInit(SOLID_VPHYSICS)
101102
Entity:SetMoveType(MOVETYPE_VPHYSICS)
@@ -130,11 +131,7 @@ do -- Spawning and Updating --------------------
130131

131132
ACF.Activate(Entity, true)
132133

133-
Entity.ACF.Model = Rack.Model
134-
Entity.ACF.LegalMass = Rack.Mass
135-
136-
local Phys = Entity:GetPhysicsObject()
137-
if IsValid(Phys) then Phys:SetMass(Rack.Mass) end
134+
Contraption.SetMass(Entity, Rack.Mass)
138135

139136
do -- Removing old missiles
140137
local Missiles = Entity.Missiles
@@ -324,7 +321,7 @@ do -- Custom ACF damage ------------------------
324321

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

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

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

479476
if Entity.ForcedIndex then
480-
Entity:EmitSound("buttons/blip2.wav", 70, math.random(99, 101), ACF.Volume)
477+
Sounds.SendSound(Entity, "buttons/blip2.wav", 70, math.random(99, 101), 1)
481478
end
482479
end)
483480

@@ -558,7 +555,7 @@ do -- Firing -----------------------------------
558555

559556
self:UpdatePoint()
560557
else
561-
self:EmitSound("weapons/pistol/pistol_empty.wav", 70, math.random(99, 101), ACF.Volume)
558+
Sounds.SendSound(self, "weapons/pistol/pistol_empty.wav", 70, math.random(99, 101), 1)
562559

563560
Delay = 1
564561
end
@@ -617,7 +614,7 @@ do -- Loading ----------------------------------
617614
local Pos, Ang = GetMissileAngPos(Crate.BulletData, Point)
618615
local Missile = MakeACF_Missile(Rack.Owner, Pos, Ang, Rack, Point, Crate)
619616

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

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

668665
Point.State = "Loaded"
669666
Point.NextFire = nil

lua/entities/acf_radar/init.lua

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ AddCSLuaFile("shared.lua")
44
include("shared.lua")
55

66
local ACF = ACF
7+
local Contraption = ACF.Contraption
78

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

213215
if Count ~= Entity.TargetCount then
214216
if Count > Entity.TargetCount then
215-
Entity:EmitSound(Entity.SoundPath, 70, 100, ACF.Volume)
217+
Sounds.SendSound(Entity, Entity.SoundPath, 70, 100, 1)
216218
end
217219

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

274-
Entity:EmitSound(Sound, 70, 100, ACF.Volume)
275-
Link:EmitSound(Sound, 70, 100, ACF.Volume)
276+
Sounds.SendSound(Entity, Sound, 70, 100, 1)
277+
Sounds.SendSound(Link, Sound, 70, 100, 1)
276278

277279
Entity:Unlink(Link)
278280
end
@@ -332,9 +334,8 @@ do -- Spawn and Update functions
332334
local Delay = Radar.ThinkDelay
333335

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

337-
Entity:SetModel(Radar.Model)
338+
Contraption.SetModel(Entity, Radar.Model)
338339

339340
Entity:PhysicsInit(SOLID_VPHYSICS)
340341
Entity:SetMoveType(MOVETYPE_VPHYSICS)
@@ -370,11 +371,7 @@ do -- Spawn and Update functions
370371

371372
ACF.Activate(Entity, true)
372373

373-
Entity.ACF.Model = Radar.Model
374-
Entity.ACF.LegalMass = Radar.Mass
375-
376-
local Phys = Entity:GetPhysicsObject()
377-
if IsValid(Phys) then Phys:SetMass(Radar.Mass) end
374+
Contraption.SetMass(Entity, Radar.Mass)
378375
end
379376

380377
function MakeACF_Radar(Player, Pos, Angle, Data)

lua/entities/acf_receiver/init.lua

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ AddCSLuaFile("shared.lua")
55
include("shared.lua")
66

77
local ACF = ACF
8+
local Contraption = ACF.Contraption
89

910
--===============================================================================================--
1011
-- Local Funcs and Vars
1112
--===============================================================================================--
1213

1314
local Damage = ACF.Damage
1415
local CheckLegal = ACF.CheckLegal
16+
local Sounds = ACF.Utilities.Sounds
1517
local TimerExists = timer.Exists
1618
local TimerCreate = timer.Create
1719
local TimerRemove = timer.Remove
@@ -60,7 +62,7 @@ local function CheckReceive(Entity)
6062
WireLib.TriggerOutput(Entity, "Detected", IsDetected and 1 or 0)
6163

6264
if IsDetected then
63-
Entity:EmitSound(Entity.SoundPath, 70, 100, ACF.Volume)
65+
Sounds.SendSound(Entity, Entity.SoundPath, 70, 100, 1)
6466
end
6567

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

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

136-
Entity:SetModel(Receiver.Model)
137+
Contraption.SetModel(Entity, Receiver.Model)
137138

138139
Entity:PhysicsInit(SOLID_VPHYSICS)
139140
Entity:SetMoveType(MOVETYPE_VPHYSICS)
@@ -169,11 +170,7 @@ do -- Spawn and Update functions
169170

170171
ACF.Activate(Entity, true)
171172

172-
Entity.ACF.Model = Receiver.Model
173-
Entity.ACF.LegalMass = Receiver.Mass
174-
175-
local Phys = Entity:GetPhysicsObject()
176-
if IsValid(Phys) then Phys:SetMass(Receiver.Mass) end
173+
Contraption.SetMass(Entity, Receiver.Mass)
177174
end
178175

179176
function MakeACF_Receiver(Player, Pos, Ang, Data)

materials/acf/core/wire.vmt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"UnlitGeneric"
2+
{
3+
"$basetexture" "acf/core/wire"
4+
"$basetexturetransform" "center 0 0 scale 1 10 rotate 0 translate 1 0"
5+
"$nocull" 1
6+
"$MinLight" 1
7+
"$MaxLight" 1
8+
"$additive" 1
9+
}

materials/acf/core/wire.vtf

5.49 KB
Binary file not shown.

0 commit comments

Comments
 (0)