FB2PseudoSimulationManager
Overview
- Manager that runs tasks so that entities in the TimelineSimulateOnly state perform their timelines and other behaviors without ticking.
Metadata
| Field | Value |
|---|---|
| Kind | system |
| Environment | B2 - Simulation |
| Category | systems |
| Extends | FB2ManagerBase |
| Require | require('Systems.B2PseudoSimulationManager') |
Properties (11)
| Name | Type | Description |
|---|---|---|
DisableTickForSLOD2Active | boolean | Whether the B2DebugDisableTickForSLOD2 cheat is active. While active: entities newly entering SLOD2 are auto-OFF (tracked); tracked entities leaving SLOD2 are auto-ON (untracked). SimulationThread-only for both read and write, so no atomic needed. |
NextTickDisabledTaskUpdateIndex | integer | |
NextUpdateIndex | integer | |
TaskKeyLookupList | FB2TimelineSimulateOnlyTaskKey[] | |
TaskListMap | table<FB2TimelineSimulateOnlyTaskKey, FB2TimelineSimulateOnlyTask> | Tasks are created in entity Init on first game load, so no saving is needed. |
TemporarilyEnabledTickDisabledEntityMap | table<FB1EntityId, number> | |
TickDisabledByCommand | table<FB1EntityId, boolean> | Entities we disabled while the cheat is on, plus the game-time ticks at that moment. The OFF command restores exactly the entities still in the tracking map. Not a UPROPERTY (no serialization/reflection). Not preserved across City Move/save, so close each cheat cycle (ON -> OFF) within the same session. SimulationThread-only access. |
TickDisabledTaskAccumulatedRealSeconds | number | |
TickDisabledTaskKeyLookupList | FB1EntityId[] | |
TickDisabledTaskMap | table<FB1EntityId, FB2TickDisabledTask> | |
bProcessingTickDisabledTask | boolean |
Functions (11)
| Function | Parameters | Returns | Description |
|---|---|---|---|
ClearTickDisableStateOnAllEntitiesDestroy | - | - | Delegated call on FB2EntityManager::DestroyAllEntities entry. Restores ticks for all entities left in the tracking map and resets state, preventing the SetSimulationLevel hook from touching the tracking map during the destroy loop. |
DisableB2TickForSLOD2Entities | - | integer | Debug-only (UB2CheatManager::B2DebugDisableTickForSLOD2(true)). (1) Turns on the feature flag, (2) disables B2 Tick for current SLOD2 entities and registers them in the tracking map. While active, the SetSimulationLevel hook auto-OFFs newly entered SLOD2 entities and auto-ONs tracked entities that leave SLOD2. Returns the number of immediately disabled entities. SimulationThread-only. |
GetExportData | - | string | Returns Export Data. |
GetTickDisabledTrackedCount | - | integer | Returns the number of tracked entities (for status output). |
IsDisableTickForSLOD2Active | - | boolean | Returns whether the feature is active. Used for early-out at the SetSimulationLevel hook call site. |
OnEntitySimulationLevelChanged_ForTickDisable | InEntity: FB2Entity, InPrev: EB1SimulationLevel, InCurrent: EB1SimulationLevel | - | Hook called at the end of FB2Entity::SetSimulationLevel. Active only when the feature is on: entering SLOD2 -> tick OFF + register in tracking map; leaving SLOD2 -> tick ON + remove from tracking map. |
ReapplyB2TickForTrackedAfterSave | - | - | Called right after save completes. Re-disables the tracked entities that TemporarilyRestoreB2TickForSave temporarily enabled. Entities already disabled again for other reasons are left alone (per IsTickEnabledRaw). |
RestoreB2TickForDisabledEntities | OutTotalElapsedTicks: integer, OutMaxElapsedTicks: integer | integer | Debug-only (UB2CheatManager::B2DebugDisableTickForSLOD2(false)). Re-enables only the entities still in the tracking map and clears it, then turns off the feature flag. Entities already re-enabled by other code are excluded from counts. Returns the number of entities actually re-enabled. |
StaticRegisterTimelineSimulateOnlyTask (static) | InRequestContext: FB2TimelineSimulateOnlyRequestContext | - | |
StaticUnregisterTimelineSimulateOnlyTask (static) | InEntityId: FB1EntityId | - | |
TemporarilyRestoreB2TickForSave | - | - | Called on save entry. Prevents bTickEnabled=false from being permanently serialized while the cheat is active. The tracking map is kept; the same set is turned off again via ReapplyB2TickForTrackedAfterSave after the save completes. |
Override points (6)
Implement these in Lua as FB2PseudoSimulationManager.Override_Name = function(...) end.
| Function | Parameters | Returns | Description |
|---|---|---|---|
Override_ClearTickDisableStateOnAllEntitiesDestroy | - | - | Delegated call on FB2EntityManager::DestroyAllEntities entry. Restores ticks for all tracked entities and resets state. |
Override_DisableB2TickForSLOD2Entities | - | integer | Debug-only. Turns on the feature flag and disables B2 Tick for current SLOD2 entities, registering them in the tracking map. While active, the SetSimulationLevel hook auto-toggles tick as entities enter/leave SLOD2. Returns the number of immediately disabled entities. |
Override_OnEntitySimulationLevelChanged_ForTickDisable | InEntity: FB2Entity, InPrev: EB1SimulationLevel, InCurrent: EB1SimulationLevel | - | Hook called at the end of FB2Entity::SetSimulationLevel. Active only when the feature is on: entering SLOD2 -> tick OFF + track; leaving SLOD2 -> tick ON + untrack. |
Override_ReapplyB2TickForTrackedAfterSave | - | - | Called right after save completes. Re-disables the tracked entities temporarily enabled for the save. Entities already disabled for other reasons are left alone. |
Override_StaticUnregisterTimelineSimulateOnlyTask (static) | InEntityId: FB1EntityId | - | |
Override_TemporarilyRestoreB2TickForSave | - | - | Called on save entry. Prevents bTickEnabled=false from being permanently serialized while the cheat is active. The tracking map is kept and re-disabled after save. |