sync: restore source from Google Drive
Sync changed files to Google Drive / sync (push) Successful in 1h45m13s
Sync changed files to Google Drive / sync (push) Successful in 1h45m13s
This commit is contained in:
1 parent
e2d8247e91
commit
7063d1b1c9
993 files changed
+949976
No files matched your search
@@ -0,0 +1,68 @@
|
||||
unit KM_UnitTaskGoHome;
|
||||
{$I KaM_Remake.inc}
|
||||
interface
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
KM_Defaults, KM_Units;
|
||||
|
||||
|
||||
type
|
||||
TKMTaskGoHome = class(TKMUnitTask)
|
||||
public
|
||||
constructor Create(aUnit: TKMUnit);
|
||||
|
||||
function Execute: TKMTaskResult; override;
|
||||
function CouldBeCancelled: Boolean; override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
{ TTaskGoHome }
|
||||
constructor TKMTaskGoHome.Create(aUnit: TKMUnit);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
fType := uttGoHome;
|
||||
aUnit.Thought := thHome;
|
||||
end;
|
||||
|
||||
|
||||
function TKMTaskGoHome.CouldBeCancelled: Boolean;
|
||||
begin
|
||||
Result := (fPhase - 1) //phase was increased at the end of execution
|
||||
<= 0; //Allow cancel task only at walking phases
|
||||
end;
|
||||
|
||||
|
||||
function TKMTaskGoHome.Execute: TKMTaskResult;
|
||||
begin
|
||||
Result := trTaskContinues;
|
||||
|
||||
if fUnit.Home.IsDestroyed then
|
||||
begin
|
||||
Result := trTaskDone;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
with fUnit do
|
||||
case fPhase of
|
||||
0: begin
|
||||
Thought := thHome;
|
||||
SetActionWalkToSpot(Home.PointBelowEntrance);
|
||||
end;
|
||||
1: SetActionGoIn(uaWalk, gdGoInside, Home);
|
||||
2: begin
|
||||
Thought := thNone; //Only stop thinking once we are right inside
|
||||
Home.SetState(hstIdle);
|
||||
SetActionStay(5, uaWalk);
|
||||
end;
|
||||
else Result := trTaskDone;
|
||||
end;
|
||||
|
||||
Inc(fPhase);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
Reference in new issue
Block a user