Skip to content

Commit

Permalink
Reduce entity spawn boilerplate a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
thecraftianman committed Jan 23, 2025
1 parent 3208306 commit 2b36823
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 23 deletions.
6 changes: 0 additions & 6 deletions lua/entities/acf_computer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,13 @@ do -- Spawn and update function

if not IsValid(Entity) then return end

Entity:SetPlayer(Player)
Entity:SetAngles(Angle)
Entity:SetPos(Pos)
Entity:Spawn()

Player:AddCleanup("acf_computer", Entity)
Player:AddCount(Limit, Entity)

Entity.Owner = Player -- MUST be stored on ent for PP
Entity.Weapons = {}
Entity.DataStore = Entities.GetArguments("acf_computer")

Expand All @@ -227,10 +225,6 @@ do -- Spawn and update function

hook.Run("ACF_OnSpawnEntity", "acf_computer", Entity, Data, Class, Computer)

WireLib.TriggerOutput(Entity, "Entity", Entity)

Entity:UpdateOverlay(true)

duplicator.ClearEntityModifier(Entity, "mass")

CheckLegal(Entity)
Expand Down
5 changes: 0 additions & 5 deletions lua/entities/acf_rack/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,13 @@ do -- Spawning and Updating --------------------

if not IsValid(Rack) then return end

Rack:SetPlayer(Player)
Rack:SetAngles(Ang)
Rack:SetPos(Pos)
Rack:Spawn()

Player:AddCleanup("acf_rack", Rack)
Player:AddCount(Limit, Rack)

Rack.Owner = Player -- MUST be stored on ent for PP
Rack.Firing = false
Rack.Reloading = false
Rack.Spread = 1 -- GunClass.spread
Expand All @@ -219,9 +217,6 @@ do -- Spawning and Updating --------------------

WireLib.TriggerOutput(Rack, "Rate of Fire", 60)
WireLib.TriggerOutput(Rack, "Reload Time", 1)
WireLib.TriggerOutput(Rack, "Entity", Rack)

Rack:UpdateOverlay(true)

duplicator.ClearEntityModifier(Rack, "mass")

Expand Down
6 changes: 0 additions & 6 deletions lua/entities/acf_radar/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -387,15 +387,13 @@ do -- Spawn and Update functions

if not IsValid(Radar) then return end

Radar:SetPlayer(Player)
Radar:SetAngles(Angle)
Radar:SetPos(Pos)
Radar:Spawn()

Player:AddCleanup("acf_radar", Radar)
Player:AddCount(Limit, Radar)

Radar.Owner = Player -- MUST be stored on ent for PP
Radar.Active = false
Radar.Scanning = false
Radar.TargetCount = 0
Expand All @@ -419,10 +417,6 @@ do -- Spawn and Update functions

hook.Run("ACF_OnSpawnEntity", "acf_radar", Radar, Data, Class, RadarData)

WireLib.TriggerOutput(Radar, "Entity", Radar)

Radar:UpdateOverlay(true)

duplicator.ClearEntityModifier(Radar, "mass")

CheckLegal(Radar)
Expand Down
6 changes: 0 additions & 6 deletions lua/entities/acf_receiver/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,13 @@ do -- Spawn and Update functions

if not IsValid(Receiver) then return end

Receiver:SetPlayer(Player)
Receiver:SetAngles(Ang)
Receiver:SetPos(Pos)
Receiver:Spawn()

Player:AddCleanup("acf_receiver", Receiver)
Player:AddCount(Limit, Receiver)

Receiver.Owner = Player -- MUST be stored on ent for PP
Receiver.DataStore = Entities.GetArguments("acf_receiver")
Receiver.Damage = 0

Expand All @@ -206,10 +204,6 @@ do -- Spawn and Update functions

hook.Run("ACF_OnSpawnEntity", "acf_receiver", Receiver, Data, Class, ReceiverData)

WireLib.TriggerOutput(Receiver, "Entity", Receiver)

Receiver:UpdateOverlay(true)

duplicator.ClearEntityModifier(Receiver, "mass")

CheckLegal(Receiver)
Expand Down

0 comments on commit 2b36823

Please sign in to comment.