CrewMembers are only banned from resurrection during Death callbacks (#532)

This avoids immediate resurrection, but allows Clonks to return later in
the same round, just like they can return later in the next round.
Günther Brammer 2011-10-02 18:47:21 +02:00
parent d9c431e7e4
commit 5ca85f97c5
5 changed files with 16 additions and 20 deletions

View File

@ -23,7 +23,8 @@
</param>
</params>
</syntax>
<desc>Adds or removes an object (usually a clonk) to or from the crew of a player. The object must have the CrewMember property set in the DefCore.</desc>
<desc>Adds or removes an object (usually a clonk) to or from the crew of a player. The object must have the CrewMember property set in the DefCore.
This does not add the object to the permanent crew of the player, use <funclink>MakeCrewMember</funclink> for that.</desc>
<examples>
<example>
<code>var nClonk = <funclink>CreateObject</funclink>(Clonk);

View File

@ -50,7 +50,6 @@ public:
int32_t Age;
char DeathMessage[C4MaxDeathMsg+1];
C4ValueMapData ExtraData;
bool NoSave; // set for _XYZ-CrewMembers
public:
bool Save(C4Group &hGroup, class C4DefList *pDefs);
bool Load(C4Group &hGroup);

View File

@ -1109,6 +1109,7 @@ void C4Object::AssignDeath(bool fForced)
// Values
Alive=0;
ClearCommands();
C4ObjectInfo * pInfo = Info;
if (Info)
{
Info->HasDied=true;
@ -1137,7 +1138,8 @@ void C4Object::AssignDeath(bool fForced)
if(!pPlr->Crew.ObjectCount())
::GameScript.GRBroadcast(PSF_RelaunchPlayer,
&C4AulParSet(C4VInt(Owner),C4VInt(iDeathCausingPlayer)));
if (pInfo)
pInfo->HasDied = false;
}
bool C4Object::ChangeDef(C4ID idNew)
@ -2559,7 +2561,6 @@ bool C4Object::AssignInfo()
// Dead and gone (info flags, remove from crew/cursor)
if (!Alive)
{
Info->HasDied=true;
if (ValidPlr(Owner)) ::Players.Get(Owner)->ClearPointers(this, true);
}
return true;
@ -4364,8 +4365,6 @@ bool C4Object::GrabInfo(C4Object *pFrom)
SetName(Info->Name);
// retire from old crew
Info->Retire();
// set death status
Info->HasDied = !Alive;
// if alive, recruit to new crew
if (Alive) Info->Recruit();
// make new crew member

View File

@ -39,7 +39,7 @@ public:
int32_t InActionTime;
bool HasDied;
int32_t ControlCount;
class C4Def *pDef; // definition to ID - only eresolved if defs were loaded at object info loading time
class C4Def *pDef; // definition to ID - only resolved if defs were loaded at object info loading time
char Filename[_MAX_PATH+1];
C4ObjectInfo *Next;
public:

View File

@ -134,13 +134,11 @@ C4ObjectInfo* C4ObjectInfoList::GetIdle(C4ID c_id, C4DefList &rDefs)
// Use standard crew or matching id
if ( (!c_id && !pDef->NativeCrew) || (pInfo->id==c_id) )
// Participating and not in action
if (pInfo->Participation) if (!pInfo->InAction)
// Not dead
if (!pInfo->HasDied)
// Highest experience
if (!pHiExp || (pInfo->Experience>pHiExp->Experience))
// Set this
pHiExp=pInfo;
if (pInfo->Participation && !pInfo->InAction && !pInfo->HasDied)
// Highest experience
if (!pHiExp || (pInfo->Experience>pHiExp->Experience))
// Set this
pHiExp=pInfo;
// Found
if (pHiExp)
@ -211,12 +209,11 @@ C4ObjectInfo* C4ObjectInfoList::GetIdle(const char *szByName)
// Find matching name, participating, alive and not in action
for (pInfo=First; pInfo; pInfo=pInfo->Next)
if (SEqualNoCase(pInfo->Name,szByName))
if (pInfo->Participation) if (!pInfo->InAction)
if (!pInfo->HasDied)
{
pInfo->Recruit();
return pInfo;
}
if (pInfo->Participation && !pInfo->InAction && !pInfo->HasDied)
{
pInfo->Recruit();
return pInfo;
}
return NULL;
}