#333: Clonk can turn cannon after having grabbed it by using an item

stable-5.1
Tobias Zwick 2010-07-29 21:11:04 +02:00
parent 3ccdb7bf2d
commit beb2cec9d9
4 changed files with 12 additions and 2 deletions

View File

@ -311,7 +311,11 @@ protected func Departure() { CancelUse(); return _inherited(...); }
// The same for vehicles
protected func AttachTargetLost() { CancelUse(); return _inherited(...); }
protected func GrabLost() { CancelUse(); return _inherited(...); }
protected func Grab(object target, bool ungrab)
{
if (ungrab) CancelUse();
return _inherited(target,ungrab,...);
}
// ...aaand the same for when the clonk is deselected
protected func CrewSelection(bool unselect)

View File

@ -3526,6 +3526,8 @@ void GrabLost(C4Object *cObj)
{
// Grab lost script call on target (quite hacky stuff...)
cObj->Action.Target->Call(PSF_GrabLost);
// Also, delete the target from the clonk's action (Newton)
cObj->Action.Target = NULL;
// Clear commands down to first PushTo (if any) in command stack
for (C4Command *pCom=cObj->Command; pCom; pCom=pCom->Next)
if (pCom->Next && pCom->Next->Command==C4CMD_PushTo)

View File

@ -287,8 +287,12 @@ bool ObjectComUnGrab(C4Object *cObj)
{
if (!cObj->CloseMenu(false)) return false;
cObj->Call(PSF_Grab, &C4AulParSet(C4VObj(pTarget), C4VBool(false)));
// clear action target
cObj->Action.Target = NULL;
if (pTarget && pTarget->Status && cObj->Status)
{
pTarget->Call(PSF_Grabbed, &C4AulParSet(C4VObj(cObj), C4VBool(false)));
}
return true;
}
}

View File

@ -86,7 +86,7 @@ bool C4ValueToMatrix(const C4ValueArray& array, StdMeshMatrix* matrix);
#define PSF_Hit "~Hit"
#define PSF_Hit2 "~Hit2"
#define PSF_Hit3 "~Hit3"
#define PSF_Grab "~Grab"
#define PSF_Grab "~Grab" // pObject, fGrab
#define PSF_Grabbed "~Grabbed"
#define PSF_Get "~Get"
#define PSF_Put "~Put"