|
65 | 65 | throw ::MSU.Exception.InvalidValue(_tile); |
66 | 66 | } |
67 | 67 |
|
| 68 | + if (_distance == 1) |
| 69 | + { |
| 70 | + local ret = this.getAdjacentActors(_tile); |
| 71 | + if (!_atDistance && _tile.IsOccupiedByActor) |
| 72 | + ret.push(_tile.getEntity()); |
| 73 | + return ret.filter(@(_, _a) _a.isAlliedWith(_faction)); |
| 74 | + } |
| 75 | + |
68 | 76 | return this.getActorsByFunction(function(_actor) { |
69 | 77 | if (!_actor.isAlliedWith(_faction)) return false; |
70 | 78 | if (_tile != null) |
|
85 | 93 | throw ::MSU.Exception.InvalidValue(_tile); |
86 | 94 | } |
87 | 95 |
|
| 96 | + if (_distance == 1) |
| 97 | + { |
| 98 | + local ret = this.getAdjacentActors(_tile); |
| 99 | + if (!_atDistance && _tile.IsOccupiedByActor) |
| 100 | + ret.push(_tile.getEntity()); |
| 101 | + return ret.filter(@(_, _a) !_a.isAlliedWith(_faction)); |
| 102 | + } |
| 103 | + |
88 | 104 | return this.getActorsByFunction(function(_actor) { |
89 | 105 | if (_actor.isAlliedWith(_faction)) return false; |
90 | 106 | if (_tile != null) |
|
108 | 124 | ::logError("The ID of _tile is 0 which means that the actor this tile was fetched from is not placed on map."); |
109 | 125 | throw ::MSU.Exception.InvalidValue(_tile); |
110 | 126 | } |
| 127 | + |
| 128 | + if (_distance == 1) |
| 129 | + { |
| 130 | + local ret = this.getAdjacentActors(_tile); |
| 131 | + if (!_atDistance && _tile.IsOccupiedByActor) |
| 132 | + ret.push(_tile.getEntity()); |
| 133 | + return ret.filter(@(_, _a) _a.getFaction() == _faction); |
| 134 | + } |
111 | 135 |
|
112 | 136 | local actors = this.getInstancesOfFaction(_faction); |
113 | 137 | local ret = []; |
|
129 | 153 | throw ::MSU.Exception.InvalidValue(_tile); |
130 | 154 | } |
131 | 155 |
|
| 156 | + if (_distance == 1) |
| 157 | + { |
| 158 | + local ret = this.getAdjacentActors(_tile); |
| 159 | + if (!_atDistance && _tile.IsOccupiedByActor) |
| 160 | + ret.push(_tile.getEntity()); |
| 161 | + return ret.filter(@(_, _a) _a.isAlliedWith(_faction) && _a.getFaction() != _faction); |
| 162 | + } |
| 163 | + |
132 | 164 | return this.getActorsByFunction(function(_actor) { |
133 | 165 | if (!_actor.isAlliedWith(_faction) || _actor.getFaction() == _faction) return false; |
134 | 166 | if (_tile != null) |
|
0 commit comments