Skip to content

Engine → Scripting

null_script_host.h

The C++ fake of the managed side. It implements conjure_managed_api with recording functions: slots come from a LIFO free list, apply_fields stores the blob per slot and collect_fields echoes it, run_phase, dispatch_collisions and set_active are logged, sample_memory reports the figures set_managed_memory gave it, load_game_assembly registers fake classes (add_fake_class and an optional <assembly>.classes.json fixture) through the native table so the registry, blob and reload paths all run without .NET. Every scripting, scene, engine and editor test uses it; one null host is active (initialised) at a time.

Structs

File Description
null_host_recorder::activity_record One slot of a set_active call: the state asked for and whether the slot was live and changed.
null_host_recorder::apply_record
null_host_recorder::collision_record
null_host_recorder::create_record
null_host_recorder::destroy_record
null_host_recorder::phase_record
null_script_host::slot_state

Classes

File Description
null_host_recorder What the null host recorded. Cleared by null_script_host::reset_recorder(). Each list keeps at most MAX_RECORDS entries and counts the rest in dropped_count(), so a long-running null host (the headless editor runs one by default) stays bounded; set_enabled(false) records nothing at all (the counters keep counting).
null_script_host

Type Aliases

null_script_host::activity_hook

using activity_hook = std::function<void(i32 slot, bool active)>;

Runs inside set_active for every live slot whose state changed, after the change: what OnEnable (active) or OnDisable (inactive) would do.

null_script_host::collision_hook

using collision_hook = std::function<void(const conjure_collision_record &record)>;

Runs inside dispatch_collisions for every record: what OnCollisionEnter and friends would do.

null_script_host::create_hook

using create_hook = std::function<void(const conjure_create_request &request, i32 slot)>;

Runs inside create_instances once a request's slot is assigned. As the create hook, for a request without CREATE_FLAG_ALREADY_CREATED: what OnCreate would do. As the reload hook, for a request with it: what OnReload would do.

null_script_host::destroy_hook

using destroy_hook = std::function<void(i32 slot)>;

Runs inside destroy_instances for every live slot before it is freed when callOnDestroy is set: what OnDestroy would do.

null_script_host::phase_hook

using phase_hook = std::function<void(script_phase phase, f32 deltaTime)>;

Runs inside run_phase after the counters were bumped: what the phase callbacks would do.