Actor events let you observe and intercept the full lifecycle of every in-game object — actors, bosses, scenery, sprites, items, and effects. They are defined inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/HarbourMasters/Starship/llms.txt
Use this file to discover all available pages before exploring further.
port/hooks/list/ActorEvent.h, with the item-drop event in port/hooks/list/ItemEvent.h.
Object Types
All lifecycle events carry anObjectEventType tag that identifies which engine subsystem owns the object. Always check this field before casting void* object to a concrete pointer.
ObjectEventType enum
Casting void* object
Type-safe cast pattern
Lifecycle Events
All five lifecycle events share the same two fields.Identifies the subsystem that owns this object. Use a
switch statement to select the correct cast target.Opaque pointer to the object. Cast to
Actor*, Boss*, Item*, etc. based on the type field.| Event | When it fires | Cancellable |
|---|---|---|
ObjectInitEvent | When an object is first initialised | Yes |
ObjectUpdateEvent | Every frame an object is active | Yes |
ObjectDrawPreSetupEvent | Before draw state is configured | Yes |
ObjectDrawPostSetupEvent | After draw state is configured | Yes |
ObjectDestroyEvent | When an object is destroyed | No |
ObjectInitEvent — object initialisation
ObjectInitEvent — object initialisation
Fires once when the engine first sets up an object. Cancelling this event suppresses the rest of the engine’s init code for that object, allowing you to replace initialisation entirely.
Log every actor spawn
ObjectUpdateEvent — per-frame update
ObjectUpdateEvent — per-frame update
Fires every frame for each active object in the scene. This is the most frequently called actor event — keep per-frame listener code tight to avoid frame-rate impact.Cancelling the event prevents the engine’s own update logic from running for that object that frame.
ObjectDrawPreSetupEvent — before draw state
ObjectDrawPreSetupEvent — before draw state
Fires before the engine configures the render state (matrix stack, display list, material) for this object. Cancel here to skip the engine’s setup and provide your own before drawing.
ObjectDrawPostSetupEvent — after draw state
ObjectDrawPostSetupEvent — after draw state
Fires after render state is configured but the draw call may still be running. Cancelling here suppresses the rest of the default draw path, letting you substitute custom rendering. This is the right place to swap a mesh or change draw-call parameters.
Replace gold ring mesh (from PortEnhancements.c)
ObjectDestroyEvent — object destruction
ObjectDestroyEvent — object destruction
Fires when an object is removed from the scene. This event is not cancellable — destruction has already been committed by the time listeners run. Use it for cleanup, logging, or triggering secondary effects tied to an object’s death.
Spawn particles on actor death
Item Drop Event
ItemDropEvent is defined separately in port/hooks/list/ItemEvent.h and fires when an item enters the world (drops from a defeated enemy or a scripted spawn).
Pointer to the newly dropped
Item struct. Inspect item->obj.id to identify the item type.| Event | When it fires | Cancellable |
|---|---|---|
ItemDropEvent | When an item is dropped into the world | Yes |
Log every item drop
Complete Example — Hooking Actor Spawning
The following example demonstrates a real-world pattern: filtering by object type and acting only on a specific actor ID.spawn_hook.c
Tracking Item Updates
item_update_hook.c