sc_entities_v1.watch
Calls fn(ctx, what, id, class) on the game thread for every entity of type that streams in or out (what: SC_ENTITY_STREAMED_IN, SC_ENTITY_STREAMED_OUT or both ORed), until unwatch or until your plugin unloads. out_watch_id = the watch’s id (never 0). type: an entity class name (“AEGS_Avenger_Titan”), matched exactly and case-sensitively, or a class prefix ending in one ‘’ (“AEGS_”). The host matches the type before calling you, so you pay only for what you asked about. Refused with SCO_BAD_ARG, and a reason: NULL, empty, a lone “”, a ‘’ that isn’t last (“AB”, “**”), more than SC_ENTITIES_MAX_TYPE_LEN characters, anything but printable ASCII or ‘?’, a what with no known bit, a null self, fn or out_watch_id. SCO_TOO_MANY: SC_ENTITIES_MAX_WATCHES exist. SCO_UNAVAILABLE: no “game.entities.watch” on this build, or while the hooks are unconfirmed; see docs/game-services.md. Events reach fn a tick after they happen, in order; if a plugin can’t keep up, the oldest are dropped.
Signature
Section titled “Signature”sco_result (*)(sco_plugin *, uint32_t, const char *, sc_entity_watch_fn, void *, uint64_t *)Service and availability
Section titled “Service and availability”| Property | Value |
|---|---|
| Symbol | sc_entities_v1.watch |
| Record ID | sc-entities-v1-watch |
| Service | game.entities |
| Table | sc_entities_v1 |
| Version macro | SC_ENTITIES_VERSION_1_1 |
| Packed table version | 65537 |
| Since / availability | size >= 64; 1.0 |
| Complete member extent (x64 bytes) | 64 |
| Table size (x64 bytes) | 96 |
Parameters and buffers
Section titled “Parameters and buffers”sco_result (*watch)(sco_plugin* self, uint32_t what, const char* type, sc_entity_watch_fn fn, void* ctx, uint64_t* out_watch_id);
Calls fn(ctx, what, id, class) on the game thread for every entity of type that streams in or out (what: SC_ENTITY_STREAMED_IN, SC_ENTITY_STREAMED_OUT or both ORed), until unwatch or until your plugin unloads. out_watch_id = the watch’s id (never 0). type: an entity class name (“AEGS_Avenger_Titan”), matched exactly and case-sensitively, or a class prefix ending in one ‘’ (“AEGS_”). The host matches the type before calling you, so you pay only for what you asked about. Refused with SCO_BAD_ARG, and a reason: NULL, empty, a lone “”, a ‘’ that isn’t last (“AB”, “**”), more than SC_ENTITIES_MAX_TYPE_LEN characters, anything but printable ASCII or ‘?’, a what with no known bit, a null self, fn or out_watch_id. SCO_TOO_MANY: SC_ENTITIES_MAX_WATCHES exist. SCO_UNAVAILABLE: no “game.entities.watch” on this build, or while the hooks are unconfirmed; see docs/game-services.md. Events reach fn a tick after they happen, in order; if a plugin can’t keep up, the oldest are dropped.
Results and failures
Section titled “Results and failures”Absent table: query_service NOT_FOUND; missing operation capability: UNAVAILABLE (alive: 0); invalid/released self: BAD_ARG. Additional failures/output state unspecified unless described in the buffer contract.
Absent capability
Section titled “Absent capability”Absent table: query_service NOT_FOUND
Ownership
Section titled “Ownership”Filter copied; fn/ctx borrowed until unwatch/unload. Callback class_name borrowed for call only; streamed-out ID already gone.
Thread affinity
Section titled “Thread affinity”Game thread only; callback runs game thread and may call unwatch/unload; other reentrancy unspecified.
Callback context
Section titled “Callback context”callback runs game thread and may call unwatch/unload
Reentrancy
Section titled “Reentrancy”callback runs game thread and may call unwatch/unload
Cleanup and cancellation
Section titled “Cleanup and cancellation”unwatch/ordinary unload/non-retained crash cleanup ends delivery; callback may unwatch itself or unload without further events. Oldest queued events dropped under overflow (256 held per watch). Retained-provider faults skip owner resource-release hooks and require restart; backing resources remain retained, not safe for cached calls. Fault quarantine stops guarded delivery without removing the retained watch.
Language mappings
Section titled “Language mappings”Status labels are copied verbatim from the catalogue: direct is native access; typed-wrapper is wrapper-backed; restricted is a subset/adaptation; unsupported means no supported route is established. No status implies universal safety.
| Language | Catalogue status | Source evidence / wrapper tokens |
|---|---|---|
| c | direct | include/sc_entities.h(*watch) |
| cpp | typed-wrapper | include/scosdk/game/entities.hppreturn t_ && Covers(t_->size, offsetof(sc_entities_v1, watch)) && t_->watch ? t_->watch(self_, what, type, fn, ctx, &watchId) : SCO_UNAVAILABLE; |
| csharp | typed-wrapper | sdk/csharp/Sco.Sdk/Game/Entities.csr = _t->watch(Self, what, c, fn, ctx, &w); |
| lua | unsupported | sdk/docs/lua.mdRead-only: a Lua plugin owns no entities, so there is no spawn, despawn, move or watch.plugins/lua/sco_lua_game.c { “alive”, L_ent_alive }, { “class_of”, L_ent_class_of }, { “get_transform”, L_ent_get_transform }, |
Examples
Section titled “Examples”None identified in the catalogue; this is not proof none can exist.
- tests/abi_game_entities.c
- tests/test_app.cpp
- tests/test_lua.cpp
- tests/test_language_routes.cpp
- sdk/csharp/Sco.Sdk.Tests/GameFakeHost.cs
- tests/test_language_routes.c
- tools/test.sh
- sdk/csharp/Sco.Sdk.Tests/GameLayout.cs
ABI pins prove layout, not semantic behavior or a live game session.