Chameleon controller implant (Clothing fast switch) (#33887)
* Add the chameleon controller implant * address the issues (Git please dont kill me) * Address the review and fix some merge conflicts! * Cleanup * Add use delay * Silly mistakes * Making a PR at 2 am: Gone wrong * Predict use delay and disable the buttons until you can choose another * First phase custom clothing * Better system, now relays to agent id and mindshield. Chameleon loadouts are a lot better to work with as well * Address the review! No more evil goto * Slams way is better I should have read more closely xD * Some of the jobs * Add to Cargo, CentComm, Service, Passenger, Ninja, Cluwne, Wizard + Minor changes to existing; Add chameleon to bandanas, medals, jugsuits and HUDs * Add everything else * Fix test * Job name * This looks better * Add department organization * Minor cleanup * Added some mindshields * Remove redudent comment and change funcion name to be clearer * Fix cluwne outfit * fix merge conflicts --------- Co-authored-by: SlamBamActionman <slambamactionman@gmail.com>
This commit is contained in:
@@ -9,6 +9,11 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Content.Shared.Roles;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Server.Clothing.Systems;
|
||||
using Content.Server.Implants;
|
||||
using Content.Shared.Implants;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.PDA;
|
||||
|
||||
namespace Content.Server.Access.Systems
|
||||
{
|
||||
@@ -18,6 +23,8 @@ namespace Content.Server.Access.Systems
|
||||
[Dependency] private readonly IdCardSystem _cardSystem = default!;
|
||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly ChameleonClothingSystem _chameleon = default!;
|
||||
[Dependency] private readonly ChameleonControllerSystem _chamController = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -28,6 +35,46 @@ namespace Content.Server.Access.Systems
|
||||
SubscribeLocalEvent<AgentIDCardComponent, AgentIDCardNameChangedMessage>(OnNameChanged);
|
||||
SubscribeLocalEvent<AgentIDCardComponent, AgentIDCardJobChangedMessage>(OnJobChanged);
|
||||
SubscribeLocalEvent<AgentIDCardComponent, AgentIDCardJobIconChangedMessage>(OnJobIconChanged);
|
||||
SubscribeLocalEvent<AgentIDCardComponent, InventoryRelayedEvent<ChameleonControllerOutfitSelectedEvent>>(OnChameleonControllerOutfitChangedItem);
|
||||
}
|
||||
|
||||
private void OnChameleonControllerOutfitChangedItem(Entity<AgentIDCardComponent> ent, ref InventoryRelayedEvent<ChameleonControllerOutfitSelectedEvent> args)
|
||||
{
|
||||
if (!TryComp<IdCardComponent>(ent, out var idCardComp))
|
||||
return;
|
||||
|
||||
_prototypeManager.TryIndex(args.Args.ChameleonOutfit.Job, out var jobProto);
|
||||
|
||||
var jobIcon = args.Args.ChameleonOutfit.Icon ?? jobProto?.Icon;
|
||||
var jobName = args.Args.ChameleonOutfit.Name ?? jobProto?.Name ?? "";
|
||||
|
||||
if (jobIcon != null)
|
||||
_cardSystem.TryChangeJobIcon(ent, _prototypeManager.Index(jobIcon.Value), idCardComp);
|
||||
|
||||
if (jobName != "")
|
||||
_cardSystem.TryChangeJobTitle(ent, Loc.GetString(jobName), idCardComp);
|
||||
|
||||
// If you have forced departments use those over the jobs actual departments.
|
||||
if (args.Args.ChameleonOutfit?.Departments?.Count > 0)
|
||||
_cardSystem.TryChangeJobDepartment(ent, args.Args.ChameleonOutfit.Departments, idCardComp);
|
||||
else if (jobProto != null)
|
||||
_cardSystem.TryChangeJobDepartment(ent, jobProto, idCardComp);
|
||||
|
||||
// Ensure that you chameleon IDs in PDAs correctly. Yes this is sus...
|
||||
|
||||
// There is one weird interaction: If the job / icon don't match the PDAs job the chameleon will be updated
|
||||
// to the PDAs IDs sprite but the icon and job title will not match. There isn't a way to get around this
|
||||
// really as there is no tie between job -> pda or pda -> job.
|
||||
|
||||
var idSlotGear = _chamController.GetGearForSlot(args, "id");
|
||||
if (idSlotGear == null)
|
||||
return;
|
||||
|
||||
var proto = _prototypeManager.Index(idSlotGear);
|
||||
if (!proto.TryGetComponent<PdaComponent>(out var comp, EntityManager.ComponentFactory))
|
||||
return;
|
||||
|
||||
_chameleon.SetSelectedPrototype(ent, comp.IdCard);
|
||||
}
|
||||
|
||||
private void OnAfterInteract(EntityUid uid, AgentIDCardComponent component, AfterInteractEvent args)
|
||||
|
||||
Reference in New Issue
Block a user