Skip to content

Game.Simulation.IAvailabilityInfoCell

Assembly: Assembly-CSharp
Namespace: Game.Simulation

Type: interface

Base: none

Summary:
Interface used by the simulation to collect and accumulate availability-related metrics for a single simulation cell. Implementers receive incremental updates for attractiveness, consumer demand, service capacity and workplace capacity. This is a lightweight contract intended to be implemented by cell/state objects that aggregate these values during simulation passes.


Fields

  • This interface declares no fields.
    Implementing types will typically store backing fields (e.g., float totals) to accumulate the provided amounts.

Properties

  • This interface declares no properties.
    Implementers may expose read-only properties or methods to retrieve accumulated totals as needed by the simulation.

Constructors

  • Interfaces do not declare constructors.
    Concrete implementations should provide suitable constructors to initialize internal accumulators.

Methods

  • void AddAttractiveness(float amount)
    Adds the given amount to the cell's attractiveness accumulator. Use this to increase (or decrease, if negative) how attractive this cell is for residents/visitors.

  • void AddConsumers(float amount)
    Adds the given amount to the cell's consumer demand accumulator. Represents consumer capacity/demand contribution from buildings or agents.

  • void AddServices(float amount)
    Adds the given amount to the cell's services accumulator. Represents service provision (e.g., retail/services capacity) contributed to the cell.

  • void AddWorkplaces(float amount)
    Adds the given amount to the cell's workplace accumulator. Represents jobs/workplace capacity contributed to the cell.

Notes: - All methods accept a float and do not return a value; they are intended to be called repeatedly during simulation to accumulate totals. - Units and semantics of the float values are defined by the higher-level simulation systems; implementers should follow the conventions used elsewhere in the simulation (e.g., per-frame additive contributions). - Consider thread-safety if these methods are called from multiple threads/jobs — typical single-threaded or job-aware implementations may be needed depending on usage.

Usage Example

namespace Game.Simulation
{
    // Example concrete implementation that accumulates values.
    public class AvailabilityInfoCell : IAvailabilityInfoCell
    {
        private float _attractiveness;
        private float _consumers;
        private float _services;
        private float _workplaces;

        public void AddAttractiveness(float amount)
        {
            _attractiveness += amount;
        }

        public void AddConsumers(float amount)
        {
            _consumers += amount;
        }

        public void AddServices(float amount)
        {
            _services += amount;
        }

        public void AddWorkplaces(float amount)
        {
            _workplaces += amount;
        }

        // Example accessors:
        public float GetAttractiveness() => _attractiveness;
        public float GetConsumers() => _consumers;
        public float GetServices() => _services;
        public float GetWorkplaces() => _workplaces;
    }
}

{{ This interface is typically implemented by simulation cell/state objects that participate in supply/demand and attractiveness calculations. When creating custom simulation logic or mods that integrate with the game's availability system, implement this interface to collect incremental contributions from buildings, agents or other systems. Be mindful of where and how these methods are invoked (single-threaded simulation loop vs. multi-threaded jobs) and protect internal state accordingly. }}