AVisualScriptActor
- Module
- Game
- Header
#include "Game/AVisualScriptActor.h"- Namespace
Mowo- Reflection
- Reflected by MowoHeaderTool
Properties
| Type | Name | Description |
|---|---|---|
int | score | State a Visual Script graph can read/drive (reflected) Default 0. |
int | tickCount | Default 0. |
uint64_t | stamp | Default 0. |
Constructors
| Signature | Name | Description |
|---|---|---|
AVisualScriptActor() : m_visualScript(this, "AVisualScriptActor", true) | AVisualScriptActor |
Public functions
| Returns | Name | Description |
|---|---|---|
FVisualScriptRuntime& | GetVisualScriptRuntime | |
void | AddScore | |
int | GetScore | |
void | RecordTick | |
int | GetTickCount | |
Vec2 | GetScorePair | |
void | ServerAddScore | RPC-annotated surface. |
void | ClientSetScore | |
void | MulticastSetStamp | |
void | MulticastVisualScriptVars | Visual Script variable replication (the receive half). |
void | InstallVisualScriptActorFactory | Visual Script binding Adopt a synthetic class + its event graphs (called by the spawn path before BeginPlay). |
void | BindVisualScriptClass | |
void | TryBind | Spawn-path helper: bind iff actor is visual-script-backed (any backing class) and cls is a Visual Script synthetic class (cls->userData set). |
bool | IsVisualScriptBound | |
MClass* | GetClass | Report the synthetic Visual Script class when bound, else the native MClass. |
void | OnConstruct | |
void | BeginPlay | |
void | Tick | |
void | EndPlay | |
void | Destroyed | Self-events, the Blueprint set a graph can implement by naming an event graph after them. |
float | TakeDamage | |
bool | IsDead | A Visual Script class opts into death by declaring a Bool variable "IsDead"; without one the actor is never dead. |
void | NotifyHit | |
bool | CallVisualScriptFunction | Run one of this class's Visual Script functions in this actor's own context — what another actor's Call On Target lands on when the name is a Visual Script function rather than a reflected method. |
void | AdvanceLatents | Advance any pending latent (Delay) graph runs by dt seconds, resuming the ones whose timer elapses. |
bool | HasPendingLatents | |
void | ReceivePin | Input-pin entry: stores the payload in the "PinPayload" variable and runs pin as an event graph. |
const VisualScriptValue* | FindVar | Read a per-instance Visual Script variable (inspector / tests). |
void | SetVar | Set a per-instance Visual Script variable. |
bool | FindVarType | The declared type of a variable anywhere in the class chain — false when the name isn't a declared class variable. |
void | CollectVarOverrides | Every variable whose current value differs from the class-declared default: the Visual Script analog of a CDO delta. |
bool | IsAuthoredOverride | The CDO-propagation rule, as one decision: is current authored instance state, or is it still the class default seeded handed this instance? Only the first survives a class-default edit — the second has to follow the new default, which is what makes raising a default in the Actor Editor reach every placed instance that never touched the field. |
bool | PushReplicatedVars | Ship every replicated variable whose value differs from what this actor last got onto the wire. |
void | SetComponentSlotOverride | Per-instance component-slot overrides — the placed-actor half of LG10. |
void | CollectComponentSlotOverrides | |
const VisualScriptValue* | FindComponentSlotOverride | |
EntityID | FindSlotEntity | Backing entity of a PLACED component slot (one that declared a transform or an attach parent), or INVALID_ENTITY. |
Function details
AVisualScriptActor
AVisualScriptActor() : m_visualScript(this, "AVisualScriptActor", true)GetVisualScriptRuntime
FVisualScriptRuntime& GetVisualScriptRuntime() overrideAddScore
void AddScore(int n)GetScore
int GetScore() constRecordTick
void RecordTick()GetTickCount
int GetTickCount() constGetScorePair
Vec2 GetScorePair() constServerAddScore
void ServerAddScore(int32_t n)RPC-annotated surface. A Visual Script graph calling these gets real routing: the VM ships a Server call to the authority, a Client/Multicast call to its client(s), through FNetSession — never the LG6 execute-locally trap. Concrete bodies double as the routing fixtures the self-tests pin.
ClientSetScore
void ClientSetScore(int32_t value)MulticastSetStamp
void MulticastSetStamp(uint64_t value)MulticastVisualScriptVars
void MulticastVisualScriptVars(const std::string& blob)Visual Script variable replication (the receive half). The authority packs every replicated Visual Script variable that changed into this blob and multicasts it; riding an RPC-flagged MFUNCTION is what gives the update the authority rule for free — FVisualScriptRpcCodec refuses a Multicast that did not arrive from the server, so a client cannot push variable state at its peers. A variable whose value actually changed and that declares a RepNotify runs that function afterwards, on the receiver only.
InstallVisualScriptActorFactory
static void InstallVisualScriptActorFactory()Visual Script binding Adopt a synthetic class + its event graphs (called by the spawn path before BeginPlay). After this GetClass() reports synthetic. Installs every backing class's factory into VisualScriptClassRegistry, keyed by the native base it stands in for, plus the runtime's hooks. Idempotent.
BindVisualScriptClass
void BindVisualScriptClass(MClass* synthetic, VisualScriptClass* def)TryBind
static void TryBind(AActor* actor, MClass* cls)Spawn-path helper: bind iff actor is visual-script-backed (any backing class) and cls is a Visual Script synthetic class (cls->userData set). A no-op for native actors/classes.
IsVisualScriptBound
bool IsVisualScriptBound() constGetClass
MClass* GetClass() const overrideReport the synthetic Visual Script class when bound, else the native MClass.
OnConstruct
void OnConstruct() overrideBeginPlay
void BeginPlay() overrideTick
void Tick(float deltaSeconds) overrideEndPlay
void EndPlay() overrideDestroyed
void Destroyed() overrideSelf-events, the Blueprint set a graph can implement by naming an event graph after them. Each one is looked up in the class chain and skipped when the class has no graph of that name: "Destroyed" an explicit MWorld::Destroy, before EndPlay "AnyDamage" TakeDamage; DamageAmount / DamageInstigator set "OnHit" a physics contact begins on the backing entity or a placed slot; PinPayload = the other actor, HitLocation / HitNormal / HitImpulse set "InputAction.<Name>" the named input action Started this frame "InputAction.<Name>.Released" ... Completed "InputAction.<Name>.Held" ... Triggered (every firing frame) "OnTriggerEnter" / "OnTriggerExit" a Trigger slot's overlaps (existing) Input graphs are polled from Tick against the process-wide action system, like Blueprint's Auto Receive Input: no possession needed, and a later possession cannot wipe them the way a MPlayerInput binding would be.
TakeDamage
float TakeDamage(float amount, AActor* instigator) overrideIsDead
bool IsDead() const overrideA Visual Script class opts into death by declaring a Bool variable "IsDead"; without one the actor is never dead.
NotifyHit
void NotifyHit(AActor* other, const Vec3& location, const Vec3& normal, float impulse)CallVisualScriptFunction
bool CallVisualScriptFunction(const std::string& functionName, const std::vector<VisualScriptValue>& args, VisualScriptValue* ret)Run one of this class's Visual Script functions in this actor's own context — what another actor's Call On Target lands on when the name is a Visual Script function rather than a reflected method. ret takes the return value.
AdvanceLatents
void AdvanceLatents(float dt)Advance any pending latent (Delay) graph runs by dt seconds, resuming the ones whose timer elapses. Called from Tick; exposed for tests.
HasPendingLatents
bool HasPendingLatents() constReceivePin
void ReceivePin(const std::string& pin, const VisualScriptValue& payload)Input-pin entry: stores the payload in the "PinPayload" variable and runs pin as an event graph. Called by MWorld's wire routing.
FindVar
const VisualScriptValue* FindVar(const std::string& name) constRead a per-instance Visual Script variable (inspector / tests). Nullptr when the name isn't declared anywhere in the class chain.
SetVar
void SetVar(const std::string& name, const VisualScriptValue& value)Set a per-instance Visual Script variable. The scene loader applies serialized overrides through here after BindVisualScriptClass seeded the class defaults.
FindVarType
bool FindVarType(const std::string& name, FMValueType& outType) constThe declared type of a variable anywhere in the class chain — false when the name isn't a declared class variable. The loader types an override value with it.
CollectVarOverrides
void CollectVarOverrides(std::vector<std::pair<std::string, VisualScriptValue>>& out) constEvery variable whose current value differs from the class-declared default: the Visual Script analog of a CDO delta. Runtime-only keys (PinPayload) and anything not declared in the class chain are skipped, so only authored variables round-trip through the scene.
IsAuthoredOverride
static bool IsAuthoredOverride(const VisualScriptValue& current, const VisualScriptValue* seeded)The CDO-propagation rule, as one decision: is current authored instance state, or is it still the class default seeded handed this instance? Only the first survives a class-default edit — the second has to follow the new default, which is what makes raising a default in the Actor Editor reach every placed instance that never touched the field. seeded is null when the class did not declare the variable at bind time, and a value nobody ever seeded is authored by definition.
PushReplicatedVars
bool PushReplicatedVars(bool forceFull = false)Ship every replicated variable whose value differs from what this actor last got onto the wire. Authority-only — a remote instance returns false without touching the net layer. forceFull re-sends the whole set (a peer that just joined has none of it). Returns true when an update actually left. Public so a headless test can drive one update without a frame loop.
SetComponentSlotOverride
void SetComponentSlotOverride(const std::string& slotName, const std::string& propertyName, const VisualScriptValue& value)Per-instance component-slot overrides — the placed-actor half of LG10. A key is "<slot>.<property>"; the value replaces the class default when ApplyComponentSlots runs. Set before OnConstruct (the loader's job) or call OnConstruct again after setting.
CollectComponentSlotOverrides
void CollectComponentSlotOverrides(std::vector<std::pair<std::string, VisualScriptValue>>& out) constFindComponentSlotOverride
const VisualScriptValue* FindComponentSlotOverride(const std::string& slotName, const std::string& propertyName) constFindSlotEntity
EntityID FindSlotEntity(const std::string& slotName) constBacking entity of a PLACED component slot (one that declared a transform or an attach parent), or INVALID_ENTITY. Tests and tooling resolve the child entity a slot produced through this.