Game.Prefabs.CargoTransportStationData
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: struct
Base: IComponentData, IQueryTypeParameter, IEmptySerializable
Summary:
ECS component that stores a work multiplier for cargo transport station prefabs. This value is used by the game to scale station-related work/throughput/production logic for cargo transport stations. The struct is a plain data container intended for use with Unity.Entities (DOTS) and Colossal's serialization system.
Fields
public float m_WorkMultiplier
Controls how much "work" the cargo transport station performs relative to a baseline. Values > 1 increase effective work/throughput, values between 0 and 1 decrease it. Default for an uninitialized struct is 0.0f; most game code or modders should set a sensible value (for example 1.0f for baseline behavior) before using the component.
Notes: - As a public field on an IComponentData struct, it is safe to read/write via EntityManager or in jobs when the proper change/access patterns are observed. - Consider using meaningful values (e.g., 0.5, 1.0, 2.0) depending on desired scaling of station performance.
-
private System.Diagnostics.Stopwatch m_Stopwatch
This component does not declare such a field. (Template placeholder removed.) -
private Unity.Jobs.JobHandle <producerHandle>k__BackingField
This component does not declare such a field. (Template placeholder removed.)
Properties
None declared on this struct. (Only the public field m_WorkMultiplier is present.)
Constructors
public CargoTransportStationData()
(default value-type constructor)
As a value-type (struct) there is an implicit parameterless constructor that initializes m_WorkMultiplier to 0.0f. Create instances with an object initializer to set a meaningful multiplier: var data = new CargoTransportStationData { m_WorkMultiplier = 1.0f };
Methods
None declared. This is a plain data container used by systems and serialization.
Additional notes for modders
- Because this implements IComponentData, add/remove/query it using Unity.Entities APIs (EntityManager, SystemBase, etc.).
- IQueryTypeParameter makes the type usable directly in query signatures in some DOTS helper patterns.
- IEmptySerializable is part of Colossal.Serialization.Entities and indicates the type participates in the game's custom serialization pipeline; keep field layout stable for compatibility with saved games and networked state where applicable.
- When changing the multiplier at runtime, ensure appropriate synchronization (EntityCommandBuffer or structural change patterns) if modifying from jobs or across threads.
Usage Example
// Add/set component on an entity (EntityManager context)
var data = new CargoTransportStationData { m_WorkMultiplier = 1.2f };
entityManager.AddComponentData(stationEntity, data);
// Update later (in a SystemBase)
Entities
.WithAll<CargoTransportStationTag>() // example tag/filter
.ForEach((ref CargoTransportStationData stationData) =>
{
// Increase work multiplier by 10%
stationData.m_WorkMultiplier *= 1.1f;
}).Schedule();