Skip to content

Commit

Permalink
Switched to the proper method of getting rid of the mass entmod
Browse files Browse the repository at this point in the history
- ACF entities will now properly use the duplicator library to get rid of their mass entity modifier on spawn.
  • Loading branch information
TwistedTail committed Sep 13, 2024
1 parent 31b50c6 commit 88503cb
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 40 deletions.
10 changes: 2 additions & 8 deletions lua/entities/acf_armor/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ do -- Spawning and Updating
Plate.Owner = Player -- MUST be stored on ent for PP
Plate.DataStore = Entities.GetArguments("acf_armor")

duplicator.ClearEntityModifier(Plate, "mass")

UpdatePlate(Plate, Data, Armor)

if Armor.OnSpawn then
Expand All @@ -113,14 +115,6 @@ do -- Spawning and Updating

hook.Run("ACF_OnEntitySpawn", "acf_armor", Plate, Data, Armor)

do -- Mass entity mod removal
local EntMods = Data.EntityMods

if EntMods and EntMods.mass then
EntMods.mass = nil
end
end

return Plate
end

Expand Down
10 changes: 2 additions & 8 deletions lua/entities/acf_engine/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ do -- Spawn and Update functions
Entity.DataStore = Entities.GetArguments("acf_engine")
Entity.revLimiterEnabled = true

duplicator.ClearEntityModifier(Entity, "mass")

UpdateEngine(Entity, Data, Class, Engine, Type)

WireLib.TriggerOutput(Entity, "Entity", Entity)
Expand All @@ -400,14 +402,6 @@ do -- Spawn and Update functions

Entity:UpdateOverlay(true)

do -- Mass entity mod removal
local EntMods = Data and Data.EntityMods

if EntMods and EntMods.mass then
EntMods.mass = nil
end
end

ACF.CheckLegal(Entity)

return Entity
Expand Down
10 changes: 2 additions & 8 deletions lua/entities/acf_fueltank/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ do -- Spawn and Update functions
Tank.LastActivated = 0
Tank.DataStore = Entities.GetArguments("acf_fueltank")

duplicator.ClearEntityModifier(Entity, "mass")

UpdateFuelTank(Tank, Data, Class, FuelTank, FuelType)

WireLib.TriggerOutput(Tank, "Entity", Tank)
Expand All @@ -228,14 +230,6 @@ do -- Spawn and Update functions

Tank:UpdateOverlay(true)

do -- Mass entity mod removal
local EntMods = Data and Data.EntityMods

if EntMods and EntMods.mass then
EntMods.mass = nil
end
end

-- Fuel tanks should be active by default
Tank:TriggerInput("Active", 1)

Expand Down
10 changes: 2 additions & 8 deletions lua/entities/acf_gearbox/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ do -- Spawn and Update functions -----------------------
Entity.RClutch = 1
Entity.DataStore = Entities.GetArguments("acf_gearbox")

duplicator.ClearEntityModifier(Entity, "mass")

UpdateGearbox(Entity, Data, Class, Gearbox)

WireLib.TriggerOutput(Entity, "Entity", Entity)
Expand All @@ -276,14 +278,6 @@ do -- Spawn and Update functions -----------------------

Entity:UpdateOverlay(true)

do -- Mass entity mod removal
local EntMods = Data and Data.EntityMods

if EntMods and EntMods.mass then
EntMods.mass = nil
end
end

ACF.CheckLegal(Entity)

timer.Create("ACF Gearbox Clock " .. Entity:EntIndex(), 3, 0, function()
Expand Down
10 changes: 2 additions & 8 deletions lua/entities/acf_gun/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ do -- Spawn and Update functions --------------------------------
Entity.TurretLink = false
Entity.DataStore = Entities.GetArguments("acf_gun")

duplicator.ClearEntityModifier(Entity, "mass")

UpdateWeapon(Entity, Data, Class, Weapon)

WireLib.TriggerOutput(Entity, "Status", "Empty")
Expand All @@ -267,14 +269,6 @@ do -- Spawn and Update functions --------------------------------

Entity:UpdateOverlay(true)

do -- Mass entity mod removal
local EntMods = Data and Data.EntityMods

if EntMods and EntMods.mass then
EntMods.mass = nil
end
end

TimerCreate("ACF Ammo Left " .. Entity:EntIndex(), 1, 0, function()
if not IsValid(Entity) then return end

Expand Down

0 comments on commit 88503cb

Please sign in to comment.