Removes LowWall. (#6063)

This commit is contained in:
Lamrr
2022-01-11 18:03:27 +11:00
committed by GitHub
parent db8c6e4bc8
commit 951bdabcd0
22 changed files with 0 additions and 334 deletions

View File

@@ -1,248 +0,0 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using Content.Client.IconSmoothing;
using Content.Client.Window;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.ViewVariables;
using static Robust.Client.GameObjects.SpriteComponent;
namespace Content.Client.Wall.Components
{
// TODO: Over layers should be placed ABOVE the window itself too.
// This is gonna require a client entity & parenting,
// so IsMapTransform being naive is gonna be a problem.
/// <summary>
/// Override of icon smoothing to handle the specific complexities of low walls.
/// </summary>
[RegisterComponent]
[ComponentReference(typeof(IconSmoothComponent))]
public class LowWallComponent : IconSmoothComponent
{
public override string Name => "LowWall";
[Dependency] private readonly IEntityManager _entMan = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
public CornerFill LastCornerNE { get; private set; }
public CornerFill LastCornerSE { get; private set; }
public CornerFill LastCornerSW { get; private set; }
public CornerFill LastCornerNW { get; private set; }
[ViewVariables] private EntityUid _overlayEntity;
[ViewVariables]
private ISpriteComponent? _overlaySprite;
protected override void Startup()
{
base.Startup();
_overlayEntity = _entMan.SpawnEntity("LowWallOverlay", _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
_entMan.GetComponent<TransformComponent>(_overlayEntity).AttachParent(Owner);
_entMan.GetComponent<TransformComponent>(_overlayEntity).LocalPosition = Vector2.Zero;
_overlaySprite = _entMan.GetComponent<ISpriteComponent>(_overlayEntity);
var overState0 = $"{StateBase}over_0";
_overlaySprite.LayerMapSet(OverCornerLayers.SE, _overlaySprite.AddLayerState(overState0));
_overlaySprite.LayerSetDirOffset(OverCornerLayers.SE, DirectionOffset.None);
_overlaySprite.LayerMapSet(OverCornerLayers.NE, _overlaySprite.AddLayerState(overState0));
_overlaySprite.LayerSetDirOffset(OverCornerLayers.NE, DirectionOffset.CounterClockwise);
_overlaySprite.LayerMapSet(OverCornerLayers.NW, _overlaySprite.AddLayerState(overState0));
_overlaySprite.LayerSetDirOffset(OverCornerLayers.NW, DirectionOffset.Flip);
_overlaySprite.LayerMapSet(OverCornerLayers.SW, _overlaySprite.AddLayerState(overState0));
_overlaySprite.LayerSetDirOffset(OverCornerLayers.SW, DirectionOffset.Clockwise);
}
protected override void Shutdown()
{
base.Shutdown();
// _overlayEntity is non-nullable as it is set on startup.
// Should also never be default but might as well check.
if (_overlayEntity.Valid)
{
_entMan.DeleteEntity(_overlayEntity);
}
}
internal override void CalculateNewSprite()
{
base.CalculateNewSprite();
if (Sprite == null || !_entMan.GetComponent<TransformComponent>(Owner).Anchored || _overlaySprite == null)
{
return;
}
var grid = _mapManager.GetGrid(_entMan.GetComponent<TransformComponent>(Owner).GridID);
var coords = _entMan.GetComponent<TransformComponent>(Owner).Coordinates;
var (n, nl) = MatchingWall(grid.GetInDir(coords, Direction.North));
var (ne, nel) = MatchingWall(grid.GetInDir(coords, Direction.NorthEast));
var (e, el) = MatchingWall(grid.GetInDir(coords, Direction.East));
var (se, sel) = MatchingWall(grid.GetInDir(coords, Direction.SouthEast));
var (s, sl) = MatchingWall(grid.GetInDir(coords, Direction.South));
var (sw, swl) = MatchingWall(grid.GetInDir(coords, Direction.SouthWest));
var (w, wl) = MatchingWall(grid.GetInDir(coords, Direction.West));
var (nw, nwl) = MatchingWall(grid.GetInDir(coords, Direction.NorthWest));
// ReSharper disable InconsistentNaming
var cornerNE = CornerFill.None;
var cornerSE = CornerFill.None;
var cornerSW = CornerFill.None;
var cornerNW = CornerFill.None;
var lowCornerNE = CornerFill.None;
var lowCornerSE = CornerFill.None;
var lowCornerSW = CornerFill.None;
var lowCornerNW = CornerFill.None;
// ReSharper restore InconsistentNaming
if (n)
{
cornerNE |= CornerFill.CounterClockwise;
cornerNW |= CornerFill.Clockwise;
if (!nl && !e && !w)
{
lowCornerNE |= CornerFill.CounterClockwise;
lowCornerNW |= CornerFill.Clockwise;
}
}
if (ne)
{
cornerNE |= CornerFill.Diagonal;
if (!nel && (nl || el || n && e))
{
lowCornerNE |= CornerFill.Diagonal;
}
}
if (e)
{
cornerNE |= CornerFill.Clockwise;
cornerSE |= CornerFill.CounterClockwise;
if (!el)
{
lowCornerNE |= CornerFill.Clockwise;
lowCornerSE |= CornerFill.CounterClockwise;
}
}
if (se)
{
cornerSE |= CornerFill.Diagonal;
if (!sel && (sl || el || s && e))
{
lowCornerSE |= CornerFill.Diagonal;
}
}
if (s)
{
cornerSE |= CornerFill.Clockwise;
cornerSW |= CornerFill.CounterClockwise;
if (!sl)
{
lowCornerSE |= CornerFill.Clockwise;
lowCornerSW |= CornerFill.CounterClockwise;
}
}
if (sw)
{
cornerSW |= CornerFill.Diagonal;
if (!swl && (sl || wl || s && w))
{
lowCornerSW |= CornerFill.Diagonal;
}
}
if (w)
{
cornerSW |= CornerFill.Clockwise;
cornerNW |= CornerFill.CounterClockwise;
if (!wl)
{
lowCornerSW |= CornerFill.Clockwise;
lowCornerNW |= CornerFill.CounterClockwise;
}
}
if (nw)
{
cornerNW |= CornerFill.Diagonal;
if (!nwl && (nl || wl || n && w))
{
lowCornerNW |= CornerFill.Diagonal;
}
}
Sprite.LayerSetState(CornerLayers.NE, $"{StateBase}{(int) cornerNE}");
Sprite.LayerSetState(CornerLayers.SE, $"{StateBase}{(int) cornerSE}");
Sprite.LayerSetState(CornerLayers.SW, $"{StateBase}{(int) cornerSW}");
Sprite.LayerSetState(CornerLayers.NW, $"{StateBase}{(int) cornerNW}");
_overlaySprite.LayerSetState(OverCornerLayers.NE, $"{StateBase}over_{(int) lowCornerNE}");
_overlaySprite.LayerSetState(OverCornerLayers.SE, $"{StateBase}over_{(int) lowCornerSE}");
_overlaySprite.LayerSetState(OverCornerLayers.SW, $"{StateBase}over_{(int) lowCornerSW}");
_overlaySprite.LayerSetState(OverCornerLayers.NW, $"{StateBase}over_{(int) lowCornerNW}");
LastCornerNE = cornerNE;
LastCornerSE = cornerSE;
LastCornerSW = cornerSW;
LastCornerNW = cornerNW;
foreach (var entity in grid.GetLocal(coords))
{
if (_entMan.TryGetComponent(entity, out WindowComponent? window))
{
//window.UpdateSprite();
}
}
}
[Pure]
private (bool connected, bool lowWall) MatchingWall(IEnumerable<EntityUid> candidates)
{
foreach (var entity in candidates)
{
if (!_entMan.TryGetComponent(entity, out IconSmoothComponent? other))
{
continue;
}
if (other.SmoothKey == SmoothKey)
{
return (true, other is LowWallComponent);
}
}
return (false, false);
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
private enum OverCornerLayers : byte
{
SE,
NE,
NW,
SW,
}
}
}

View File

@@ -6,7 +6,6 @@ namespace Content.Server.Entry
public static string[] List => new [] {
"ConstructionGhost",
"IconSmooth",
"LowWall",
"ReinforcedWall",
"InteractionOutline",
"MeleeWeaponArcAnimation",

View File

@@ -1,51 +0,0 @@
- type: entity
id: LowWall
parent: BaseStructure
name: low wall
description: Goes up to about your waist.
components:
- type: Tag
tags:
- RCDDeconstructWhitelist
- type: CanBuildWindowOnTop
- type: Sprite
netsync: false
color: "#889192"
drawdepth: Walls
sprite: Structures/Walls/low_wall.rsi
- type: Icon
sprite: Structures/Walls/low_wall.rsi
state: metal
- type: Damageable
damageContainer: Inorganic
damageModifierSet: Metallic
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 100
behaviors:
- !type:ChangeConstructionNodeBehavior
node: start
- !type:DoActsBehavior
acts: ["Destruction"]
- type: Climbable
- type: LowWall
key: walls
base: metal_
- type: Construction
graph: lowWall
node: lowWall
- type: entity
id: LowWallOverlay
name: low wall overlay
abstract: true
components:
- type: Tag
tags:
- HideContextMenu
- type: Sprite
color: "#889192"
drawdepth: WallMountedItems
sprite: Structures/Walls/low_wall.rsi

View File

@@ -1,33 +0,0 @@
- type: constructionGraph
id: lowWall
start: start
graph:
- node: start
actions:
- !type:SpawnPrototype
prototype: SheetSteel1
amount: 3
- !type:DeleteEntity { }
edges:
- to: lowWall
conditions:
- !type:ComponentInTile
value: false
component: Window
steps:
- material: Steel
amount: 3
doAfter: 5
- node: lowWall
entity: LowWall
edges:
- to: start
conditions:
# We fail the condition if there are any windows on the tile.
- !type:ComponentInTile
hasEntity: false
component: Window
steps:
- tool: Welding
doAfter: 5

View File

@@ -1 +0,0 @@
{"version": 1, "size": {"x": 32, "y": 32}, "license": "CC-BY-SA-3.0", "copyright": "Taken from https://github.com/discordia-space/CEV-Eris/blob/b503939d31b23c025ddb936b75e0a265d85154c5/icons/obj/structures/low_wall.dmi", "states": [{"name": "metal", "delays": [[1.0]]}, {"name": "metal_0", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_1", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_2", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_3", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_4", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_5", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_6", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_7", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_over_0", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_over_1", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_over_2", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_over_3", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_over_4", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_over_5", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_over_6", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "metal_over_7", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}]}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 B