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