mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 12:14:45 +00:00
Merge pull request #1640 from Azaezel/alpha41/ExtraOnAdds
Some checks are pending
Linux Build / ${{matrix.config.name}} (map[build_type:Release cc:gcc cxx:g++ generator:Ninja name:Ubuntu Latest GCC]) (push) Waiting to run
MacOSX Build / ${{matrix.config.name}} (map[build_type:Release cc:clang cxx:clang++ generator:Ninja name:MacOSX Latest Clang]) (push) Waiting to run
Windows Build / ${{matrix.config.name}} (map[build_type:Release cc:cl cxx:cl environment_script:C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat generator:Visual Studio 17 2022 name:Windows Latest MSVC]) (push) Waiting to run
Some checks are pending
Linux Build / ${{matrix.config.name}} (map[build_type:Release cc:gcc cxx:g++ generator:Ninja name:Ubuntu Latest GCC]) (push) Waiting to run
MacOSX Build / ${{matrix.config.name}} (map[build_type:Release cc:clang cxx:clang++ generator:Ninja name:MacOSX Latest Clang]) (push) Waiting to run
Windows Build / ${{matrix.config.name}} (map[build_type:Release cc:cl cxx:cl environment_script:C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat generator:Visual Studio 17 2022 name:Windows Latest MSVC]) (push) Waiting to run
trip onadd in additional places
This commit is contained in:
commit
7cad861536
|
|
@ -125,6 +125,11 @@ IMPLEMENT_CALLBACK( GameBase, setControl, void, ( bool controlled ), ( controlle
|
|||
"client controls this object.\n" );
|
||||
|
||||
|
||||
IMPLEMENT_CALLBACK(GameBase, onAdd, void, (SimObjectId ID), (ID),
|
||||
"Called when this ScriptObject is added to the system.\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
);
|
||||
|
||||
GameBaseData::GameBaseData()
|
||||
{
|
||||
mCategory = StringTable->EmptyString();
|
||||
|
|
@ -518,6 +523,7 @@ void GameBase::scriptOnAdd()
|
|||
// everything is ready.
|
||||
if (mDataBlock && !isGhost())
|
||||
mDataBlock->onAdd_callback( this );
|
||||
onAdd_callback(getId());
|
||||
}
|
||||
|
||||
void GameBase::scriptOnNewDataBlock(bool reload)
|
||||
|
|
|
|||
|
|
@ -469,6 +469,8 @@ private:
|
|||
void _onDatablockModified();
|
||||
protected:
|
||||
void onScopeIdChange() override { setMaskBits(ScopeIdMask); }
|
||||
|
||||
DECLARE_CALLBACK(void, onAdd, (SimObjectId ID));
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,16 @@ EndImplementBitfieldType;
|
|||
|
||||
IMPLEMENT_CONOBJECT( SimObject );
|
||||
|
||||
IMPLEMENT_CALLBACK(SimObject, onAdd, void, (SimObjectId ID), (ID),
|
||||
"Called when this SimObject is added to the system, if the className is set to something\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
);
|
||||
|
||||
IMPLEMENT_CALLBACK(SimObject, onRemove, void, (SimObjectId ID), (ID),
|
||||
"Called when this SimObject is removed from the system, if the className is set to something\n"
|
||||
"@param ID Unique object ID assigned when created (%this in script).\n"
|
||||
);
|
||||
|
||||
// See full description in the new CHM manual
|
||||
ConsoleDocClass( SimObject,
|
||||
"@brief Base class for almost all objects involved in the simulation.\n\n"
|
||||
|
|
@ -1689,6 +1699,8 @@ bool SimObject::onAdd()
|
|||
|
||||
linkNamespaces();
|
||||
|
||||
onAdd_callback(getId());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1698,6 +1710,8 @@ void SimObject::onRemove()
|
|||
{
|
||||
mFlags.clear(Added);
|
||||
|
||||
onRemove_callback(getId());
|
||||
|
||||
unlinkNamespaces();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -987,6 +987,9 @@ class SimObject: public ConsoleObject, public TamlCallbacks
|
|||
DECLARE_CALLBACK(void, onInspectPostApply, (SimObject* obj));
|
||||
DECLARE_CALLBACK(void, onSelected, (SimObject* obj));
|
||||
DECLARE_CALLBACK(void, onUnselected, (SimObject* obj));
|
||||
|
||||
DECLARE_CALLBACK(void, onAdd, (SimObjectId ID));
|
||||
DECLARE_CALLBACK(void, onRemove, (SimObjectId ID));
|
||||
|
||||
static SimObject* __findObject( const char* id ) { return Sim::findObject( id ); }
|
||||
static const char* __getObjectId( ConsoleObject* object )
|
||||
|
|
|
|||
Loading…
Reference in a new issue