Game.Simulation.TradeNode
Assembly: Assembly-CSharp.dll
Namespace: Game.Simulation
Type: struct
Base: System.ValueType (struct); implements IComponentData, IQueryTypeParameter, IEmptySerializable
Summary:
TradeNode is an empty/marker ECS component used to tag entities that represent trade nodes in the simulation. The struct is deliberately declared with a fixed layout and Size = 1 byte via StructLayout to avoid being treated as a zero-sized type by serializers or some ECS subsystems; it therefore participates cleanly in entity queries and serialization flows. It implements IComponentData so it can be attached to entities, IQueryTypeParameter so it can be used directly in query building helpers, and IEmptySerializable to indicate empty-structure serialization behavior expected by the game's custom serializer.
Fields
none
This struct contains no instance fields. The [StructLayout(LayoutKind.Sequential, Size = 1)] attribute reserves a single byte of storage to ensure the type has a non-zero size for serialization and runtime representation.
Properties
none
No properties are defined; the type is a simple marker/flag component.
Constructors
public TradeNode()
The default parameterless constructor is used (implicit). Constructing withnew TradeNode()
yields the empty marker value; no state is stored.
Methods
none
No methods are defined. Behavior is purely by presence/absence on an entity and by how systems interpret entities carrying this component.
Usage Example
// Add the marker component to an entity
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity e = entityManager.CreateEntity();
entityManager.AddComponentData(e, new TradeNode());
// Example SystemBase query using the marker to filter entities
public partial class TradeNodeProcessingSystem : SystemBase
{
protected override void OnUpdate()
{
// Process entities that have TradeNode and some other component (e.g., TradeComponent)
Entities
.WithAll<TradeNode>()
.ForEach((ref TradeComponent trade) =>
{
// handle trade node logic here
}).Schedule();
}
}
{{ This component is a lightweight tag to mark and query trade-related entities. When modding, use it to identify trade nodes in systems or to serialize/deserialize trade-related entity sets. The Size = 1 layout attribute is important: it prevents the type from being treated as a zero-sized component by certain serialization or reflection code paths used by the game. }}