Game.Prefabs.FireStation
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: ComponentBase, implements IServiceUpgrade
Summary:
Represents the Fire Station prefab used by the game to define fire department buildings. This prefab exposes editable capacity and efficiency fields (fire engines, helicopters, disaster response, vehicle efficiency) that are written into ECS component data at entity creation. The prefab registers the required ECS component types (FireStationData, UpdateFrameData) and, depending on other components present on the prefab, adds archetype components such as Game.Buildings.FireStation, Efficiency, ServiceDispatch, OwnedVehicle and ServiceDistrict. It is intended to be attached to building prefabs so the conversion/initialization pipeline can create the runtime entity with appropriate data.
Fields
-
public int m_FireEngineCapacity = 3
Number of fire engines the station can host. Written to FireStationData.m_FireEngineCapacity during Initialize. -
public int m_FireHelicopterCapacity
Number of fire/air units (helicopters) the station can host. Written to FireStationData.m_FireHelicopterCapacity during Initialize. -
public int m_DisasterResponseCapacity
Capacity reserved for disaster response units. Written to FireStationData.m_DisasterResponseCapacity during Initialize. -
public float m_VehicleEfficiency = 1f
Multiplier representing vehicle efficiency for this station. Written to FireStationData.m_VehicleEfficiency during Initialize.
Properties
- None (no public properties declared on this class).
Constructors
public FireStation()
Default constructor (uses field defaults). Prefab authors typically set fields in the inspector or via a derived prefab class.
Methods
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds component types required on the prefab for conversion into the runtime entity. Specifically adds:- FireStationData (read/write)
-
UpdateFrameData (read/write)
-
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Adds component types to the entity archetype depending on other components present on the prefab: - Always adds Game.Buildings.FireStation (read/write).
-
If the prefab does not include ServiceUpgrade:
- If CityServiceBuilding is present, adds Efficiency (read/write).
- Adds ServiceDispatch (read/write).
- Adds OwnedVehicle (read/write).
- If UniqueObject is not present, adds ServiceDistrict (read/write). This controls which runtime systems receive and manage the entity (dispatching vehicles, ownership, district assignment, efficiency handling).
-
public void GetUpgradeComponents(HashSet<ComponentType> components)
Adds component types relevant when the building is upgraded (service upgrade path). Adds: - Game.Buildings.FireStation (read/write)
- ServiceDispatch (read/write)
-
OwnedVehicle (read/write)
-
public override void Initialize(EntityManager entityManager, Entity entity)
Writes the prefab field values into the entity's ECS component data: - Sets FireStationData with m_FireEngineCapacity, m_FireHelicopterCapacity, m_DisasterResponseCapacity, m_VehicleEfficiency.
- Sets UpdateFrameData(7) on the entity (UpdateFrameData appears to control update scheduling/frame grouping).
Usage Example
// Example: extend the prefab to customize initialization or default capacities
[Preserve]
public class CustomFireStation : FireStation
{
public CustomFireStation()
{
// change default capacities for this derived prefab
m_FireEngineCapacity = 5;
m_FireHelicopterCapacity = 2;
m_DisasterResponseCapacity = 1;
m_VehicleEfficiency = 1.15f;
}
public override void Initialize(EntityManager entityManager, Entity entity)
{
// call base to write FireStationData and UpdateFrameData
base.Initialize(entityManager, entity);
// add custom initialization if needed, e.g. setting a mod-specific component
// entityManager.SetComponentData(entity, new MyMod.CustomTag { value = 1 });
}
}
Notes and tips for modders: - The prefab system or conversion pipeline will call GetPrefabComponents/GetArchetypeComponents/Initialize automatically when converting a GameObject prefab into an ECS entity. You usually do not call Initialize manually in normal prefab usage. - The presence (or absence) of other prefab components such as ServiceUpgrade, CityServiceBuilding or UniqueObject changes which runtime components are added — review those components if you want different dispatch/ownership/district behavior. - FireStationData and UpdateFrameData are the primary data containers written by this prefab; examine their definitions to understand how runtime systems will consume the values.