Skip to main content

FB2ServiceManager

Overview

  • Manages facility services.

Metadata

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

Properties (8)

NameTypeDescription
ExecuteContextMaptable<string, FB2ExecuteContextList>
NextCheckTimeOutTicksinteger
SelectContextMaptable<string, FB2SelectContextList>
SelectExecuteConnectionsFB1ServiceSelectExecuteConnection[]Connection between the selection context and the execution context.
ServiceJobLookupTabletable<FB1EntityId, string>Job info of service Zois.
ServiceJobPooltable<string, FB2JobEntityPool>Zoi info per service job group [JobId, list of service Zois].
ServiceRoleTabletable<FB1EntityId, string>Role info of service Zois. Elements are added when a service starts and removed when it ends.
SpawnContextstable<FB1ServiceContextId, FB2ServiceSpawnContext>

Functions (24)

FunctionParametersReturnsDescription
AddServiceInRequestContext: FB1ServiceRequestContext, OutSelectContext: FB1ServiceSelectContextbooleanFunction called when an external system requests a service.
CanExecuteServiceTimeCheckInServiceId: string, OutExpireOrNextExecuteTicks: integerbooleanChecks whether the service-execution time condition is satisfied.
DoesServiceAlreadyExistInRequestContext: FB1ServiceRequestContextbooleanChecks whether the service is currently running.
FinishServiceExceptionalOccasionInServiceTargetEntityId: FB1EntityId, bIsForSite: boolean-Used when a service must be ended in an exceptional situation.
GetExecuteContextByContextIdInExecuteContextId: FB1ServiceContextId, OutExecuteContext: FB1ServiceExecuteContextbooleanReturns Execute Context By Context Id.
GetExecuteContextByServiceIdInServiceId: string, InExecuteContextId: FB1ServiceContextId, OutExecuteContext: FB1ServiceExecuteContextbooleanReturns Execute Context By Service Id.
GetExecuteContextFromTriggerEntityIdInServiceId: string, InTriggerEntityId: FB1EntityId, OutExecuteContext: FB1ServiceExecuteContextbooleanReturns Execute Context From Trigger Entity Id.
GetExecuteContextIdInSelectContextId: FB1ServiceContextIdFB1ServiceContextIdReturns Execute Context Id.
GetExecutingServiceContextInServiceEntityId: FB1EntityId, OutContext: FB1ServiceExecuteContextbooleanHelper. Returns the context of the service that the executing ServiceNpc is specifically performing.
GetExecutingServiceEntityIdsByGroupIdInGroupId: string, InSearchEntityId: FB1EntityId, OutEntityIds: FB1EntityId[]booleanReturns the list of ServiceNpc EntityIds currently executing a service at the given SiteEntityId.
GetSelectContextByContextIdInSelectId: FB1ServiceContextId, OutSelectContext: FB1ServiceSelectContextbooleanReturns Select Context By Context Id.
GetSelectContextByServiceIdInServiceId: string, InSelectContextId: FB1ServiceContextId, OutSelectContext: FB1ServiceSelectContextbooleanReturns Select Context By Service Id.
GetSelectContextIdInExecuteContextId: FB1ServiceContextIdFB1ServiceContextIdReturns Select Context Id.
GetSelectExecuteConnectionInSelectContextId: FB1ServiceContextId, OutConnection: FB1ServiceSelectExecuteConnectionbooleanContext Getters
GetServiceJobIdInServiceEntityId: FB1EntityId, OutServiceJobId: stringbooleanReturns the service Zoi's job ID.
GetServiceRoleIdInServiceEntityId: FB1EntityId, OutServiceRoleId: stringbooleanReturns the service Zoi's role ID.
GetSpawnContextInContextId: FB1ServiceContextId, OutSpawnContext: FB2ServiceSpawnContextbooleanReturns the service spawn context.
IsExecutingServiceInServiceEntityId: FB1EntityIdbooleanReturns whether the ServiceNpc is currently performing a service.
IsForSiteType (static)InType: EB1ServiceVisitTypebooleanReturns whether For Site Type.
OnApplyPlanByEntityJobInEntityId: FB1EntityId, InJobId: string-Callback invoked on Apply Plan By Entity Job.
OnApplyPlanByGeneratedListInGeneratedList: any[]-Manages the service-Zoi pool.
OnFinishServiceInEntityId: FB1EntityId-Called when a service Zoi has reached its despawn point and despawned after the service timeline ends.
OnLeaveCompanyInEntityId: FB1EntityId-Callback invoked on Leave Company.
ScriptFinishServiceInSubjectEntityId: FB1EntityId, InServiceSubjectType: EB1ServiceSubjectType, InServiceGroupId: string-Used to end a service NPC's service via script.

Override points (3)

Implement these in Lua as FB2ServiceManager.Override_Name = function(...) end.

FunctionParametersReturnsDescription
Override_FinishServiceExceptionalOccasionInServiceTargetEntityId: FB1EntityId, bIsForSite: boolean-Used when a service must be ended in an exceptional situation.
Override_OnLeaveCompanyInEntityId: FB1EntityId-Callback invoked on Leave Company.
Override_ScriptFinishServiceInSubjectEntityId: FB1EntityId, InServiceSubjectType: EB1ServiceSubjectType, InServiceGroupId: string-Used to end a service NPC's service via script.