@infernus/core Subsystems and Event Machinery

@infernus/core Subsystems and Event Machinery An architecture diagram generated by Archify. gamemode · lifecycle hooks · components: entities gamemode lifecycle hooks filterscript · script loader · components: entities filterscript script loader command · command dispatch · components: entities command command dispatch entities · entity instances · components: entities entities entity instances utils/bus.ts · event engine · utils: events and pools utils/bus.ts event engine utils/hook.ts · method interception · utils: events and pools utils/hook.ts method interception utils/pools.ts · entity registry · utils: events and pools utils/pools.ts entity registry internalProps · entity private state · utils: events and pools internalProps entity private state wrapper/native · native bindings · wrapper: native bindings wrapper/native native bindings __inject__ · swappable impl · wrapper: native bindings __inject__ swappable impl streamer wrapper · plugin natives · wrapper: native bindings streamer wrapper plugin natives global samp · event registration · Host: open.mp global samp event registration open.mp natives · native callback src · Host: open.mp open.mp natives native callback src streamer plugin · streaming plugin · Host: open.mp streamer plugin streaming plugin dispatch samp.on(name, trigger) instance to pool callNative Streamer calls register callback components: entities utils: events and pools wrapper: native bindings Host: open.mp Legend Frontend Backend Cloud Message bus

Event layer: utils/bus.ts

  • • eventBus is a Map<name, listener[]> where registration order is execution order; triggerBus keeps trigger for useTrigger reuse
  • • defineEvent returns [pusher, trigger]: pusher subscribes and returns off, trigger runs the whole middleware chain
  • • With isNative true, registerEvent plus samp.on happen at import; false makes it a purely in-process event

Entities and state: utils/pools.ts

  • • One Map pool per entity kind; Player enters on onConnect and leaves on onDisconnect, Vehicle on create/destroy
  • • internalPlayerProps is a Symbol key so plugins extending Player cannot overwrite core's private runtime fields
  • • A native callback resolves the raw id into the pooled instance before passing it to listeners as an object

Loading and lifecycle

  • • GameMode.use(script) only queues; the onInit listener loads in registration order and onExit unloads
  • • IFilterScript.load() must return an array of unsubscribe functions, called one by one on unload
  • • During unload and exit INTERNAL_FLAGS.skip is set, skipping native calls against a dead game