-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trenches - Add garbage collection for unbuilt trenches (#108)
Add unbuilt trenches to garbage system
- Loading branch information
Showing
5 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
SystemSettings : "{45C53F06BA17238D}configs/Systems/SystemsConfig.conf" { | ||
Systems { | ||
SCR_GarbageSystem "{5F10E7EA29B0EDEC}" { | ||
Rules { | ||
ComponentClassGarbageRule "{626E356A67F1AC10}" { | ||
Filter "ACE_Trenches_OutlineGarbageComponent" | ||
Lifetime 300 | ||
PlayerDistance 3.5 | ||
LifetimeResetPercentage 2 | ||
} | ||
} | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
addons/trenches/Configs/Systems/ChimeraSystemsConfig.conf.meta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
MetaFileClass { | ||
Name "{86E953538A28A98D}Configs/Systems/ChimeraSystemsConfig.conf" | ||
Configurations { | ||
CONFResourceClass PC { | ||
} | ||
CONFResourceClass XBOX_ONE : PC { | ||
} | ||
CONFResourceClass XBOX_SERIES : PC { | ||
} | ||
CONFResourceClass PS4 : PC { | ||
} | ||
CONFResourceClass PS5 : PC { | ||
} | ||
CONFResourceClass HEADLESS : PC { | ||
} | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...hes/PrefabsEditable/Auto/Compositions/Misc/FreeRoamBuilding/E_ACE_DirtCover_01_long_v1.et
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...nches/PrefabsEditable/Auto/Compositions/Misc/FreeRoamBuilding/E_ACE_DirtCover_01_short.et
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
addons/trenches/scripts/Game/ACE_Trenches/Components/ACE_Trenches_OutlineGarbageComponent.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//------------------------------------------------------------------------------------------------ | ||
class ACE_Trenches_OutlineGarbageComponentClass : ScriptComponentClass | ||
{ | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! Unbuilt structures with this component get handled by the garbage system | ||
//! It gets dropped from the queue once built | ||
class ACE_Trenches_OutlineGarbageComponent : ScriptComponent | ||
{ | ||
//------------------------------------------------------------------------------------------------ | ||
//! Add to garbage system queue on init | ||
override protected void OnPostInit(IEntity owner) | ||
{ | ||
super.OnPostInit(owner); | ||
|
||
if (!GetGame().InPlayMode() || !Replication.IsServer()) | ||
return; | ||
|
||
SCR_GarbageSystem garbageSystem = SCR_GarbageSystem.GetByEntityWorld(owner); | ||
if (!garbageSystem) | ||
return; | ||
|
||
SCR_CampaignBuildingCompositionComponent compositionComponent = SCR_CampaignBuildingCompositionComponent.Cast(owner.FindComponent(SCR_CampaignBuildingCompositionComponent)); | ||
if (!compositionComponent) | ||
return; | ||
|
||
garbageSystem.Insert(owner); | ||
compositionComponent.GetOnCompositionSpawned().Insert(OnCompositionSpawned); | ||
} | ||
|
||
//------------------------------------------------------------------------------------------------ | ||
//! Remove from garbage system queue when built | ||
protected void OnCompositionSpawned(bool compositionSpawned) | ||
{ | ||
SCR_CampaignBuildingCompositionComponent compositionComponent = SCR_CampaignBuildingCompositionComponent.Cast(GetOwner().FindComponent(SCR_CampaignBuildingCompositionComponent)); | ||
if (!compositionComponent) | ||
return; | ||
|
||
compositionComponent.GetOnCompositionSpawned().Remove(OnCompositionSpawned); | ||
|
||
SCR_GarbageSystem garbageSystem = SCR_GarbageSystem.GetByEntityWorld(GetOwner()); | ||
if (!garbageSystem) | ||
return; | ||
|
||
garbageSystem.Withdraw(GetOwner()); | ||
} | ||
} |