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:
@@ -0,0 +1,78 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Content.Client.Implants;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using Content.Shared.Clothing;
|
||||
using Content.Shared.Implants;
|
||||
using Content.Shared.Preferences.Loadouts;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Chameleon;
|
||||
|
||||
/// <summary>
|
||||
/// Ensures all round <see cref="IsProbablyRoundStartJob">"round start jobs"</see> have an associated chameleon loadout.
|
||||
/// </summary>
|
||||
public sealed class ChameleonJobLoadoutTest : InteractionTest
|
||||
{
|
||||
private readonly List<ProtoId<JobPrototype>> JobBlacklist =
|
||||
[
|
||||
|
||||
];
|
||||
|
||||
[Test]
|
||||
public async Task CheckAllJobs()
|
||||
{
|
||||
var alljobs = ProtoMan.EnumeratePrototypes<JobPrototype>();
|
||||
|
||||
// Job -> number of references
|
||||
Dictionary<ProtoId<JobPrototype>, int> validJobs = new();
|
||||
|
||||
// Only add stuff that actually has clothing! We don't want stuff like AI or borgs.
|
||||
foreach (var job in alljobs)
|
||||
{
|
||||
if (!IsProbablyRoundStartJob(job) || JobBlacklist.Contains(job.ID))
|
||||
continue;
|
||||
|
||||
validJobs.Add(job.ID, 0);
|
||||
}
|
||||
|
||||
var chameleons = ProtoMan.EnumeratePrototypes<ChameleonOutfitPrototype>();
|
||||
|
||||
foreach (var chameleon in chameleons)
|
||||
{
|
||||
if (chameleon.Job == null || !validJobs.ContainsKey(chameleon.Job.Value))
|
||||
continue;
|
||||
|
||||
validJobs[chameleon.Job.Value] += 1;
|
||||
}
|
||||
|
||||
var errorMessage = new StringBuilder();
|
||||
errorMessage.AppendLine("The following job(s) have no chameleon prototype(s):");
|
||||
var invalid = false;
|
||||
|
||||
// All round start jobs have a chameleon loadout
|
||||
foreach (var job in validJobs)
|
||||
{
|
||||
if (job.Value != 0)
|
||||
continue;
|
||||
|
||||
errorMessage.AppendLine(job.Key + " has no chameleonOutfit prototype.");
|
||||
invalid = true;
|
||||
}
|
||||
|
||||
if (!invalid)
|
||||
return;
|
||||
|
||||
Assert.Fail(errorMessage.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Best guess at what a "round start" job is.
|
||||
/// </summary>
|
||||
private bool IsProbablyRoundStartJob(JobPrototype job)
|
||||
{
|
||||
return job.StartingGear != null && ProtoMan.HasIndex<RoleLoadoutPrototype>(LoadoutSystem.GetJobPrototype(job.ID));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user