* resolving conflicts?? * Controlled clothes changing + time stuff + EmpChangeIntensity * Single clothes change + EmpContinious + moved random pick logic into GetRandomValidPrototype * Changes from reviews Co-Authored-By: Nemanja <98561806+emogarbage404@users.noreply.github.com> * Update ChameleonClothingComponent.cs * repairing irreparable damage i failed, did i? * damaging repaired irreparable uh??? * 2025 FUN ALLOWED!!!! * Minor changes from reviews Co-Authored-By: beck-thompson <107373427+beck-thompson@users.noreply.github.com> * Fix merge conflicts * Fix that last bug * cleanup * Remove VV attr. * AutoPausedField on emp time change --------- Co-authored-by: Nemanja <98561806+emogarbage404@users.noreply.github.com> Co-authored-by: beck-thompson <107373427+beck-thompson@users.noreply.github.com> Co-authored-by: beck-thompson <beck314159@hotmail.com> Co-authored-by: EmoGarbage404 <retron404@gmail.com>
55 lines
1.9 KiB
C#
55 lines
1.9 KiB
C#
using System.Linq;
|
|
using Content.Client.PDA;
|
|
using Content.Shared.Clothing.Components;
|
|
using Content.Shared.Clothing.EntitySystems;
|
|
using Content.Shared.Inventory;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.Clothing.Systems;
|
|
|
|
// All valid items for chameleon are calculated on client startup and stored in dictionary.
|
|
public sealed class ChameleonClothingSystem : SharedChameleonClothingSystem
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<ChameleonClothingComponent, AfterAutoHandleStateEvent>(HandleState);
|
|
|
|
PrepareAllVariants();
|
|
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnProtoReloaded);
|
|
}
|
|
|
|
private void OnProtoReloaded(PrototypesReloadedEventArgs args)
|
|
{
|
|
if (args.WasModified<EntityPrototype>())
|
|
PrepareAllVariants();
|
|
}
|
|
|
|
private void HandleState(EntityUid uid, ChameleonClothingComponent component, ref AfterAutoHandleStateEvent args)
|
|
{
|
|
UpdateVisuals(uid, component);
|
|
}
|
|
|
|
protected override void UpdateSprite(EntityUid uid, EntityPrototype proto)
|
|
{
|
|
base.UpdateSprite(uid, proto);
|
|
if (TryComp(uid, out SpriteComponent? sprite)
|
|
&& proto.TryGetComponent(out SpriteComponent? otherSprite, Factory))
|
|
{
|
|
sprite.CopyFrom(otherSprite);
|
|
}
|
|
|
|
// Edgecase for PDAs to include visuals when UI is open
|
|
if (TryComp(uid, out PdaBorderColorComponent? borderColor)
|
|
&& proto.TryGetComponent(out PdaBorderColorComponent? otherBorderColor, Factory))
|
|
{
|
|
borderColor.BorderColor = otherBorderColor.BorderColor;
|
|
borderColor.AccentHColor = otherBorderColor.AccentHColor;
|
|
borderColor.AccentVColor = otherBorderColor.AccentVColor;
|
|
}
|
|
}
|
|
}
|