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.Serialization;
using Robust.Shared.Utility;

View File

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

View File

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

View File

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