Function AgentManagedStorage.CloneFrom
Gives a cloned agent its own copy of the managed data it currently shares with sourceSlot.
int CloneFrom (
int | sourceSlot | |
Entity | newOwner |
Gives a cloned agent its own copy of the managed data it currently shares with sourceSlot.
Clones what a new agent can reasonably re-use, and drops everything else.
Path: cloned
Callback hooks: dropped
ITraversalProvider: dropped
The clone's own slot, or -1 if sourceSlot holds nothing worth cloning, in which case the caller must allocate a fresh entry instead.
The entity owning sourceSlot may already have been destroyed, since a destroyed agent's entry stays intact until AgentManagedDataCleanupSystem releases it, cloning from it is still correct. What this cannot detect is the source having been released *and* the slot handed to an unrelated agent, which is why AgentManagedDataRepairSystem must run before that cleanup system.