Skip to main content

FB2PseudoSimulationManager

Overview

  • Manager that runs tasks so that entities in the TimelineSimulateOnly state perform their timelines and other behaviors without ticking.

Metadata

FieldValue
Kindsystem
EnvironmentB2 - Simulation
Categorysystems
ExtendsFB2ManagerBase
Requirerequire('Systems.B2PseudoSimulationManager')

Properties (11)

NameTypeDescription
DisableTickForSLOD2ActivebooleanWhether 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.
NextTickDisabledTaskUpdateIndexinteger
NextUpdateIndexinteger
TaskKeyLookupListFB2TimelineSimulateOnlyTaskKey[]
TaskListMaptable<FB2TimelineSimulateOnlyTaskKey, FB2TimelineSimulateOnlyTask>Tasks are created in entity Init on first game load, so no saving is needed.
TemporarilyEnabledTickDisabledEntityMaptable<FB1EntityId, number>
TickDisabledByCommandtable<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.
TickDisabledTaskAccumulatedRealSecondsnumber
TickDisabledTaskKeyLookupListFB1EntityId[]
TickDisabledTaskMaptable<FB1EntityId, FB2TickDisabledTask>
bProcessingTickDisabledTaskboolean

Functions (11)

FunctionParametersReturnsDescription
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-integerDebug-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-stringReturns Export Data.
GetTickDisabledTrackedCount-integerReturns the number of tracked entities (for status output).
IsDisableTickForSLOD2Active-booleanReturns whether the feature is active. Used for early-out at the SetSimulationLevel hook call site.
OnEntitySimulationLevelChanged_ForTickDisableInEntity: 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).
RestoreB2TickForDisabledEntitiesOutTotalElapsedTicks: integer, OutMaxElapsedTicks: integerintegerDebug-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.

FunctionParametersReturnsDescription
Override_ClearTickDisableStateOnAllEntitiesDestroy--Delegated call on FB2EntityManager::DestroyAllEntities entry. Restores ticks for all tracked entities and resets state.
Override_DisableB2TickForSLOD2Entities-integerDebug-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_ForTickDisableInEntity: 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.