forked from Mirrors/openclonk
first try to enter pushed vehicle when entering objects
There was no possibility to enter vehicles into yet, so this would be my first attempt to solve this, we can evaluate this and improve if needed.install-platforms
parent
70a89ce4f8
commit
fd734330d6
|
@ -421,12 +421,14 @@ public func ObjectControl(int plr, int ctrl, int x, int y, int strength, bool re
|
|||
}
|
||||
|
||||
// A wrapper to SetCommand to catch special behaviour for some actions.
|
||||
public func ObjectCommand(string command, object target, int tx, int ty, object target2)
|
||||
public func ObjectCommand(string command, object target, int tx, int ty, object target2, /*any*/ data)
|
||||
{
|
||||
// special control for throw and jump
|
||||
// but only with controls, not with general commands
|
||||
if (command == "Throw") return this->~ControlThrow(target,tx,ty);
|
||||
else if (command == "Jump") return this->~ControlJump();
|
||||
if (command == "Throw")
|
||||
return this->~ControlThrow(target, tx, ty);
|
||||
else if (command == "Jump")
|
||||
return this->~ControlJump();
|
||||
// else standard command
|
||||
else
|
||||
{
|
||||
|
@ -434,9 +436,10 @@ public func ObjectCommand(string command, object target, int tx, int ty, object
|
|||
if (command == "Drop")
|
||||
{
|
||||
// Disable collection for a moment.
|
||||
if (target) this->OnDropped(target);
|
||||
if (target)
|
||||
this->OnDropped(target);
|
||||
}
|
||||
return SetCommand(command,target,tx,ty,target2);
|
||||
return SetCommand(command, target, tx, ty, target2, data);
|
||||
}
|
||||
// this function might be obsolete: a normal SetCommand does make a callback to
|
||||
// script before it is executed: ControlCommand(szCommand, pTarget, iTx, iTy)
|
||||
|
|
|
@ -485,15 +485,16 @@ func ExecuteInteraction(proplist action_info)
|
|||
else if (action_info.actiontype == ACTIONTYPE_STRUCTURE)
|
||||
{
|
||||
// inside? -> exit
|
||||
if(Contained() == action_info.interaction_object)
|
||||
if (Contained() == action_info.interaction_object)
|
||||
{
|
||||
ObjectCommand("Exit");
|
||||
return true;
|
||||
}
|
||||
// outside? -> enter
|
||||
else if(this->CanEnter())
|
||||
else if (this->CanEnter())
|
||||
{
|
||||
ObjectCommand("Enter", action_info.interaction_object);
|
||||
// First attempt to enter the pushed vehicle.
|
||||
ObjectCommand("Enter", action_info.interaction_object, nil, nil, nil, C4CMD_Enter_PushTarget);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -477,11 +477,12 @@ global func ComDir2XY(int comd)
|
|||
return [[0,0,1,1,1,0,-1,-1,-1][comd], [0,-1,-1,0,1,1,1,0,-1][comd]];
|
||||
}
|
||||
|
||||
global func ObjectCommand(string command, object target, int tx, int ty, object target2)
|
||||
global func ObjectCommand(string command, object target, int tx, int ty, object target2, /*any*/ data)
|
||||
{
|
||||
// this function exists to be overloadable by ClonkControl.c4d
|
||||
if(!this) return;
|
||||
this->SetCommand(command,target,tx,ty, target2);
|
||||
if (!this)
|
||||
return;
|
||||
this->SetCommand(command, target, tx, ty, target2, data);
|
||||
}
|
||||
|
||||
// Let go from scaling or hangling
|
||||
|
|
Loading…
Reference in New Issue