# Conflicts: # .github/CODEOWNERS # .github/PULL_REQUEST_TEMPLATE.md # Content.Client/Changelog/ChangelogTab.xaml.cs # Content.Client/Chemistry/UI/ChemMasterWindow.xaml # Content.Client/Entry/EntryPoint.cs # Content.Client/GameTicking/Managers/ClientGameTicker.cs # Content.Client/Launcher/LauncherConnectingGui.xaml # Content.Client/Lobby/LobbyState.cs # Content.Client/Lobby/UI/LobbyGui.xaml # Content.Client/Paper/UI/PaperWindow.xaml.cs # Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml.cs # Content.Client/Stylesheets/StyleNano.cs # Content.Client/UserInterface/Screens/SeparatedChatGameScreen.xaml # Content.Client/UserInterface/Systems/Ghost/Widgets/GhostGui.xaml.cs # Content.Client/UserInterface/Systems/MenuBar/Widgets/GameTopMenuBar.xaml # Content.IntegrationTests/Tests/Destructible/DestructibleDamageGroupTest.cs # Content.IntegrationTests/Tests/PostMapInitTest.cs # Content.IntegrationTests/Tests/Power/StationPowerTests.cs # Content.Packaging/ServerPackaging.cs # Content.Server/Administration/Systems/AdminVerbSystem.Smites.cs # Content.Server/Administration/Systems/AdminVerbSystem.Tools.cs # Content.Server/Atmos/TileAtmosphere.cs # Content.Server/Bible/BibleSystem.cs # Content.Server/Chat/Systems/ChatSystem.cs # Content.Server/Content.Server.csproj # Content.Server/Discord/DiscordLink/DiscordLink.cs # Content.Server/GameTicking/GameTicker.LobbyBackground.cs # Content.Server/GameTicking/GameTicker.Spawning.cs # Content.Server/Ghost/GhostSystem.cs # Content.Server/Kitchen/Components/MicrowaveComponent.cs # Content.Server/Kitchen/EntitySystems/MicrowaveSystem.cs # Content.Server/Mech/Systems/MechSystem.cs # Content.Server/Medical/CrewMonitoring/CrewMonitoringConsoleSystem.cs # Content.Server/Medical/DefibrillatorSystem.cs # Content.Server/Medical/HealthAnalyzerSystem.cs # Content.Server/Radio/EntitySystems/HeadsetSystem.cs # Content.Server/Remotes/DoorRemoteSystem.cs # Content.Server/RoundEnd/RoundEndSystem.cs # Content.Server/Shuttles/Systems/DockingSystem.Shuttle.cs # Content.Server/Silicons/Borgs/BorgSystem.Transponder.cs # Content.Server/Tips/TipsSystem.cs # Content.Server/Traitor/Uplink/UplinkSystem.cs # Content.Server/Weapons/Ranged/Systems/GunSystem.cs # Content.Server/Zombies/ZombieSystem.Transform.cs # Content.Server/Zombies/ZombieSystem.cs # Content.Shared/Bed/BedSystem.cs # Content.Shared/Blocking/BlockingSystem.User.cs # Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs # Content.Shared/Chat/SharedSuicideSystem.cs # Content.Shared/Chemistry/Components/HyposprayComponent.cs # Content.Shared/Chemistry/EntitySystems/HypospraySystem.cs # Content.Shared/Chemistry/EntitySystems/ScoopableSolutionSystem.cs # Content.Shared/Chemistry/EntitySystems/SolutionTransferSystem.cs # Content.Shared/Chemistry/Events/HyposprayEvents.cs # Content.Shared/Content.Shared.csproj # Content.Shared/Damage/Systems/DamageableSystem.cs # Content.Shared/Friction/TileFrictionController.cs # Content.Shared/GameTicking/SharedGameTicker.cs # Content.Shared/Interaction/InteractHand.cs # Content.Shared/Lock/LockSystem.cs # Content.Shared/Medical/Healing/HealingSystem.cs # Content.Shared/Mobs/Systems/MobStateSystem.Subscribers.cs # Content.Shared/Nutrition/EntitySystems/HungerSystem.cs # Content.Shared/Silicons/StationAi/SharedStationAiSystem.Airlock.cs # Content.Shared/Throwing/ThrowingSystem.cs # Content.Shared/Trigger/Systems/TriggerOnHitscanSystem.cs # Content.Shared/Weapons/Hitscan/Systems/HitscanBasicDamageSystem.cs # Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs # Content.Shared/Weapons/Ranged/Components/BatteryWeaponFireModesComponent.cs # Content.Shared/Weapons/Ranged/Components/HitscanBatteryAmmoProviderComponent.cs # Content.Shared/Weapons/Ranged/Systems/BatteryWeaponFireModesSystem.cs # Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Ballistic.cs # Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Battery.cs # Content.Shared/Zombies/ZombieComponent.cs # Content.Shared/_Sunrise/Lobby/LobbyBackgroundPrototype.cs # README.md # Resources/Locale/en-US/_strings/borg/borg.ftl # Resources/Locale/en-US/_strings/chemistry/components/hypospray-component.ftl # Resources/Locale/en-US/_strings/chemistry/components/injector-component.ftl # Resources/Locale/en-US/_strings/commands/pauseatmos-command.ftl # Resources/Locale/en-US/_strings/commands/quick-inspect-command.ftl # Resources/Locale/en-US/_strings/commands/show-wallmounts-command.ftl # Resources/Locale/en-US/_strings/commands/substepatmos-command.ftl # Resources/Locale/en-US/_strings/fluids/components/equip-spray-component.ftl # Resources/Locale/en-US/_strings/game-ticking/game-presets/preset-revolutionary.ftl # Resources/Locale/en-US/_strings/job/job-names.ftl # Resources/Locale/en-US/_strings/lobby/lobby-state-background.ftl # Resources/Locale/en-US/_strings/reagents/meta/medicine.ftl # Resources/Locale/en-US/_strings/reagents/meta/physical-desc.ftl # Resources/Locale/en-US/_strings/silicons/borg-module.ftl # Resources/Locale/en-US/_strings/store/changeling-catalog.ftl # Resources/Locale/en-US/_strings/store/currency.ftl # Resources/Locale/en-US/_strings/store/store.ftl # Resources/Locale/en-US/_strings/store/uplink-catalog.ftl # Resources/Prototypes/Body/Organs/slime.yml # Resources/Prototypes/Catalog/Fills/Backpacks/backpack.yml # Resources/Prototypes/Catalog/Fills/Backpacks/duffelbag.yml # Resources/Prototypes/Catalog/Fills/Boxes/ammunition.yml # Resources/Prototypes/Catalog/Fills/Boxes/emergency.yml # Resources/Prototypes/Catalog/Fills/Crates/antag.yml # Resources/Prototypes/Catalog/Fills/Crates/armory.yml # Resources/Prototypes/Catalog/Fills/Crates/botany.yml # Resources/Prototypes/Catalog/Fills/Crates/fun.yml # Resources/Prototypes/Catalog/Fills/Crates/medical.yml # Resources/Prototypes/Catalog/Fills/Crates/salvage.yml # Resources/Prototypes/Catalog/Fills/Crates/security.yml # Resources/Prototypes/Catalog/Fills/Crates/service.yml # Resources/Prototypes/Catalog/Fills/Crates/syndicate.yml # Resources/Prototypes/Catalog/Fills/Items/belt.yml # Resources/Prototypes/Catalog/Fills/Items/briefcases.yml # Resources/Prototypes/Catalog/Fills/Items/firstaidkits.yml # Resources/Prototypes/Catalog/Fills/Items/toolboxes.yml # Resources/Prototypes/Catalog/Fills/Lockers/dressers.yml # Resources/Prototypes/Catalog/Fills/Lockers/heads.yml # Resources/Prototypes/Catalog/Fills/Lockers/security.yml # Resources/Prototypes/Catalog/VendingMachines/Inventories/theater.yml # Resources/Prototypes/Catalog/uplink_catalog.yml # Resources/Prototypes/Entities/Clothing/Back/backpacks.yml # Resources/Prototypes/Entities/Clothing/Shoes/magboots.yml # Resources/Prototypes/Entities/Debugging/debug_sweps.yml # Resources/Prototypes/Entities/Debugging/stress_test.yml # Resources/Prototypes/Entities/Markers/Spawners/Random/anomaly.yml # Resources/Prototypes/Entities/Markers/Spawners/Random/toy.yml # Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml # Resources/Prototypes/Entities/Mobs/Cyborgs/xenoborgs.yml # Resources/Prototypes/Entities/Mobs/NPCs/animals.yml # Resources/Prototypes/Entities/Mobs/NPCs/carp.yml # Resources/Prototypes/Entities/Objects/Devices/base_handheld.yml # Resources/Prototypes/Entities/Objects/Fun/Instruments/instruments_misc.yml # Resources/Prototypes/Entities/Objects/Fun/dice_bag.yml # Resources/Prototypes/Entities/Objects/Fun/snap_pops.yml # Resources/Prototypes/Entities/Objects/Materials/Sheets/other.yml # Resources/Prototypes/Entities/Objects/Materials/parts.yml # Resources/Prototypes/Entities/Objects/Misc/identification_cards.yml # Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml # Resources/Prototypes/Entities/Objects/Shields/shields.yml # Resources/Prototypes/Entities/Objects/Specific/Chapel/bibles.yml # Resources/Prototypes/Entities/Objects/Specific/Janitorial/janitor.yml # Resources/Prototypes/Entities/Objects/Specific/Medical/hypospray.yml # Resources/Prototypes/Entities/Objects/Specific/Medical/surgery.yml # Resources/Prototypes/Entities/Objects/Specific/Robotics/borg_modules.yml # Resources/Prototypes/Entities/Objects/Specific/Robotics/mmi.yml # Resources/Prototypes/Entities/Objects/Specific/Service/barber.yml # Resources/Prototypes/Entities/Objects/Tools/glowstick.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Boxes/antimateriel.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Boxes/magnum.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/heavy_rifle.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/light_rifle.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/magnum.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/pistol.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/rifle.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/shotgun.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magazines/light_rifle.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magazines/magnum.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magazines/pistol.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Magazines/rifle.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/grenade.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/SpeedLoaders/magnum.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/SpeedLoaders/pistol.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/SpeedLoaders/rifle_light.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/explosives.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Battery/battery_guns.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/LMGs/lmgs.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Pistols/pistols.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/hitscan.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Rifles/rifles.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/SMGs/smgs.yml # Resources/Prototypes/Entities/Objects/Weapons/Melee/knife.yml # Resources/Prototypes/Entities/Objects/Weapons/Throwable/grenades.yml # Resources/Prototypes/Entities/Structures/Furniture/dresser.yml # Resources/Prototypes/Entities/Structures/Machines/lathe.yml # Resources/Prototypes/Entities/Structures/Shuttles/cannons.yml # Resources/Prototypes/Entities/Structures/Walls/walls.yml # Resources/Prototypes/GameRules/roundstart.yml # Resources/Prototypes/GameRules/unknown_shuttles.yml # Resources/Prototypes/InventoryTemplates/aghost_inventory_template.yml # Resources/Prototypes/Loadouts/Jobs/Security/security_officer.yml # Resources/Prototypes/Loadouts/loadout_groups.yml # Resources/Prototypes/Loadouts/role_loadouts.yml # Resources/Prototypes/Maps/Pools/default.yml # Resources/Prototypes/Maps/amber.yml # Resources/Prototypes/Maps/oasis.yml # Resources/Prototypes/Maps/reach.yml # Resources/Prototypes/Objectives/objectiveGroups.yml # Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml # Resources/Prototypes/Reagents/medicine.yml # Resources/Prototypes/Reagents/narcotics.yml # Resources/Prototypes/Reagents/toxins.yml # Resources/Prototypes/Recipes/Reactions/medicine.yml # Resources/Prototypes/Roles/Jobs/Security/head_of_security.yml # Resources/Prototypes/Roles/Jobs/Security/security_cadet.yml # Resources/Prototypes/Roles/Jobs/Security/security_officer.yml # Resources/Prototypes/Roles/Jobs/Security/warden.yml # Resources/Prototypes/Roles/Jobs/Wildcards/zookeeper.yml # Resources/Prototypes/Roles/play_time_trackers.yml # Resources/Prototypes/Shuttles/shuttle_incoming_event.yml # Resources/Prototypes/Species/species_weights.yml # Resources/Prototypes/Store/presets.yml # Resources/Prototypes/ai_factions.yml # Resources/Prototypes/borg_types.yml # Resources/Prototypes/explosion.yml # Resources/Prototypes/game_presets.yml # Resources/Prototypes/lobbyscreens.yml # Resources/Prototypes/silicon-laws.yml # Resources/Textures/Clothing/Back/Duffels/syndicate.rsi/icon-med.png # Resources/Textures/Clothing/Back/Duffels/syndicate.rsi/meta.json # Resources/Textures/Objects/Specific/Mech/mecha.rsi/meta.json # Resources/Textures/Objects/Specific/Mech/mecha.rsi/ripley-broken.png # Resources/Textures/Objects/Specific/Mech/mecha.rsi/ripley-empty.png # Resources/Textures/Objects/Specific/Mech/mecha.rsi/ripley-open.png # Resources/Textures/Objects/Specific/Mech/mecha.rsi/ripley.png # Resources/Textures/Objects/Specific/Mech/ripley_construction.rsi/ripley_chassis.png # Resources/Textures/Objects/Specific/Mech/ripley_construction.rsi/ripley_harness+o.png # Resources/Textures/Objects/Specific/Mech/ripley_construction.rsi/ripley_harness.png # Resources/Textures/Objects/Specific/Medical/hypospray.rsi/meta.json # Resources/Textures/Objects/Specific/Medical/medical.rsi/meta.json # Resources/Textures/Objects/Weapons/Guns/Projectiles/projectiles.rsi/meta.json # Resources/Textures/Objects/Weapons/Guns/Projectiles/projectiles2.rsi/meta.json # Resources/Textures/Structures/Storage/canister.rsi/meta.json # Resources/Textures/Structures/Storage/tanks.rsi/meta.json # Resources/migration.yml # RobustToolbox # SECURITY.md # SpaceStation14.sln
264 lines
12 KiB
C#
264 lines
12 KiB
C#
#nullable enable
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Content.Server._Sunrise.StationCentComm;
|
|
using Content.Server._Sunrise.TransitHub;
|
|
using Content.Server.Body.Components;
|
|
using Content.Server.GameTicking;
|
|
using Content.Server.GameTicking.Presets;
|
|
using Content.Server.GameTicking.Rules.Components;
|
|
using Content.Server.Mind;
|
|
using Content.Server.Roles;
|
|
using Content.Server.RoundEnd;
|
|
using Content.Server.Shuttles.Components;
|
|
using Content.Shared.CCVar;
|
|
using Content.Shared.Damage.Components;
|
|
using Content.Shared.FixedPoint;
|
|
using Content.Shared.GameTicking;
|
|
using Content.Shared.Hands.Components;
|
|
using Content.Shared.Inventory;
|
|
using Content.Shared.NPC.Prototypes;
|
|
using Content.Shared.NPC.Systems;
|
|
using Content.Shared.NukeOps;
|
|
using Content.Shared.Pinpointer;
|
|
using Content.Shared.Roles.Components;
|
|
using Content.Shared.Station.Components;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Map.Components;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.IntegrationTests.Tests.GameRules;
|
|
|
|
[TestFixture]
|
|
public sealed class NukeOpsTest
|
|
{
|
|
private static readonly ProtoId<NpcFactionPrototype> SyndicateFaction = "Syndicate";
|
|
private static readonly ProtoId<NpcFactionPrototype> NanotrasenFaction = "NanoTrasen";
|
|
|
|
/// <summary>
|
|
/// Check that a nuke ops game mode can start without issue. I.e., that the nuke station and such all get loaded.
|
|
/// </summary>
|
|
[Test]
|
|
public async Task TryStopNukeOpsFromConstantlyFailing()
|
|
{
|
|
await using var pair = await PoolManager.GetServerClient(new PoolSettings
|
|
{
|
|
Dirty = true,
|
|
DummyTicker = false,
|
|
Connected = true,
|
|
InLobby = true
|
|
});
|
|
|
|
var server = pair.Server;
|
|
var client = pair.Client;
|
|
var entMan = server.EntMan;
|
|
var mapSys = server.System<MapSystem>();
|
|
var ticker = server.System<GameTicker>();
|
|
var mindSys = server.System<MindSystem>();
|
|
var roleSys = server.System<RoleSystem>();
|
|
var invSys = server.System<InventorySystem>();
|
|
var factionSys = server.System<NpcFactionSystem>();
|
|
var roundEndSys = server.System<RoundEndSystem>();
|
|
|
|
server.CfgMan.SetCVar(CCVars.GridFill, true);
|
|
|
|
// Initially in the lobby
|
|
Assert.That(ticker.RunLevel, Is.EqualTo(GameRunLevel.PreRoundLobby));
|
|
Assert.That(client.AttachedEntity, Is.Null);
|
|
Assert.That(ticker.PlayerGameStatuses[client.User!.Value], Is.EqualTo(PlayerGameStatus.NotReadyToPlay));
|
|
|
|
// Add several dummy players
|
|
var dummies = await pair.Server.AddDummySessions(3);
|
|
await pair.RunTicksSync(5);
|
|
|
|
// Opt into the nukies role.
|
|
await pair.SetAntagPreference("NukeopsCommander", true);
|
|
await pair.SetAntagPreference("NukeopsMedic", true, dummies[1].UserId);
|
|
|
|
// Initially, the players have no attached entities
|
|
Assert.That(pair.Player?.AttachedEntity, Is.Null);
|
|
Assert.That(dummies.All(x => x.AttachedEntity == null));
|
|
|
|
// There are no grids or maps
|
|
Assert.That(entMan.Count<MapComponent>(), Is.Zero);
|
|
Assert.That(entMan.Count<MapGridComponent>(), Is.Zero);
|
|
Assert.That(entMan.Count<StationMapComponent>(), Is.Zero);
|
|
Assert.That(entMan.Count<StationMemberComponent>(), Is.Zero);
|
|
Assert.That(entMan.Count<StationTransitHubComponent>(), Is.Zero); // Sunrise-Edit
|
|
|
|
// And no nukie related components
|
|
Assert.That(entMan.Count<NukeopsRuleComponent>(), Is.Zero);
|
|
Assert.That(entMan.Count<NukeopsRoleComponent>(), Is.Zero);
|
|
Assert.That(entMan.Count<NukeOperativeComponent>(), Is.Zero);
|
|
Assert.That(entMan.Count<NukeOpsShuttleComponent>(), Is.Zero);
|
|
Assert.That(entMan.Count<NukeOperativeSpawnerComponent>(), Is.Zero);
|
|
|
|
// Ready up and start nukeops
|
|
ticker.ToggleReadyAll(true);
|
|
Assert.That(ticker.PlayerGameStatuses.Values.All(x => x == PlayerGameStatus.ReadyToPlay));
|
|
await pair.WaitCommand("forcepreset Nukeops");
|
|
await pair.RunTicksSync(10);
|
|
|
|
// Game should have started
|
|
Assert.That(ticker.RunLevel, Is.EqualTo(GameRunLevel.InRound));
|
|
Assert.That(ticker.PlayerGameStatuses.Values.All(x => x == PlayerGameStatus.JoinedGame));
|
|
Assert.That(client.EntMan.EntityExists(client.AttachedEntity));
|
|
|
|
var dummyEnts = dummies.Select(x => x.AttachedEntity ?? default).ToArray();
|
|
var player = pair.Player!.AttachedEntity!.Value;
|
|
Assert.That(entMan.EntityExists(player));
|
|
Assert.That(dummyEnts.All(e => entMan.EntityExists(e)));
|
|
|
|
// Maps now exist
|
|
Assert.That(entMan.Count<MapComponent>(), Is.GreaterThan(0));
|
|
Assert.That(entMan.Count<MapGridComponent>(), Is.GreaterThan(0));
|
|
Assert.That(entMan.Count<StationTransitHubComponent>(), Is.EqualTo(1)); // Sunrise-Edit
|
|
|
|
// And we now have nukie related components
|
|
Assert.That(entMan.Count<NukeopsRuleComponent>(), Is.EqualTo(1));
|
|
Assert.That(entMan.Count<NukeopsRoleComponent>(), Is.EqualTo(2));
|
|
Assert.That(entMan.Count<NukeOperativeComponent>(), Is.EqualTo(2));
|
|
Assert.That(entMan.Count<NukeOpsShuttleComponent>(), Is.EqualTo(1));
|
|
|
|
// The player entity should be the nukie commander
|
|
var mind = mindSys.GetMind(player)!.Value;
|
|
Assert.That(entMan.HasComponent<NukeOperativeComponent>(player));
|
|
Assert.That(roleSys.MindIsAntagonist(mind));
|
|
Assert.That(roleSys.MindHasRole<NukeopsRoleComponent>(mind));
|
|
Assert.That(factionSys.IsMember(player, SyndicateFaction), Is.True);
|
|
Assert.That(factionSys.IsMember(player, NanotrasenFaction), Is.False);
|
|
var roles = roleSys.MindGetAllRoleInfo(mind);
|
|
var cmdRoles = roles.Where(x => x.Prototype == "NukeopsCommander");
|
|
Assert.That(cmdRoles.Count(), Is.EqualTo(1));
|
|
|
|
// The second dummy player should be a medic
|
|
var dummyMind = mindSys.GetMind(dummyEnts[1])!.Value;
|
|
Assert.That(entMan.HasComponent<NukeOperativeComponent>(dummyEnts[1]));
|
|
Assert.That(roleSys.MindIsAntagonist(dummyMind));
|
|
Assert.That(roleSys.MindHasRole<NukeopsRoleComponent>(dummyMind));
|
|
Assert.That(factionSys.IsMember(dummyEnts[1], SyndicateFaction), Is.True);
|
|
Assert.That(factionSys.IsMember(dummyEnts[1], NanotrasenFaction), Is.False);
|
|
roles = roleSys.MindGetAllRoleInfo(dummyMind);
|
|
cmdRoles = roles.Where(x => x.Prototype == "NukeopsMedic");
|
|
Assert.That(cmdRoles.Count(), Is.EqualTo(1));
|
|
|
|
// The other two players should have just spawned in as normal.
|
|
CheckDummy(0);
|
|
CheckDummy(2);
|
|
void CheckDummy(int i)
|
|
{
|
|
var ent = dummyEnts[i];
|
|
var mindCrew = mindSys.GetMind(ent)!.Value;
|
|
Assert.That(entMan.HasComponent<NukeOperativeComponent>(ent), Is.False);
|
|
Assert.That(roleSys.MindIsAntagonist(mindCrew), Is.False);
|
|
Assert.That(roleSys.MindHasRole<NukeopsRoleComponent>(mindCrew), Is.False);
|
|
Assert.That(factionSys.IsMember(ent, SyndicateFaction), Is.False);
|
|
Assert.That(factionSys.IsMember(ent, NanotrasenFaction), Is.True);
|
|
var nukeroles = new List<string>() { "Nukeops", "NukeopsMedic", "NukeopsCommander" };
|
|
Assert.That(roleSys.MindGetAllRoleInfo(mindCrew).Any(x => nukeroles.Contains(x.Prototype)), Is.False);
|
|
}
|
|
|
|
// The game rule exists, and all the stations/shuttles/maps are properly initialized
|
|
var rule = entMan.AllComponents<NukeopsRuleComponent>().Single();
|
|
var ruleComp = rule.Component;
|
|
var gridsRule = entMan.GetComponent<RuleGridsComponent>(rule.Uid);
|
|
foreach (var grid in gridsRule.MapGrids)
|
|
{
|
|
Assert.That(entMan.EntityExists(grid));
|
|
Assert.That(entMan.HasComponent<MapGridComponent>(grid));
|
|
}
|
|
Assert.That(entMan.EntityExists(ruleComp.TargetStation));
|
|
|
|
Assert.That(entMan.HasComponent<StationDataComponent>(ruleComp.TargetStation));
|
|
|
|
var nukieShuttle = entMan.AllComponents<NukeOpsShuttleComponent>().Single();
|
|
var nukieShuttlEnt = nukieShuttle.Uid;
|
|
Assert.That(entMan.EntityExists(nukieShuttlEnt));
|
|
Assert.That(nukieShuttle.Component.AssociatedRule, Is.EqualTo(rule.Uid));
|
|
|
|
EntityUid? nukieStationEnt = null;
|
|
foreach (var grid in gridsRule.MapGrids)
|
|
{
|
|
if (entMan.HasComponent<StationMemberComponent>(grid))
|
|
{
|
|
nukieStationEnt = grid;
|
|
break;
|
|
}
|
|
}
|
|
|
|
Assert.That(!entMan.EntityExists(nukieStationEnt)); // its not supposed to be a station!
|
|
Assert.That(mapSys.MapExists(gridsRule.Map));
|
|
var nukieMap = mapSys.GetMap(gridsRule.Map!.Value);
|
|
|
|
var targetStation = entMan.GetComponent<StationDataComponent>(ruleComp.TargetStation!.Value);
|
|
var targetGrid = targetStation.Grids.First();
|
|
var targetMap = entMan.GetComponent<TransformComponent>(targetGrid).MapUid!.Value;
|
|
Assert.That(targetMap, Is.Not.EqualTo(nukieMap));
|
|
|
|
Assert.That(entMan.GetComponent<TransformComponent>(player).MapUid, Is.EqualTo(nukieMap));
|
|
Assert.That(entMan.GetComponent<TransformComponent>(nukieShuttlEnt).MapUid, Is.EqualTo(nukieMap));
|
|
|
|
// The maps are all map-initialized, including the player
|
|
// Yes, this is necessary as this has repeatedly been broken somehow.
|
|
Assert.That(mapSys.IsInitialized(nukieMap));
|
|
Assert.That(mapSys.IsInitialized(targetMap));
|
|
Assert.That(mapSys.IsPaused(nukieMap), Is.False);
|
|
Assert.That(mapSys.IsPaused(targetMap), Is.False);
|
|
|
|
EntityLifeStage LifeStage(EntityUid? uid) => entMan.GetComponent<MetaDataComponent>(uid!.Value).EntityLifeStage;
|
|
Assert.That(LifeStage(player), Is.GreaterThan(EntityLifeStage.Initialized));
|
|
Assert.That(LifeStage(nukieMap), Is.GreaterThan(EntityLifeStage.Initialized));
|
|
Assert.That(LifeStage(targetMap), Is.GreaterThan(EntityLifeStage.Initialized));
|
|
Assert.That(LifeStage(nukieShuttlEnt), Is.GreaterThan(EntityLifeStage.Initialized));
|
|
Assert.That(LifeStage(ruleComp.TargetStation), Is.GreaterThan(EntityLifeStage.Initialized));
|
|
|
|
// Make sure the player has hands. We've had fucking disarmed nukies before.
|
|
Assert.That(entMan.HasComponent<HandsComponent>(player));
|
|
Assert.That(entMan.GetComponent<HandsComponent>(player).Hands.Count, Is.GreaterThan(0));
|
|
|
|
// While we're at it, lets make sure they aren't naked. I don't know how many inventory slots all mobs will be
|
|
// likely to have in the future. But nukies should probably have at least 3 slots with something in them.
|
|
var enumerator = invSys.GetSlotEnumerator(player);
|
|
var total = 0;
|
|
while (enumerator.NextItem(out _))
|
|
{
|
|
total++;
|
|
}
|
|
Assert.That(total, Is.GreaterThan(3));
|
|
|
|
// Check the nukie commander passed basic training and figured out how to breathe.
|
|
var totalSeconds = 30;
|
|
var totalTicks = (int) Math.Ceiling(totalSeconds / server.Timing.TickPeriod.TotalSeconds);
|
|
var increment = 5;
|
|
var resp = entMan.GetComponent<RespiratorComponent>(player);
|
|
var damage = entMan.GetComponent<DamageableComponent>(player);
|
|
for (var tick = 0; tick < totalTicks; tick += increment)
|
|
{
|
|
await pair.RunTicksSync(increment);
|
|
Assert.That(resp.SuffocationCycles, Is.LessThanOrEqualTo(resp.SuffocationCycleThreshold));
|
|
Assert.That(damage.TotalDamage, Is.EqualTo(FixedPoint2.Zero));
|
|
}
|
|
|
|
// Check that the round does not end prematurely when agents are deleted in the outpost
|
|
var nukies = dummyEnts.Where(entMan.HasComponent<NukeOperativeComponent>).Append(player).ToArray();
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
for (var i = 0; i < nukies.Length - 1; i++)
|
|
{
|
|
entMan.DeleteEntity(nukies[i]);
|
|
Assert.That(roundEndSys.IsRoundEndRequested,
|
|
Is.False,
|
|
$"The round ended, but {nukies.Length - i - 1} nukies are still alive!");
|
|
}
|
|
// Delete the last nukie and make sure the round ends.
|
|
entMan.DeleteEntity(nukies[^1]);
|
|
|
|
Assert.That(roundEndSys.IsRoundEndRequested,
|
|
"All nukies were deleted, but the round didn't end!");
|
|
});
|
|
|
|
ticker.SetGamePreset((GamePresetPrototype?) null);
|
|
await pair.CleanReturnAsync();
|
|
}
|
|
}
|