Add variables to CluwneComponent, allowing for admeme customizing. Also localized two strings. (#40466)
* Add variables to cluwne component, update to the new style, add unremovable option to setoutfit. * not nullable, shorthand * Add comments, address reviews * why, was i drunk? * Apply suggestions from code review --------- Co-authored-by: Jessica M <jessica@maybe.sh> Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -4,6 +4,7 @@ using Content.Shared.Access.Components;
|
||||
using Content.Shared.Clothing;
|
||||
using Content.Shared.Hands.Components;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Interaction.Components;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.PDA;
|
||||
using Content.Shared.Preferences;
|
||||
@@ -23,7 +24,7 @@ public sealed class OutfitSystem : EntitySystem
|
||||
[Dependency] private readonly InventorySystem _invSystem = default!;
|
||||
[Dependency] private readonly SharedStationSpawningSystem _spawningSystem = default!;
|
||||
|
||||
public bool SetOutfit(EntityUid target, string gear, Action<EntityUid, EntityUid>? onEquipped = null)
|
||||
public bool SetOutfit(EntityUid target, string gear, Action<EntityUid, EntityUid>? onEquipped = null, bool unremovable = false)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(target, out InventoryComponent? inventoryComponent))
|
||||
return false;
|
||||
@@ -60,6 +61,8 @@ public sealed class OutfitSystem : EntitySystem
|
||||
}
|
||||
|
||||
_invSystem.TryEquip(target, equipmentEntity, slot.Name, silent: true, force: true, inventory: inventoryComponent);
|
||||
if (unremovable)
|
||||
EnsureComp<UnremoveableComponent>(equipmentEntity);
|
||||
|
||||
onEquipped?.Invoke(target, equipmentEntity);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user