MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / onNewDataBlock

Method onNewDataBlock

Engine/source/afx/afxMagicSpell.cpp:846–890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

844// STANDARD OVERLOADED METHODS //
845
846bool afxMagicSpell::onNewDataBlock(GameBaseData* dptr, bool reload)
847{
848 mDatablock = dynamic_cast<afxMagicSpellData*>(dptr);
849 if (!mDatablock || !Parent::onNewDataBlock(dptr, reload))
850 return false;
851
852 if (isServerObject() && started_with_newop)
853 {
854 // copy dynamic fields from the datablock but
855 // don't replace fields with a value
856 assignDynamicFieldsFrom(dptr, arcaneFX::sParameterFieldPrefix, true);
857 }
858
859 mExeblock = mDatablock;
860 mMissile_db = mDatablock->mMissile_db;
861
862 if (isClientObject())
863 {
864 // make a temp datablock clone if there are substitutions
865 if (mDatablock->getSubstitutionCount() > 0)
866 {
867 afxMagicSpellData* orig_db = mDatablock;
868 mDatablock = new afxMagicSpellData(*orig_db, true);
869 mExeblock = orig_db;
870 mMissile_db = mDatablock->mMissile_db;
871 // Don't perform substitutions yet, the spell's dynamic fields haven't
872 // arrived yet and the substitutions may refer to them. Hold off and do
873 // in in the onAdd() method.
874 }
875 }
876 else if (started_with_newop)
877 {
878 // make a temp datablock clone if there are substitutions
879 if (mDatablock->getSubstitutionCount() > 0)
880 {
881 afxMagicSpellData* orig_db = mDatablock;
882 mDatablock = new afxMagicSpellData(*orig_db, true);
883 mExeblock = orig_db;
884 orig_db->performSubstitutions(mDatablock, this, ranking);
885 mMissile_db = mDatablock->mMissile_db;
886 }
887 }
888
889 return true;
890}
891
892void afxMagicSpell::processTick(const Move* m)
893{

Callers

nothing calls this directly

Calls 2

getSubstitutionCountMethod · 0.80
performSubstitutionsMethod · 0.80

Tested by

no test coverage detected