Game.Simulation.IPollution
Assembly: Assembly-CSharp (game runtime)
Namespace: Game.Simulation
Type: interface
Base: N/A (interface)
Summary:
Interface for reporting pollution changes to the simulation. Implementations receive pollution deltas (signed 16-bit) from various simulation systems (buildings, vehicles, effects) so the global pollution state can be updated accordingly. The Add method conveys an amount to be added to the pollution accumulator; positive values increase pollution, negative values decrease it (if supported by the implementation).
Fields
None
There are no fields defined on this interface.
Properties
None
This interface exposes no properties.
Constructors
None
Interfaces do not define constructors.
Methods
void Add(short amount)
Adds a signed 16-bit amount to the pollution system. The interpretation of the amount (units per tick/frame, absolute vs. relative) depends on the implementation used by the simulation. Typical considerations for modders:- Positive values usually increase pollution; negative values may reduce it if the system supports remediation.
- Amount range is -32768..32767 (System.Int16).
- You should call this from appropriate simulation threads/contexts; consult the game's simulation threading rules — calling from the wrong thread may be unsafe.
- Implementations may aggregate and scale values internally; do not assume a one-to-one mapping to a visible pollution metric.
Usage Example
// Obtain an IPollution reference from your simulation context (mechanism depends on the modding API)
// For illustration only — replace the acquisition code with the correct API call for your mod.
IPollution pollution = /* get from simulation manager or dependency injection */ null;
// Report 10 units of pollution
if (pollution != null)
{
pollution.Add(10);
}
// Report removal/cleanup of 5 units
if (pollution != null)
{
pollution.Add(-5);
}
Notes: - How you obtain an IPollution instance depends on the game's exposed API; check SimulationManager or service locators provided by the modding SDK. - Respect the simulation's update rules and call this method from the proper simulation step to avoid race conditions or inconsistent state.