mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-18 22:33:56 -07:00
Set previous behaviour for SetFacePointAfterMove.
Implement get method in cmpUnitMotion. Use it in UnitAI. This was SVN commit r23850.
This commit is contained in:
parent
a9d1d16d5f
commit
eec47157ad
4 changed files with 24 additions and 4 deletions
|
|
@ -1370,10 +1370,11 @@ UnitAI.prototype.UnitFsmSpec = {
|
|||
// Don't use the logic from unitMotion, as SetInPosition
|
||||
// has already given us a custom rotation
|
||||
// (or we failed to move and thus don't care.)
|
||||
let facePointAfterMove = this.GetFacePointAfterMove();
|
||||
this.SetFacePointAfterMove(false);
|
||||
this.StopMoving();
|
||||
// Reset default behaviour (TODO: actually get the previuos behaviour).
|
||||
this.SetFacePointAfterMove(true);
|
||||
// Reset previous behaviour.
|
||||
this.SetFacePointAfterMove(facePointAfterMove);
|
||||
},
|
||||
|
||||
// Occurs when the unit has reached its destination and the controller
|
||||
|
|
@ -6335,6 +6336,12 @@ UnitAI.prototype.SetFacePointAfterMove = function(val)
|
|||
cmpMotion.SetFacePointAfterMove(val);
|
||||
};
|
||||
|
||||
UnitAI.prototype.GetFacePointAfterMove = function()
|
||||
{
|
||||
let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion);
|
||||
return cmpUnitMotion && cmpUnitMotion.GetFacePointAfterMove();
|
||||
}
|
||||
|
||||
UnitAI.prototype.AttackEntitiesByPreference = function(ents)
|
||||
{
|
||||
if (!ents.length)
|
||||
|
|
|
|||
|
|
@ -414,6 +414,11 @@ public:
|
|||
m_FacePointAfterMove = facePointAfterMove;
|
||||
}
|
||||
|
||||
virtual bool GetFacePointAfterMove() const
|
||||
{
|
||||
return m_FacePointAfterMove;
|
||||
}
|
||||
|
||||
virtual void SetDebugOverlay(bool enabled)
|
||||
{
|
||||
m_DebugOverlayEnabled = enabled;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2019 Wildfire Games.
|
||||
/* Copyright (C) 2020 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
|
|
@ -37,6 +37,7 @@ DEFINE_INTERFACE_METHOD_1("SetSpeedMultiplier", void, ICmpUnitMotion, SetSpeedMu
|
|||
DEFINE_INTERFACE_METHOD_CONST_0("GetPassabilityClassName", std::string, ICmpUnitMotion, GetPassabilityClassName)
|
||||
DEFINE_INTERFACE_METHOD_CONST_0("GetUnitClearance", entity_pos_t, ICmpUnitMotion, GetUnitClearance)
|
||||
DEFINE_INTERFACE_METHOD_1("SetFacePointAfterMove", void, ICmpUnitMotion, SetFacePointAfterMove, bool)
|
||||
DEFINE_INTERFACE_METHOD_CONST_0("GetFacePointAfterMove", bool, ICmpUnitMotion, GetFacePointAfterMove)
|
||||
DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpUnitMotion, SetDebugOverlay, bool)
|
||||
END_INTERFACE_WRAPPER(UnitMotion)
|
||||
|
||||
|
|
@ -110,6 +111,11 @@ public:
|
|||
m_Script.CallVoid("SetFacePointAfterMove", facePointAfterMove);
|
||||
}
|
||||
|
||||
virtual bool GetFacePointAfterMove() const
|
||||
{
|
||||
return m_Script.Call<bool>("GetFacePointAfterMove");
|
||||
}
|
||||
|
||||
virtual pass_class_t GetPassabilityClass() const
|
||||
{
|
||||
return m_Script.Call<pass_class_t>("GetPassabilityClass");
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 2019 Wildfire Games.
|
||||
/* Copyright (C) 2020 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
|
|
@ -112,6 +112,8 @@ public:
|
|||
*/
|
||||
virtual void SetFacePointAfterMove(bool facePointAfterMove) = 0;
|
||||
|
||||
virtual bool GetFacePointAfterMove() const = 0;
|
||||
|
||||
/**
|
||||
* Get the unit's passability class.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue