Description:
Do not allow placing towers on contracted tiles.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -219,6 +219,19 | |||
|
219 | 219 | } |
|
220 | 220 | } |
|
221 | 221 | |
|
222 | foreach (var (entity, status) in ReadEntities<AreaComponent>() | |
|
223 | .WhereF((e) => HasComponent<ContractStatusComponent>(e)) | |
|
224 | .SelectWhereF((e) => (e, GetComponent<ContractStatusComponent>(e)), | |
|
225 | (e) => ((e.Item2.status != ContractStatus.Broken) | |
|
226 | && (e.Item2.status != ContractStatus.Rejected) | |
|
227 | && (e.Item2.status != ContractStatus.Expired) | |
|
228 | && (e.Item2.status != ContractStatus.Completed) | |
|
229 | && (e.Item2.status != ContractStatus.Proposed)) | |
|
230 | )) { | |
|
231 | var entitySquares = GetComponent<AreaComponent>(entity).squares; | |
|
232 | occupied.AddRange(entitySquares); | |
|
233 | } | |
|
234 | ||
|
222 | 235 | foreach (ref readonly var message in ReadMessages<AdjustSelection>()) { |
|
223 | 236 | foreach (ref readonly var entity in ReadEntities<SelectedComponent>()) { |
|
224 | 237 | var selection = GetComponent<SelectedComponent>(entity); |
@@ -231,13 +244,17 | |||
|
231 | 244 | else if(message.Type == AdjustmentType.Complete) { |
|
232 | 245 | var point = GetComponent<PointComponent>(entity); |
|
233 | 246 | var structure_entity = CreateEntity(); |
|
247 | //Verify square is free: | |
|
248 | // | |
|
249 | if (!occupied.Contains(point.Square)) { | |
|
234 | 250 | |
|
235 | AddComponent(structure_entity, new PointComponent {Square = point.Square, | |
|
236 | Tool = point.Tool} ); | |
|
237 | AddComponent(structure_entity, | |
|
238 | new StructureComponent { Structure = Structure.Tower}); | |
|
239 | Destroy(entity); | |
|
240 | Logging.Success("Placed Tower!"); | |
|
251 | AddComponent(structure_entity, new PointComponent {Square = point.Square, | |
|
252 | Tool = point.Tool} ); | |
|
253 | AddComponent(structure_entity, | |
|
254 | new StructureComponent { Structure = Structure.Tower}); | |
|
255 | Destroy(entity); | |
|
256 | Logging.Success("Placed Tower!"); | |
|
257 | } | |
|
241 | 258 | |
|
242 | 259 | } |
|
243 | 260 | else { |
You need to be logged in to leave comments.
Login now