Engineering lockers. (#210)

* Import Eris engineering locker sprites.

* Allow customizing ClientStorageComponent open/close states better.

* EntityStorage does not blow up if Storage is also defined in prototype.

* Engineering styled lockers.
This commit is contained in:
Pieter-Jan Briers
2019-04-26 23:44:26 +02:00
committed by GitHub
parent fe0414eda7
commit 6e5680b3c2
10 changed files with 135 additions and 6 deletions

View File

@@ -11,6 +11,8 @@ using Robust.Shared.Utility;
using System;
using System.Collections.Generic;
using Robust.Client.Interfaces.Graphics;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Client.GameObjects.Components.Storage
{
@@ -24,6 +26,9 @@ namespace Content.Client.GameObjects.Components.Storage
private int StorageCapacityMax;
private StorageWindow Window;
[ViewVariables] private string _closedState;
[ViewVariables] private string _openState;
public bool Open
{
get => _open;
@@ -48,6 +53,14 @@ namespace Content.Client.GameObjects.Components.Storage
base.OnRemove();
}
public override void ExposeData(ObjectSerializer serializer)
{
base.ExposeData(serializer);
serializer.DataField(ref _closedState, "state_door_closed", null);
serializer.DataField(ref _openState, "state_door_open", null);
}
/// <inheritdoc />
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
{
@@ -127,7 +140,7 @@ namespace Content.Client.GameObjects.Components.Storage
var baseName = spriteComp.LayerGetState(0).Name;
var stateId = open ? $"{baseName}_open" : $"{baseName}_door";
var stateId = open ? _openState ?? $"{baseName}_open" : _closedState ?? $"{baseName}_door";
if (spriteComp.BaseRSI.TryGetState(stateId, out _))
spriteComp.LayerSetState(1, stateId);

View File

@@ -25,8 +25,13 @@ namespace Content.Server.GameObjects.Components
{
base.Initialize();
Contents = ContainerManagerComponent.Ensure<Container>($"{typeof(EntityStorageComponent).FullName}{Owner.Uid.ToString()}", Owner);
StorageComponent = Owner.AddComponent<ServerStorageComponent>();
StorageComponent.Initialize();
if (!Owner.TryGetComponent(out StorageComponent))
{
StorageComponent = Owner.AddComponent<ServerStorageComponent>();
// TODO: This is a terrible hack.
// Components should not need to be manually initialized in Initialize().
StorageComponent.Initialize();
}
entityQuery = new IntersectingEntityQuery(Owner);
}

View File

@@ -11,7 +11,7 @@
- type: Icon
sprite: Buildings/closet.rsi
state: generic
state: generic_door
- type: Clickable
- type: BoundingBox
@@ -23,8 +23,83 @@
mass: 25
Anchored: false
- type: EntityStorage
- type: Storage
state_door_open: generic_open
state_door_closed: generic_door
- type: PlaceableSurface
placement:
snap:
- Wall
- Wall
- type: entity
id: locker_tool
name: Tool Locker
parent: locker_generic
components:
- type: Sprite
sprite: Buildings/closet.rsi
layers:
- state: eng
- state: eng_tool_door
- type: Storage
state_door_closed: eng_tool_door
state_door_open: eng_open
- type: Icon
state: eng_tool_door
- type: entity
id: locker_electrical_supplies
name: Electrical Supplies Locker
parent: locker_generic
components:
- type: Sprite
sprite: Buildings/closet.rsi
layers:
- state: eng
- state: eng_elec_door
- type: Storage
state_door_closed: eng_elec_door
state_door_open: eng_open
- type: Icon
state: eng_elec_door
- type: entity
id: locker_welding_supplies
name: Welding Supplies Locker
parent: locker_generic
components:
- type: Sprite
sprite: Buildings/closet.rsi
layers:
- state: eng
- state: eng_weld_door
- type: Storage
state_door_closed: eng_weld_door
state_door_open: eng_open
- type: Icon
state: eng_weld_door
- type: entity
id: locker_radiation_suit
name: Radiation Suit Locker
parent: locker_generic
components:
- type: Sprite
sprite: Buildings/closet.rsi
layers:
- state: eng
- state: eng_rad_door
- type: Storage
state_door_closed: eng_rad_door
state_door_open: eng_open
- type: Icon
state: eng_rad_door

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

View File

@@ -24,6 +24,42 @@
"select": [],
"flags": {},
"directions": 1
},
{
"name": "eng",
"select": [],
"flags": {},
"directions": 1
},
{
"name": "eng_open",
"select": [],
"flags": {},
"directions": 1
},
{
"name": "eng_tool_door",
"select": [],
"flags": {},
"directions": 1
},
{
"name": "eng_rad_door",
"select": [],
"flags": {},
"directions": 1
},
{
"name": "eng_elec_door",
"select": [],
"flags": {},
"directions": 1
},
{
"name": "eng_weld_door",
"select": [],
"flags": {},
"directions": 1
}
]
}
}