struct
SushiEngine::Simulation::ScriptComponent
One user-defined "script" component attached to an entity.
- Declared in
engine/world/simulation/include/SushiEngine/simulation/entity_types.hpp
void on_message(SushiEngine::Simulation::IWorldEditor& world,
SushiEngine::Simulation::EntityId self,
SushiEngine::Simulation::EntityId sender,
const std::string& name,
const SushiEngine::Simulation::ScriptField& payload) override
{
if (name == "StartSpinning")
{
SushiEngine::Simulation::ScriptField speed;
speed.name = "speed";
speed.kind = SushiEngine::Simulation::ScriptFieldKind::Float;
speed.number = payload.number;
SushiEngine::Simulation::ScriptComponent script;
script.type_name = "SpinningLight";
script.fields.push_back(speed);
world.add_script_component(self, script);
}
if (name == "StopSpinning")
world.remove_script_component(self, "SpinningLight");
}
Named by type_name (the script's class name) and carrying a flat list of authored fields. The simulation stores instances per entity as plain host bookkeeping keyed on EntityId, while the catalog of definitions lives in the editor.
Properties
type_name | The script's type/class name. |
fields | Its authored fields, in order. |

