Permalink
Browse files

qtscript: Add new event 'eventObjectRecycled(object)' for demolish an…

…d recycle actions.
  • Loading branch information...
1 parent f647455 commit a98cf2ace771bdde9556eadd6243691264d50864 @perim perim committed Feb 20, 2013
Showing with 7 additions and 1 deletion.
  1. +1 −0 src/droid.cpp
  2. +3 −0 src/qtscript.cpp
  3. +2 −1 src/qtscript.h
  4. +1 −0 src/structure.cpp
View
@@ -452,6 +452,7 @@ void recycleDroid(DROID *psDroid)
position.z = psDroid->pos.y;
position.y = psDroid->pos.z;
+ triggerEvent(TRIGGER_OBJECT_RECYCLED, psDroid);
vanishDroid(psDroid);
addEffect(&position, EFFECT_EXPLOSION, EXPLOSION_TYPE_DISCOVERY, false, NULL, false, gameTime - deltaGameTime + 1);
View
@@ -892,6 +892,9 @@ bool triggerEvent(SCRIPT_TRIGGER_TYPE trigger, BASE_OBJECT *psObj)
callFunction(engine, "eventReinforcementsArrived", QScriptValueList()); // deprecated!
callFunction(engine, "eventTransporterArrived", args);
break;
+ case TRIGGER_OBJECT_RECYCLED:
+ callFunction(engine, "eventObjectRecycled", args);
+ break;
case TRIGGER_TRANSPORTER_EXIT:
callFunction(engine, "eventTransporterExit", args);
break;
View
@@ -42,7 +42,8 @@ enum SCRIPT_TRIGGER_TYPE
TRIGGER_MISSION_TIMEOUT,
TRIGGER_GAME_LOADED,
TRIGGER_GAME_SAVING,
- TRIGGER_GAME_SAVED
+ TRIGGER_GAME_SAVED,
+ TRIGGER_OBJECT_RECYCLED
};
// ----------------------------------------------
View
@@ -928,6 +928,7 @@ void structureBuild(STRUCTURE *psStruct, DROID *psDroid, int buildPoints, int bu
}
if (buildPoints < 0 && psStruct->currentBuildPts == 0)
{
+ triggerEvent(TRIGGER_OBJECT_RECYCLED, psStruct);
removeStruct(psStruct, true);
}

0 comments on commit a98cf2a

Please sign in to comment.