Fix drone hat offset (#6978)
This commit is contained in:
@@ -10,9 +10,7 @@ using Content.Shared.Item;
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.ResourceManagement;
|
using Robust.Client.ResourceManagement;
|
||||||
using Robust.Shared.GameObjects;
|
using static Robust.Client.GameObjects.SpriteComponent;
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Log;
|
|
||||||
using static Robust.Shared.GameObjects.SharedSpriteComponent;
|
using static Robust.Shared.GameObjects.SharedSpriteComponent;
|
||||||
|
|
||||||
namespace Content.Client.Clothing;
|
namespace Content.Client.Clothing;
|
||||||
@@ -204,6 +202,9 @@ public sealed class ClothingSystem : EntitySystem
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_inventorySystem.TryGetSlot(equipee, slot, out var slotDef, inventory))
|
||||||
|
return;
|
||||||
|
|
||||||
// Remove old layers. We could also just set them to invisible, but as items may add arbitrary layers, this
|
// Remove old layers. We could also just set them to invisible, but as items may add arbitrary layers, this
|
||||||
// may eventually bloat the player with lots of invisible layers.
|
// may eventually bloat the player with lots of invisible layers.
|
||||||
if (inventory.VisualLayerKeys.TryGetValue(slot, out var revealedLayers))
|
if (inventory.VisualLayerKeys.TryGetValue(slot, out var revealedLayers))
|
||||||
@@ -239,17 +240,20 @@ public sealed class ClothingSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
var index = sprite.LayerMapReserveBlank(key);
|
var index = sprite.LayerMapReserveBlank(key);
|
||||||
|
if (sprite[index] is not Layer layer)
|
||||||
|
return;
|
||||||
|
|
||||||
// In case no RSI is given, use the item's base RSI as a default. This cuts down on a lot of unnecessary yaml entries.
|
// In case no RSI is given, use the item's base RSI as a default. This cuts down on a lot of unnecessary yaml entries.
|
||||||
if (layerData.RsiPath == null
|
if (layerData.RsiPath == null
|
||||||
&& layerData.TexturePath == null
|
&& layerData.TexturePath == null
|
||||||
&& sprite[index].Rsi == null
|
&& layer.RSI == null
|
||||||
&& TryComp(equipment, out SpriteComponent? clothingSprite))
|
&& TryComp(equipment, out SpriteComponent? clothingSprite))
|
||||||
{
|
{
|
||||||
sprite.LayerSetRSI(index, clothingSprite.BaseRSI);
|
layer.SetRsi(clothingSprite.BaseRSI);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprite.LayerSetData(index, layerData);
|
sprite.LayerSetData(index, layerData);
|
||||||
|
layer.Offset += slotDef.Offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
RaiseLocalEvent(equipment, new EquipmentVisualsUpdatedEvent(equipee, slot, revealedLayers));
|
RaiseLocalEvent(equipment, new EquipmentVisualsUpdatedEvent(equipee, slot, revealedLayers));
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
using Robust.Shared.Analyzers;
|
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Content.Client.Hands
|
namespace Content.Client.Hands
|
||||||
{
|
{
|
||||||
@@ -10,6 +7,12 @@ namespace Content.Client.Hands
|
|||||||
[Friend(typeof(HandsSystem))]
|
[Friend(typeof(HandsSystem))]
|
||||||
public sealed class HandsComponent : SharedHandsComponent
|
public sealed class HandsComponent : SharedHandsComponent
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Whether or not to add in-hand sprites for held items. Some entities (e.g., drones) don't want these.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("showInHands")]
|
||||||
|
public bool ShowInHands = true;
|
||||||
|
|
||||||
public HandsGui? Gui { get; set; }
|
public HandsGui? Gui { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -203,6 +203,9 @@ namespace Content.Client.Hands
|
|||||||
if (uid == _playerManager.LocalPlayer?.ControlledEntity)
|
if (uid == _playerManager.LocalPlayer?.ControlledEntity)
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
|
|
||||||
|
if (!handComp.ShowInHands)
|
||||||
|
return;
|
||||||
|
|
||||||
// Remove old layers. We could also just set them to invisible, but as items may add arbitrary layers, this
|
// Remove old layers. We could also just set them to invisible, but as items may add arbitrary layers, this
|
||||||
// may eventually bloat the player with lots of layers.
|
// may eventually bloat the player with lots of layers.
|
||||||
if (handComp.RevealedLayers.TryGetValue(hand.Location, out var revealedLayers))
|
if (handComp.RevealedLayers.TryGetValue(hand.Location, out var revealedLayers))
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using static Robust.Shared.GameObjects.SharedSpriteComponent;
|
using static Robust.Shared.GameObjects.SharedSpriteComponent;
|
||||||
|
|
||||||
namespace Content.Shared.Clothing;
|
namespace Content.Shared.Clothing;
|
||||||
@@ -7,7 +5,7 @@ namespace Content.Shared.Clothing;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Raised directed at a piece of clothing to get the set of layers to show on the wearer's sprite
|
/// Raised directed at a piece of clothing to get the set of layers to show on the wearer's sprite
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class GetEquipmentVisualsEvent : EntityEventArgs
|
public sealed class GetEquipmentVisualsEvent : EntityEventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Entity that is wearing the item.
|
/// Entity that is wearing the item.
|
||||||
@@ -37,7 +35,7 @@ public class GetEquipmentVisualsEvent : EntityEventArgs
|
|||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Useful for systems/components that modify the visual layers that an item adds to a player. (e.g. RGB memes)
|
/// Useful for systems/components that modify the visual layers that an item adds to a player. (e.g. RGB memes)
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public class EquipmentVisualsUpdatedEvent : EntityEventArgs
|
public sealed class EquipmentVisualsUpdatedEvent : EntityEventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Entity that is wearing the item.
|
/// Entity that is wearing the item.
|
||||||
|
|||||||
@@ -34,6 +34,11 @@ public sealed class SlotDefinition
|
|||||||
[DataField("dependsOn")] public string? DependsOn { get; }
|
[DataField("dependsOn")] public string? DependsOn { get; }
|
||||||
|
|
||||||
[DataField("displayName", required: true)] public string DisplayName { get; } = string.Empty;
|
[DataField("displayName", required: true)] public string DisplayName { get; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Offset for the clothing sprites.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("offset")] public Vector2 Offset { get; } = Vector2.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SlotUIContainer
|
public enum SlotUIContainer
|
||||||
|
|||||||
@@ -575,7 +575,7 @@
|
|||||||
- type: SentienceTarget
|
- type: SentienceTarget
|
||||||
flavorKind: primate
|
flavorKind: primate
|
||||||
- type: Inventory
|
- type: Inventory
|
||||||
templateId: head
|
templateId: monkey
|
||||||
- type: Strippable
|
- type: Strippable
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
|
|||||||
@@ -52,6 +52,7 @@
|
|||||||
- type: Physics
|
- type: Physics
|
||||||
bodyType: KinematicController
|
bodyType: KinematicController
|
||||||
- type: Hands
|
- type: Hands
|
||||||
|
showInHands: false
|
||||||
- type: Body
|
- type: Body
|
||||||
template: DroneTemplate
|
template: DroneTemplate
|
||||||
preset: DronePreset
|
preset: DronePreset
|
||||||
@@ -77,7 +78,7 @@
|
|||||||
- type: NameIdentifier
|
- type: NameIdentifier
|
||||||
group: Drone
|
group: Drone
|
||||||
- type: Inventory
|
- type: Inventory
|
||||||
templateId: head
|
templateId: drone
|
||||||
- type: Strippable
|
- type: Strippable
|
||||||
- type: UserInterface
|
- type: UserInterface
|
||||||
interfaces:
|
interfaces:
|
||||||
@@ -105,8 +106,6 @@
|
|||||||
layers:
|
layers:
|
||||||
- state: shell
|
- state: shell
|
||||||
sprite: Mobs/Silicon/drone.rsi
|
sprite: Mobs/Silicon/drone.rsi
|
||||||
- map: [ "head" ]
|
|
||||||
offset: 0, -0.45
|
|
||||||
- type: MovementIgnoreGravity
|
- type: MovementIgnoreGravity
|
||||||
- type: Fixtures
|
- type: Fixtures
|
||||||
fixtures:
|
fixtures:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
- type: inventoryTemplate
|
- type: inventoryTemplate
|
||||||
id: head
|
id: drone
|
||||||
slots:
|
slots:
|
||||||
- name: head
|
- name: head
|
||||||
slotTexture: head
|
slotTexture: head
|
||||||
@@ -7,3 +7,4 @@
|
|||||||
uiContainer: BottomLeft
|
uiContainer: BottomLeft
|
||||||
uiWindowPos: 0,0
|
uiWindowPos: 0,0
|
||||||
displayName: Head
|
displayName: Head
|
||||||
|
offset: 0, -0.45
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
- type: inventoryTemplate
|
||||||
|
id: monkey
|
||||||
|
slots:
|
||||||
|
- name: head
|
||||||
|
slotTexture: head
|
||||||
|
slotFlags: HEAD
|
||||||
|
uiContainer: BottomLeft
|
||||||
|
uiWindowPos: 0,0
|
||||||
|
displayName: Head
|
||||||
Reference in New Issue
Block a user