Move contents ejection on death after Death Call

This allows the scripter to access the contents in OnClonkDeath and similar callbacks preventing solutions using effects or static variables.
heavy-resources
Maikel de Vries 2014-04-22 20:15:26 +02:00
parent dfc4976e8c
commit 653b135919
1 changed files with 2 additions and 3 deletions

View File

@ -1121,8 +1121,6 @@ void C4Object::AssignDeath(bool fForced)
++Info->DeathCount;
Info->Retire();
}
// Lose contents
while ((thing=Contents.GetObject())) thing->Exit(thing->GetX(),thing->GetY());
// Remove from crew/cursor/view
C4Player *pPlr = ::Players.Get(Owner);
if (pPlr) pPlr->ClearPointers(this, true);
@ -1132,11 +1130,12 @@ void C4Object::AssignDeath(bool fForced)
// Engine script call
C4AulParSet pars(C4VInt(iDeathCausingPlayer));
Call(PSF_Death, &pars);
// Lose contents
while ((thing=Contents.GetObject())) thing->Exit(thing->GetX(),thing->GetY());
// Update OCF. Done here because previously it would have been done in the next frame
// Whats worse: Having the OCF change because of some unrelated script-call like
// SetCategory, or slightly breaking compatibility?
SetOCF();
// Engine broadcast: relaunch player (in CR, this was called from clonk script.
// Now, it is done for every crew member)
if(pPlr)