Skip to content

Game.Simulation.HealthcareRequest

Assembly:
Assembly-CSharp (game code)

Namespace:
Game.Simulation

Type:
struct

Base:
IComponentData, IQueryTypeParameter, ISerializable

Summary:
Represents a healthcare service request originating from a citizen within the ECS (Entity Component System). This component stores the requesting citizen Entity and the specific HealthcareRequestType (an enum describing the kind of healthcare needed). It implements ISerializable so instances can be written to and read from the game's serialization streams (for saving/loading or networked state sync).


Fields

  • public Unity.Entities.Entity m_Citizen
    Holds the Entity identifier of the citizen who issued the healthcare request. This is an ECS Entity reference; when storing or using this field be mindful of entity remapping that may occur during serialization/deserialization or scene loading.

  • public HealthcareRequestType m_Type
    Specifies the type of healthcare request (likely an enum such as Emergency, Routine, Transport, etc.). Use this to route the request to appropriate healthcare systems/services.

Properties

  • None.
    This struct exposes its data as public fields rather than properties.

Constructors

  • public HealthcareRequest(Unity.Entities.Entity citizen, HealthcareRequestType type)
    Creates a new HealthcareRequest initialized with the given citizen Entity and request type.

Methods

  • public void Serialize<TWriter>(TWriter writer) where TWriter : Colossal.Serialization.Entities.IWriter
    Writes the component state to a writer. Implementation writes the citizen Entity followed by the request type as a single byte.

  • public void Deserialize<TReader>(TReader reader) where TReader : Colossal.Serialization.Entities.IReader
    Reads the component state from a reader. Implementation reads the citizen Entity and a byte representing the HealthcareRequestType, casting it back to the enum.

Usage Example

// Constructing a request and adding it as a component to an entity (example)
Entity citizenEntity = /* obtain citizen entity */;
var request = new HealthcareRequest(citizenEntity, HealthcareRequestType.Emergency);

// Example: adding to an EntityManager (pseudo-code)
EntityManager entityManager = /* get EntityManager */;
entityManager.AddComponentData(someRequestEntity, request);

// Serialization example (writer provided by engine save system)
writer.Write(request.m_Citizen);
writer.Write((byte)request.m_Type);

// Deserialization example (reader provided by engine load system)
HealthcareRequest loaded = default;
reader.Read(out loaded.m_Citizen);
reader.Read(out byte value);
loaded.m_Type = (HealthcareRequestType)value;

Notes: - HealthcareRequestType is expected to be an enum; check game code for its exact members. - Because m_Citizen is an Entity, care must be taken when saving/loading or cloning worlds where entity remapping may be necessary.