Fix girder not having correct physics layers, add TileNotBlocked construction condition

This commit is contained in:
Vera Aguilera Puerto
2020-12-16 18:18:27 +01:00
parent d614e282b4
commit 022e6d4401
5 changed files with 55 additions and 7 deletions

View File

@@ -0,0 +1,32 @@
using Content.Shared.Maps;
using JetBrains.Annotations;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
namespace Content.Shared.Construction.ConstructionConditions
{
[UsedImplicitly]
public class TileNotBlocked : IConstructionCondition
{
private bool _filterMobs = false;
private bool _failIfSpace = true;
public void ExposeData(ObjectSerializer serializer)
{
serializer.DataField(ref _filterMobs, "filterMobs", false);
serializer.DataField(ref _failIfSpace, "failIfSpace", true);
}
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
{
var tileRef = location.GetTileRef();
if (tileRef == null || tileRef.Value.IsSpace())
return !_failIfSpace;
return !tileRef.Value.IsBlockedTurf(_filterMobs);
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Robust.Shared.Utility; using Robust.Shared.Utility;

View File

@@ -6,6 +6,7 @@
- type: Clickable - type: Clickable
- type: InteractionOutline - type: InteractionOutline
- type: Anchorable - type: Anchorable
snap: true
- type: Construction - type: Construction
graph: girder graph: girder
node: girder node: girder
@@ -17,13 +18,9 @@
anchored: true anchored: true
shapes: shapes:
- !type:PhysShapeAabb - !type:PhysShapeAabb
mask:
- Impassable
- MobImpassable
- VaultImpassable
- SmallImpassable
layer: layer:
- Opaque - Opaque
- Impassable
- MobImpassable - MobImpassable
- VaultImpassable - VaultImpassable
- SmallImpassable - SmallImpassable

View File

@@ -12,6 +12,8 @@
icon: icon:
sprite: Constructible/Power/conveyor.rsi sprite: Constructible/Power/conveyor.rsi
state: conveyor_stopped_cw state: conveyor_stopped_cw
conditions:
- !type:TileNotBlocked {}
- type: construction - type: construction
name: two-way lever name: two-way lever
@@ -26,3 +28,5 @@
icon: icon:
sprite: Constructible/Power/conveyor.rsi sprite: Constructible/Power/conveyor.rsi
state: switch-off state: switch-off
conditions:
- !type:TileNotBlocked {}

View File

@@ -13,6 +13,8 @@
placementMode: SnapgridCenter placementMode: SnapgridCenter
canRotate: false canRotate: false
canBuildInImpassable: false canBuildInImpassable: false
conditions:
- !type:TileNotBlocked { }
- type: construction - type: construction
name: wall name: wall
@@ -29,6 +31,8 @@
placementMode: SnapgridCenter placementMode: SnapgridCenter
canRotate: false canRotate: false
canBuildInImpassable: false canBuildInImpassable: false
conditions:
- !type:TileNotBlocked {}
- type: construction - type: construction
name: reinforced wall name: reinforced wall
@@ -45,6 +49,8 @@
placementMode: SnapgridCenter placementMode: SnapgridCenter
canRotate: false canRotate: false
canBuildInImpassable: false canBuildInImpassable: false
conditions:
- !type:TileNotBlocked {}
- type: construction - type: construction
name: low wall name: low wall
@@ -56,6 +62,7 @@
description: A low wall used for mounting windows. description: A low wall used for mounting windows.
conditions: conditions:
- !type:NoWindowsInTile {} - !type:NoWindowsInTile {}
- !type:TileNotBlocked {}
icon: icon:
sprite: Constructible/Structures/Walls/low_wall.rsi sprite: Constructible/Structures/Walls/low_wall.rsi
state: metal state: metal
@@ -131,6 +138,8 @@
objectType: Structure objectType: Structure
placementMode: SnapgridCenter placementMode: SnapgridCenter
canBuildInImpassable: false canBuildInImpassable: false
conditions:
- !type:TileNotBlocked {}
- type: construction - type: construction
name: Table Frame name: Table Frame
@@ -146,6 +155,8 @@
objectType: Structure objectType: Structure
placementMode: SnapgridCenter placementMode: SnapgridCenter
canBuildInImpassable: false canBuildInImpassable: false
conditions:
- !type:TileNotBlocked {}
- type: construction - type: construction
name: Poker Table name: Poker Table
@@ -161,6 +172,8 @@
objectType: Structure objectType: Structure
placementMode: SnapgridCenter placementMode: SnapgridCenter
canBuildInImpassable: false canBuildInImpassable: false
conditions:
- !type:TileNotBlocked {}
- type: construction - type: construction
name: Catwalk name: Catwalk
@@ -171,6 +184,7 @@
category: Structures category: Structures
description: Just like a lattice. Except it looks better. description: Just like a lattice. Except it looks better.
conditions: conditions:
- !type:TileNotBlocked {}
- !type:TileType - !type:TileType
targets: targets:
- lattice - lattice