Description:
Do not allow placing towers on contracted tiles.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r599:28969d45fa73 -

@@ -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 foreach (ref readonly var message in ReadMessages<AdjustSelection>()) {
235 foreach (ref readonly var message in ReadMessages<AdjustSelection>()) {
223 foreach (ref readonly var entity in ReadEntities<SelectedComponent>()) {
236 foreach (ref readonly var entity in ReadEntities<SelectedComponent>()) {
224 var selection = GetComponent<SelectedComponent>(entity);
237 var selection = GetComponent<SelectedComponent>(entity);
@@ -231,13 +244,17
231 else if(message.Type == AdjustmentType.Complete) {
244 else if(message.Type == AdjustmentType.Complete) {
232 var point = GetComponent<PointComponent>(entity);
245 var point = GetComponent<PointComponent>(entity);
233 var structure_entity = CreateEntity();
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,
251 AddComponent(structure_entity, new PointComponent {Square = point.Square,
236 Tool = point.Tool} );
252 Tool = point.Tool} );
237 AddComponent(structure_entity,
253 AddComponent(structure_entity,
238 new StructureComponent { Structure = Structure.Tower});
254 new StructureComponent { Structure = Structure.Tower});
239 Destroy(entity);
255 Destroy(entity);
240 Logging.Success("Placed Tower!");
256 Logging.Success("Placed Tower!");
257 }
241
258
242 }
259 }
243 else {
260 else {
You need to be logged in to leave comments. Login now