added friendly and neutral peg, added disposition
This commit is contained in:
@@ -7,13 +7,13 @@ public partial class Peg : HoverableNode
|
||||
{
|
||||
[Signal]
|
||||
public delegate void DeathEventHandler(Peg THIS);
|
||||
public int _id, _health = 2, _healthMax = 2, _stamina, _staminaRemaining, _visibility = 4, _movement = 0;
|
||||
public int _id, _health = 2, _healthMax = 2, _stamina, _staminaRemaining, _visibility = 4, _movement = 0, _disposition;
|
||||
public Dictionary<string, int> _priorities = new()
|
||||
{
|
||||
{"act", 1000000}, // 1000000 to 1999999 reserved for action priorities
|
||||
{"movement", 0} // 0 to 999999 reserved for movement priorities
|
||||
};
|
||||
public Vector2I _address = -Vector2I.One, _range = Vector2I.Up;
|
||||
public Vector2I _address;
|
||||
public List<Vector2I> _path = new();
|
||||
public PegController _pegController;
|
||||
public List<PegAction> _actions;
|
||||
@@ -28,7 +28,7 @@ public partial class Peg : HoverableNode
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
ReprioritizeActions();
|
||||
_actions = [.. GetNode<Node2D>("Actions").GetChildren().Cast<PegAction>()];
|
||||
}
|
||||
public virtual bool Act(int SUB_STEP)
|
||||
{
|
||||
@@ -43,11 +43,10 @@ public partial class Peg : HoverableNode
|
||||
}
|
||||
if (action == null)
|
||||
{
|
||||
GD.Print("NO ACTION");
|
||||
return false;
|
||||
}
|
||||
Tween subtween = action.CreateAnimation(this);
|
||||
int key = action._priority + SUB_STEP;
|
||||
string key = action._priority + ":" + SUB_STEP ;
|
||||
if (!_pegController._tweenStages.ContainsKey(key))
|
||||
{
|
||||
_pegController._tweenStages[key] = new();
|
||||
@@ -83,7 +82,7 @@ public partial class Peg : HoverableNode
|
||||
public virtual List<Vector2I> GetGoals()
|
||||
{
|
||||
Map map = _pegController._playArea._map;
|
||||
return [.. map._cells.Where(c => c.Y == map._firstOpenRow).Where(c => !map._astar.IsPointSolid(c))];
|
||||
return [.. map._cells.Where(c => c.Y == (_disposition == 1 ? map._lastOpenRow : map._firstOpenRow)).Where(c => !map._astar.IsPointSolid(c))];
|
||||
}
|
||||
|
||||
public Vector2 GetPositionFromAddress()
|
||||
@@ -91,11 +90,6 @@ public partial class Peg : HoverableNode
|
||||
return _pegController._playArea._map.GetCellPositionFromAddress(_address);
|
||||
}
|
||||
|
||||
public void ReprioritizeActions()
|
||||
{
|
||||
_actions = [.. GetNode<Node>("Actions").GetChildren().Cast<PegAction>()];
|
||||
}
|
||||
|
||||
public virtual void StartTurn()
|
||||
{
|
||||
_staminaRemaining = _stamina;
|
||||
|
||||
Reference in New Issue
Block a user