Fix BagOpenCloseVisualizer failing with null rsi and redundant sprite component in CigPackBase
This commit is contained in:
@@ -7,6 +7,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
using static Robust.Shared.Utility.SpriteSpecifier;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Storage
|
||||
{
|
||||
@@ -34,11 +35,12 @@ namespace Content.Client.GameObjects.Components.Storage
|
||||
{
|
||||
base.InitializeEntity(entity);
|
||||
|
||||
if (_openIcon != null && entity.TryGetComponent<SpriteComponent>(out var spriteComponent))
|
||||
if (_openIcon != null &&
|
||||
entity.TryGetComponent<SpriteComponent>(out var spriteComponent) &&
|
||||
spriteComponent.BaseRSI?.Path != null)
|
||||
{
|
||||
var rsiPath = spriteComponent.BaseRSI!.Path!;
|
||||
spriteComponent.LayerMapReserveBlank(OpenIcon);
|
||||
spriteComponent.LayerSetSprite(OpenIcon, new SpriteSpecifier.Rsi(rsiPath, _openIcon));
|
||||
spriteComponent.LayerSetSprite(OpenIcon, new Rsi(spriteComponent.BaseRSI.Path, _openIcon));
|
||||
spriteComponent.LayerSetVisible(OpenIcon, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
name: cigarette pack
|
||||
abstract: true
|
||||
components:
|
||||
- type: Sprite
|
||||
netsync: false
|
||||
state: closed
|
||||
- type: Storage
|
||||
capacity: 6
|
||||
- type: Item
|
||||
@@ -38,6 +35,7 @@
|
||||
description: "A label on the packaging reads, 'Wouldn't a slow death make a change?'"
|
||||
components:
|
||||
- type: Sprite
|
||||
netsync: false
|
||||
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/green.rsi
|
||||
layers:
|
||||
- state: closed
|
||||
@@ -52,6 +50,7 @@
|
||||
description: "The most popular brand of Space Cigarettes, sponsors of the Space Olympics."
|
||||
components:
|
||||
- type: Sprite
|
||||
netsync: false
|
||||
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/red.rsi
|
||||
layers:
|
||||
- state: closed
|
||||
@@ -66,6 +65,7 @@
|
||||
description: "For those who somehow want to obtain the record for the most amount of cancerous tumors."
|
||||
components:
|
||||
- type: Sprite
|
||||
netsync: false
|
||||
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/blue.rsi
|
||||
layers:
|
||||
- state: closed
|
||||
@@ -80,6 +80,7 @@
|
||||
description: "Nomads's extra strong, for when your life is more extra hard."
|
||||
components:
|
||||
- type: Sprite
|
||||
netsync: false
|
||||
sprite: Objects/Consumable/Smokeables/Cigarettes/Packs/black.rsi
|
||||
layers:
|
||||
- state: closed
|
||||
|
||||
Reference in New Issue
Block a user