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:
committed by
GitHub
parent
fe0414eda7
commit
6e5680b3c2
@@ -11,6 +11,8 @@ using Robust.Shared.Utility;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Robust.Client.Interfaces.Graphics;
|
using Robust.Client.Interfaces.Graphics;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Storage
|
namespace Content.Client.GameObjects.Components.Storage
|
||||||
{
|
{
|
||||||
@@ -24,6 +26,9 @@ namespace Content.Client.GameObjects.Components.Storage
|
|||||||
private int StorageCapacityMax;
|
private int StorageCapacityMax;
|
||||||
private StorageWindow Window;
|
private StorageWindow Window;
|
||||||
|
|
||||||
|
[ViewVariables] private string _closedState;
|
||||||
|
[ViewVariables] private string _openState;
|
||||||
|
|
||||||
public bool Open
|
public bool Open
|
||||||
{
|
{
|
||||||
get => _open;
|
get => _open;
|
||||||
@@ -48,6 +53,14 @@ namespace Content.Client.GameObjects.Components.Storage
|
|||||||
base.OnRemove();
|
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 />
|
/// <inheritdoc />
|
||||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
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 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 _))
|
if (spriteComp.BaseRSI.TryGetState(stateId, out _))
|
||||||
spriteComp.LayerSetState(1, stateId);
|
spriteComp.LayerSetState(1, stateId);
|
||||||
|
|||||||
@@ -25,8 +25,13 @@ namespace Content.Server.GameObjects.Components
|
|||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
Contents = ContainerManagerComponent.Ensure<Container>($"{typeof(EntityStorageComponent).FullName}{Owner.Uid.ToString()}", Owner);
|
Contents = ContainerManagerComponent.Ensure<Container>($"{typeof(EntityStorageComponent).FullName}{Owner.Uid.ToString()}", Owner);
|
||||||
StorageComponent = Owner.AddComponent<ServerStorageComponent>();
|
if (!Owner.TryGetComponent(out StorageComponent))
|
||||||
StorageComponent.Initialize();
|
{
|
||||||
|
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);
|
entityQuery = new IntersectingEntityQuery(Owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
- type: Icon
|
- type: Icon
|
||||||
sprite: Buildings/closet.rsi
|
sprite: Buildings/closet.rsi
|
||||||
state: generic
|
state: generic_door
|
||||||
|
|
||||||
- type: Clickable
|
- type: Clickable
|
||||||
- type: BoundingBox
|
- type: BoundingBox
|
||||||
@@ -23,8 +23,83 @@
|
|||||||
mass: 25
|
mass: 25
|
||||||
Anchored: false
|
Anchored: false
|
||||||
- type: EntityStorage
|
- type: EntityStorage
|
||||||
|
- type: Storage
|
||||||
|
state_door_open: generic_open
|
||||||
|
state_door_closed: generic_door
|
||||||
- type: PlaceableSurface
|
- type: PlaceableSurface
|
||||||
|
|
||||||
placement:
|
placement:
|
||||||
snap:
|
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
|
||||||
|
|||||||
BIN
Resources/Textures/Buildings/closet.rsi/eng.png
Normal file
BIN
Resources/Textures/Buildings/closet.rsi/eng.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 178 B |
BIN
Resources/Textures/Buildings/closet.rsi/eng_elec_door.png
Normal file
BIN
Resources/Textures/Buildings/closet.rsi/eng_elec_door.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 203 B |
BIN
Resources/Textures/Buildings/closet.rsi/eng_open.png
Normal file
BIN
Resources/Textures/Buildings/closet.rsi/eng_open.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 158 B |
BIN
Resources/Textures/Buildings/closet.rsi/eng_rad_door.png
Normal file
BIN
Resources/Textures/Buildings/closet.rsi/eng_rad_door.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 215 B |
BIN
Resources/Textures/Buildings/closet.rsi/eng_tool_door.png
Normal file
BIN
Resources/Textures/Buildings/closet.rsi/eng_tool_door.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 208 B |
BIN
Resources/Textures/Buildings/closet.rsi/eng_weld_door.png
Normal file
BIN
Resources/Textures/Buildings/closet.rsi/eng_weld_door.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 205 B |
@@ -24,6 +24,42 @@
|
|||||||
"select": [],
|
"select": [],
|
||||||
"flags": {},
|
"flags": {},
|
||||||
"directions": 1
|
"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
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user