# Conflicts: # .github/workflows/validate-rgas.yml # .github/workflows/validate-rsis.yml # Content.Client/Changelog/ChangelogTab.xaml.cs # Content.Client/Humanoid/HumanoidAppearanceSystem.cs # Content.Client/Options/UI/OptionsMenu.xaml.cs # Content.Client/SubFloor/SubFloorHideSystem.cs # Content.Client/UserInterface/Systems/Ghost/Widgets/GhostGui.xaml.cs # Content.Server/Advertise/EntitySystems/SpeakOnUIClosedSystem.cs # Content.Server/Antag/AntagSelectionSystem.cs # Content.Server/Arcade/SpaceVillainGame/SpaceVillainArcadeSystem.cs # Content.Server/Explosion/EntitySystems/TriggerSystem.cs # Content.Server/Mindshield/MindShieldSystem.cs # Content.Server/Objectives/Systems/KillPersonConditionSystem.cs # Content.Server/Standing/StandingStateSystem.cs # Content.Server/Station/Systems/StationJobsSystem.Roundstart.cs # Content.Server/VendingMachines/VendingMachineSystem.cs # Content.Server/Zombies/ZombieSystem.Transform.cs # Content.Server/Zombies/ZombieSystem.cs # Content.Shared/Damage/Systems/DamageableSystem.cs # Content.Shared/Humanoid/HumanoidAppearanceComponent.cs # Content.Shared/Humanoid/Markings/MarkingManager.cs # Content.Shared/Humanoid/NamingSystem.cs # Content.Shared/Humanoid/Prototypes/SpeciesPrototype.cs # Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs # Content.Shared/Implants/Components/SubdermalImplantComponent.cs # Content.Shared/Standing/StandingStateSystem.cs # Content.Shared/VendingMachines/SharedVendingMachineSystem.cs # Content.Shared/VendingMachines/VendingMachineComponent.cs # Resources/Audio/Lobby/attributions.yml # Resources/Locale/en-US/_strings/administration/commands/forceghost.ftl # Resources/Locale/en-US/_strings/clothing/components/fire-protection-component.ftl # Resources/Locale/en-US/_strings/components/storage-voice-control-component.ftl # Resources/Locale/en-US/_strings/prototypes/roles/antags.ftl # Resources/Locale/en-US/_strings/reagents/meta/physical-desc.ftl # Resources/Locale/en-US/lathe/lathe-categories.ftl # Resources/Prototypes/Access/command.yml # Resources/Prototypes/Catalog/Fills/Books/bookshelf.yml # Resources/Prototypes/Catalog/Fills/Lockers/heads.yml # Resources/Prototypes/Catalog/Fills/Lockers/misc.yml # Resources/Prototypes/Catalog/VendingMachines/Inventories/chemvend.yml # Resources/Prototypes/Catalog/thief_toolbox_sets.yml # Resources/Prototypes/Datasets/Names/Operation_prefix.yml # Resources/Prototypes/Datasets/Names/Operation_suffix.yml # Resources/Prototypes/Datasets/Names/arachnid_first.yml # Resources/Prototypes/Datasets/Names/arachnid_last.yml # Resources/Prototypes/Datasets/Names/borg.yml # Resources/Prototypes/Datasets/Names/cargo_shuttle.yml # Resources/Prototypes/Datasets/Names/clown.yml # Resources/Prototypes/Datasets/Names/diona.yml # Resources/Prototypes/Datasets/Names/fake_human_first.yml # Resources/Prototypes/Datasets/Names/fake_human_last.yml # Resources/Prototypes/Datasets/Names/first.yml # Resources/Prototypes/Datasets/Names/first_female.yml # Resources/Prototypes/Datasets/Names/first_male.yml # Resources/Prototypes/Datasets/Names/fortunes.yml # Resources/Prototypes/Datasets/Names/hologram.yml # Resources/Prototypes/Datasets/Names/last.yml # Resources/Prototypes/Datasets/Names/military.yml # Resources/Prototypes/Datasets/Names/moth_first_female.yml # Resources/Prototypes/Datasets/Names/moth_first_male.yml # Resources/Prototypes/Datasets/Names/moth_last.yml # Resources/Prototypes/Datasets/Names/mushman_first.yml # Resources/Prototypes/Datasets/Names/mushman_last.yml # Resources/Prototypes/Datasets/Names/ninja.yml # Resources/Prototypes/Datasets/Names/ninja_title.yml # Resources/Prototypes/Datasets/Names/regalrat.yml # Resources/Prototypes/Datasets/Names/reptilian_female.yml # Resources/Prototypes/Datasets/Names/reptilian_male.yml # Resources/Prototypes/Datasets/Names/revenant.yml # Resources/Prototypes/Datasets/Names/skeleton_first.yml # Resources/Prototypes/Datasets/Names/syndicate.yml # Resources/Prototypes/Datasets/Names/vox.yml # Resources/Prototypes/Datasets/Names/wizard_first.yml # Resources/Prototypes/Datasets/Names/wizard_last.yml # Resources/Prototypes/Datasets/adjectives.yml # Resources/Prototypes/Datasets/corporations.yml # Resources/Prototypes/Datasets/criminal_records.yml # Resources/Prototypes/Datasets/rat_king_commands.yml # Resources/Prototypes/Datasets/verbs.yml # Resources/Prototypes/Entities/Clothing/Head/specific.yml # Resources/Prototypes/Entities/Clothing/OuterClothing/coats.yml # Resources/Prototypes/Entities/Clothing/OuterClothing/specific.yml # Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml # Resources/Prototypes/Entities/Mobs/NPCs/revenant.yml # Resources/Prototypes/Entities/Mobs/Player/human.yml # Resources/Prototypes/Entities/Mobs/Player/humanoid.yml # Resources/Prototypes/Entities/Mobs/Species/arachnid.yml # Resources/Prototypes/Entities/Mobs/Species/base.yml # Resources/Prototypes/Entities/Mobs/Species/moth.yml # Resources/Prototypes/Entities/Mobs/Species/vox.yml # Resources/Prototypes/Entities/Objects/Devices/pda.yml # Resources/Prototypes/Entities/Objects/Misc/paper.yml # Resources/Prototypes/Entities/Objects/Misc/subdermal_implants.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Cartridges/shotgun.yml # Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml # Resources/Prototypes/Entities/Stations/nanotrasen.yml # Resources/Prototypes/Entities/Structures/Furniture/carpets.yml # Resources/Prototypes/Entities/Structures/Storage/Closets/wall_lockers.yml # Resources/Prototypes/GameRules/roundstart.yml # Resources/Prototypes/Procedural/salvage_loot.yml # Resources/Prototypes/Reagents/Consumable/Drink/alcohol.yml # Resources/Prototypes/Recipes/Lathes/biogen.yml # Resources/Prototypes/Recipes/Lathes/categories.yml # Resources/Prototypes/Roles/Jobs/Security/warden.yml # Resources/Prototypes/Species/arachnid.yml # Resources/Prototypes/Species/diona.yml # Resources/Prototypes/Species/moth.yml # Resources/Prototypes/ai_factions.yml # Resources/Prototypes/game_presets.yml # Resources/ServerInfo/Guidebook/Mobs/SlimePerson.xml # Resources/ServerInfo/Guidebook/ServerRules/SpaceLaw/SpaceLaw.xml # Resources/ServerInfo/Guidebook/Service/Botany.xml # Resources/Textures/Clothing/Eyes/Glasses/glasses.rsi/meta.json # Resources/Textures/Clothing/Eyes/Glasses/jamjar.rsi/meta.json # Resources/Textures/Clothing/Eyes/Glasses/mercglasses.rsi/meta.json # Resources/Textures/Clothing/Eyes/Glasses/meson.rsi/meta.json # Resources/Textures/Clothing/Eyes/Glasses/ninjavisor.rsi/meta.json # Resources/Textures/Clothing/Eyes/Glasses/outlawglasses.rsi/meta.json # Resources/Textures/Clothing/Eyes/Glasses/science.rsi/meta.json # Resources/Textures/Clothing/Eyes/Glasses/secglasses.rsi/meta.json # Resources/Textures/Clothing/Eyes/Glasses/sunglasses.rsi/meta.json # Resources/Textures/Clothing/Eyes/Glasses/thermal.rsi/meta.json # Resources/Textures/Clothing/Eyes/Hud/beergoggles.rsi/inhand-left.png # Resources/Textures/Clothing/Eyes/Hud/beergoggles.rsi/inhand-right.png # Resources/Textures/Clothing/Eyes/Hud/beergoggles.rsi/meta.json # Resources/Textures/Clothing/Eyes/Hud/synd.rsi/meta.json # Resources/Textures/Clothing/Eyes/Hud/syndagent.rsi/meta.json # Resources/Textures/Clothing/Head/Hats/capcap.rsi/inhand-left.png # Resources/Textures/Clothing/Head/Hats/capcap.rsi/inhand-right.png # Resources/Textures/Clothing/Head/Hats/capcap.rsi/meta.json # Resources/Textures/Interface/Misc/program_icons.rsi/meta.json # Resources/Textures/Objects/Misc/Lights/lights.rsi/meta.json # Resources/Textures/Objects/Misc/bureaucracy.rsi/meta.json # Resources/Textures/Objects/Specific/Hydroponics/aloe.rsi/meta.json # Resources/Textures/Objects/Specific/Hydroponics/apple.rsi/meta.json # Resources/Textures/Objects/Specific/Hydroponics/carrot.rsi/meta.json # Resources/Textures/Objects/Specific/Hydroponics/chanterelle.rsi/meta.json # Resources/Textures/Objects/Specific/Hydroponics/chili.rsi/meta.json # Resources/Textures/Objects/Specific/Hydroponics/eggplant.rsi/meta.json # Resources/Textures/Objects/Specific/Hydroponics/gatfruit.rsi/meta.json # Resources/Textures/Objects/Specific/Hydroponics/lemon.rsi/meta.json # Resources/Textures/Objects/Specific/Hydroponics/onion_red.rsi/meta.json # Resources/Textures/Objects/Specific/Hydroponics/potato.rsi/meta.json # Resources/Textures/Objects/Specific/Hydroponics/sugarcane.rsi/meta.json # Resources/Textures/Objects/Specific/Hydroponics/tomato.rsi/meta.json # Resources/Textures/Objects/Specific/Robotics/borgmodule.rsi/meta.json # Resources/Textures/Objects/Specific/Robotics/cyborg_parts.rsi/meta.json # Resources/Textures/Objects/Tools/spray_painter.rsi/meta.json # Resources/Textures/Objects/Weapons/Grenades/flashbang.rsi/meta.json # Resources/Textures/Objects/Weapons/Grenades/grenade.rsi/meta.json # Resources/Textures/Objects/Weapons/Grenades/nukenade.rsi/meta.json # Resources/migration.yml # Tools/actions_changelogs_since_last_run.py
362 lines
14 KiB
C#
362 lines
14 KiB
C#
using System.Linq;
|
|
using Content.Server.Administration.Logs;
|
|
using Content.Server.Antag;
|
|
using Content.Server.EUI;
|
|
using Content.Server.Flash;
|
|
using Content.Server.GameTicking.Rules.Components;
|
|
using Content.Server.Mind;
|
|
using Content.Server.Popups;
|
|
using Content.Server.Revolutionary;
|
|
using Content.Server.Revolutionary.Components;
|
|
using Content.Server.Roles;
|
|
using Content.Server.RoundEnd;
|
|
using Content.Server.Shuttles.Systems;
|
|
using Content.Server.Station.Systems;
|
|
using Content.Server.AlertLevel; // Sunrise-Edit
|
|
using Content.Shared.Database;
|
|
using Content.Shared.GameTicking.Components;
|
|
using Content.Shared.Humanoid;
|
|
using Content.Shared.IdentityManagement;
|
|
using Content.Shared.Mind.Components;
|
|
using Content.Shared.Mindshield.Components;
|
|
using Content.Shared.Mobs;
|
|
using Content.Shared.Mobs.Components;
|
|
using Content.Shared.Mobs.Systems;
|
|
using Content.Shared.NPC.Prototypes;
|
|
using Content.Shared.NPC.Systems;
|
|
using Content.Shared.Revolutionary.Components;
|
|
using Content.Shared.Stunnable;
|
|
using Content.Shared.Zombies;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Timing;
|
|
using Content.Shared.Cuffs.Components;
|
|
using Content.Server.Administration.Managers;
|
|
using Content.Server.Administration.Systems;
|
|
using Content.Shared.Popups;
|
|
|
|
namespace Content.Server.GameTicking.Rules;
|
|
|
|
/// <summary>
|
|
/// Where all the main stuff for Revolutionaries happens (Assigning Head Revs, Command on station, and checking for the game to end.)
|
|
/// </summary>
|
|
public sealed class RevolutionaryRuleSystem : GameRuleSystem<RevolutionaryRuleComponent>
|
|
{
|
|
[Dependency] private readonly IAdminLogManager _adminLogManager = default!;
|
|
[Dependency] private readonly AntagSelectionSystem _antag = default!;
|
|
[Dependency] private readonly EmergencyShuttleSystem _emergencyShuttle = default!;
|
|
[Dependency] private readonly EuiManager _euiMan = default!;
|
|
[Dependency] private readonly MindSystem _mind = default!;
|
|
[Dependency] private readonly MobStateSystem _mobState = default!;
|
|
[Dependency] private readonly NpcFactionSystem _npcFaction = default!;
|
|
[Dependency] private readonly PopupSystem _popup = default!;
|
|
[Dependency] private readonly RoleSystem _role = default!;
|
|
[Dependency] private readonly SharedStunSystem _stun = default!;
|
|
[Dependency] private readonly RoundEndSystem _roundEnd = default!;
|
|
[Dependency] private readonly StationSystem _stationSystem = default!;
|
|
[Dependency] private readonly IGameTiming _timing = default!;
|
|
[Dependency] private readonly AlertLevelSystem _alertLevel = default!; // Sunrise-Edit
|
|
[Dependency] private readonly AdminVerbSystem _adminVerbSystem = default!;
|
|
[Dependency] private readonly IBanManager _banManager = default!;
|
|
|
|
//Used in OnPostFlash, no reference to the rule component is available
|
|
public readonly ProtoId<NpcFactionPrototype> RevolutionaryNpcFaction = "Revolutionary";
|
|
public readonly ProtoId<NpcFactionPrototype> RevPrototypeId = "Rev";
|
|
private Dictionary<EntityUid, TimeSpan> _scheduledSmites = new();
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<CommandStaffComponent, MobStateChangedEvent>(OnCommandMobStateChanged);
|
|
|
|
SubscribeLocalEvent<HeadRevolutionaryComponent, AfterFlashedEvent>(OnPostFlash);
|
|
SubscribeLocalEvent<HeadRevolutionaryComponent, MobStateChangedEvent>(OnHeadRevMobStateChanged);
|
|
|
|
SubscribeLocalEvent<RevolutionaryRoleComponent, GetBriefingEvent>(OnGetBriefing);
|
|
|
|
}
|
|
|
|
protected override void Started(EntityUid uid, RevolutionaryRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
|
|
{
|
|
base.Started(uid, component, gameRule, args);
|
|
component.CommandCheck = _timing.CurTime + component.TimerWait;
|
|
}
|
|
|
|
protected override void ActiveTick(EntityUid uid, RevolutionaryRuleComponent component, GameRuleComponent gameRule, float frameTime)
|
|
{
|
|
base.ActiveTick(uid, component, gameRule, frameTime);
|
|
// Check for command loss or if a banned player needs to be smited.
|
|
if (component.CommandCheck <= _timing.CurTime)
|
|
{
|
|
component.CommandCheck = _timing.CurTime + component.TimerWait;
|
|
|
|
// Check for command loss
|
|
if (CheckCommandLose())
|
|
{
|
|
// Sunrise-Edit-Start
|
|
var stations = _stationSystem.GetStations();
|
|
foreach (var station in stations)
|
|
{
|
|
_alertLevel.SetLevel(station, "epsilon", true, true, true);
|
|
}
|
|
_roundEnd.EndRound();
|
|
// Sunrise-Edit-End
|
|
GameTicker.EndGameRule(uid, gameRule);
|
|
}
|
|
|
|
// Execute scheduled smites for banned players
|
|
if (_scheduledSmites.Count > 0)
|
|
{
|
|
var currentTime = _timing.CurTime;
|
|
foreach (var entity in _scheduledSmites.Keys.ToList().Where(entity => _scheduledSmites[entity] <= currentTime))
|
|
{
|
|
if (EntityManager.EntityExists(entity))
|
|
{
|
|
_adminVerbSystem.RandomDeath(entity);
|
|
}
|
|
_scheduledSmites.Remove(entity);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override void AppendRoundEndText(EntityUid uid,
|
|
RevolutionaryRuleComponent component,
|
|
GameRuleComponent gameRule,
|
|
ref RoundEndTextAppendEvent args)
|
|
{
|
|
base.AppendRoundEndText(uid, component, gameRule, ref args);
|
|
|
|
var revsLost = CheckRevsLose();
|
|
var commandLost = CheckCommandLose();
|
|
// This is (revsLost, commandsLost) concatted together
|
|
// (moony wrote this comment idk what it means)
|
|
var index = (commandLost ? 1 : 0) | (revsLost ? 2 : 0);
|
|
args.AddLine(Loc.GetString(Outcomes[index]));
|
|
|
|
var sessionData = _antag.GetAntagIdentifiers(uid);
|
|
args.AddLine(Loc.GetString("rev-headrev-count", ("initialCount", sessionData.Count)));
|
|
foreach (var (mind, data, name) in sessionData)
|
|
{
|
|
_role.MindHasRole<RevolutionaryRoleComponent>(mind, out var role);
|
|
var count = CompOrNull<RevolutionaryRoleComponent>(role)?.ConvertedCount ?? 0;
|
|
|
|
args.AddLine(Loc.GetString("rev-headrev-name-user",
|
|
("name", name),
|
|
("username", data.UserName),
|
|
("count", count)));
|
|
|
|
// TODO: someone suggested listing all alive? revs maybe implement at some point
|
|
}
|
|
}
|
|
|
|
private void OnGetBriefing(EntityUid uid, RevolutionaryRoleComponent comp, ref GetBriefingEvent args)
|
|
{
|
|
var ent = args.Mind.Comp.OwnedEntity;
|
|
var head = HasComp<HeadRevolutionaryComponent>(ent);
|
|
args.Append(Loc.GetString(head ? "head-rev-briefing" : "rev-briefing"));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Called when a Head Rev uses a flash in melee to convert somebody else.
|
|
/// </summary>
|
|
private void OnPostFlash(EntityUid uid, HeadRevolutionaryComponent comp, ref AfterFlashedEvent ev)
|
|
{
|
|
var alwaysConvertible = HasComp<AlwaysRevolutionaryConvertibleComponent>(ev.Target);
|
|
|
|
if (!_mind.TryGetMind(ev.Target, out var mindId, out var mind) && !alwaysConvertible)
|
|
return;
|
|
|
|
if (HasComp<RevolutionaryComponent>(ev.Target) ||
|
|
HasComp<MindShieldComponent>(ev.Target) ||
|
|
HasComp<CommandStaffComponent>(ev.Target) ||
|
|
!HasComp<HumanoidAppearanceComponent>(ev.Target) &&
|
|
!alwaysConvertible ||
|
|
!_mobState.IsAlive(ev.Target) ||
|
|
HasComp<ZombieComponent>(ev.Target))
|
|
{
|
|
return;
|
|
}
|
|
|
|
// Check if the user has a ban on "Revolutionary"
|
|
// Check if the user has a ban on "Revolutionary"
|
|
if (mind != null && mind.Session != null && _banManager.IsAntagBanned(mind.Session.UserId, "Rev"))
|
|
{
|
|
KillDueToBan(ev.Target);
|
|
return;
|
|
}
|
|
|
|
_npcFaction.AddFaction(ev.Target, RevolutionaryNpcFaction);
|
|
var revComp = EnsureComp<RevolutionaryComponent>(ev.Target);
|
|
|
|
if (ev.User != null)
|
|
{
|
|
_adminLogManager.Add(LogType.Mind,
|
|
LogImpact.Medium,
|
|
$"{ToPrettyString(ev.User.Value)} converted {ToPrettyString(ev.Target)} into a Revolutionary");
|
|
|
|
if (_mind.TryGetMind(ev.User.Value, out var revMindId, out _))
|
|
{
|
|
if (_role.MindHasRole<RevolutionaryRoleComponent>(revMindId, out var role))
|
|
role.Value.Comp2.ConvertedCount++;
|
|
}
|
|
}
|
|
|
|
if (mindId == default || !_role.MindHasRole<RevolutionaryRoleComponent>(mindId))
|
|
{
|
|
_role.MindAddRole(mindId, "MindRoleRevolutionary");
|
|
}
|
|
|
|
if (mind?.Session != null)
|
|
_antag.SendBriefing(mind.Session, Loc.GetString("rev-role-greeting"), Color.Red, revComp.RevStartSound);
|
|
}
|
|
|
|
//TODO: Enemies of the revolution
|
|
private void OnCommandMobStateChanged(EntityUid uid, CommandStaffComponent comp, MobStateChangedEvent ev)
|
|
{
|
|
if (ev.NewMobState == MobState.Dead || ev.NewMobState == MobState.Invalid)
|
|
CheckCommandLose();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Checks if all of command is dead and if so will remove all sec and command jobs if there were any left.
|
|
/// </summary>
|
|
private bool CheckCommandLose()
|
|
{
|
|
var commandList = new List<EntityUid>();
|
|
|
|
var heads = AllEntityQuery<CommandStaffComponent>();
|
|
while (heads.MoveNext(out var id, out _))
|
|
{
|
|
commandList.Add(id);
|
|
}
|
|
|
|
return IsGroupDetainedOrDead(commandList, true, true, true);
|
|
}
|
|
|
|
private void OnHeadRevMobStateChanged(EntityUid uid, HeadRevolutionaryComponent comp, MobStateChangedEvent ev)
|
|
{
|
|
if (ev.NewMobState == MobState.Dead || ev.NewMobState == MobState.Invalid)
|
|
CheckRevsLose();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Checks if all the Head Revs are dead and if so will deconvert all regular revs.
|
|
/// </summary>
|
|
private bool CheckRevsLose()
|
|
{
|
|
var stunTime = TimeSpan.FromSeconds(4);
|
|
var headRevList = new List<EntityUid>();
|
|
|
|
var headRevs = AllEntityQuery<HeadRevolutionaryComponent, MobStateComponent>();
|
|
while (headRevs.MoveNext(out var uid, out _, out _))
|
|
{
|
|
headRevList.Add(uid);
|
|
}
|
|
|
|
// If no Head Revs are alive all normal Revs will lose their Rev status and rejoin Nanotrasen
|
|
// Cuffing Head Revs is not enough - they must be killed.
|
|
if (IsGroupDetainedOrDead(headRevList, false, false, false))
|
|
{
|
|
var rev = AllEntityQuery<RevolutionaryComponent, MindContainerComponent>();
|
|
while (rev.MoveNext(out var uid, out _, out var mc))
|
|
{
|
|
if (HasComp<HeadRevolutionaryComponent>(uid))
|
|
continue;
|
|
|
|
_npcFaction.RemoveFaction(uid, RevolutionaryNpcFaction);
|
|
_stun.TryParalyze(uid, stunTime, true);
|
|
RemCompDeferred<RevolutionaryComponent>(uid);
|
|
_popup.PopupEntity(Loc.GetString("rev-break-control", ("name", Identity.Entity(uid, EntityManager))), uid);
|
|
_adminLogManager.Add(LogType.Mind, LogImpact.Medium, $"{ToPrettyString(uid)} was deconverted due to all Head Revolutionaries dying.");
|
|
|
|
if (!_mind.TryGetMind(uid, out var mindId, out _, mc))
|
|
continue;
|
|
|
|
// remove their antag role
|
|
_role.MindTryRemoveRole<RevolutionaryRoleComponent>(mindId);
|
|
|
|
// make it very obvious to the rev they've been deconverted since
|
|
// they may not see the popup due to antag and/or new player tunnel vision
|
|
if (_mind.TryGetSession(mindId, out var session))
|
|
_euiMan.OpenEui(new DeconvertedEui(), session);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Will take a group of entities and check if these entities are alive, dead or cuffed.
|
|
/// </summary>
|
|
/// <param name="list">The list of the entities</param>
|
|
/// <param name="checkOffStation">Bool for if you want to check if someone is in space and consider them missing in action. (Won't check when emergency shuttle arrives just in case)</param>
|
|
/// <param name="countCuffed">Bool for if you don't want to count cuffed entities.</param>
|
|
/// <param name="countRevolutionaries">Bool for if you want to count revolutionaries.</param>
|
|
/// <returns></returns>
|
|
private bool IsGroupDetainedOrDead(List<EntityUid> list, bool checkOffStation, bool countCuffed, bool countRevolutionaries)
|
|
{
|
|
var gone = 0;
|
|
|
|
foreach (var entity in list)
|
|
{
|
|
if (TryComp<CuffableComponent>(entity, out var cuffed) && cuffed.CuffedHandCount > 0 && countCuffed)
|
|
{
|
|
gone++;
|
|
continue;
|
|
}
|
|
|
|
if (TryComp<MobStateComponent>(entity, out var state))
|
|
{
|
|
if (state.CurrentState == MobState.Dead || state.CurrentState == MobState.Invalid)
|
|
{
|
|
gone++;
|
|
continue;
|
|
}
|
|
|
|
if (checkOffStation && _stationSystem.GetOwningStation(entity) == null && !_emergencyShuttle.EmergencyShuttleArrived)
|
|
{
|
|
gone++;
|
|
continue;
|
|
}
|
|
}
|
|
//If they don't have the MobStateComponent they might as well be dead.
|
|
else
|
|
{
|
|
gone++;
|
|
continue;
|
|
}
|
|
|
|
if ((HasComp<RevolutionaryComponent>(entity) || HasComp<HeadRevolutionaryComponent>(entity)) && countRevolutionaries)
|
|
{
|
|
gone++;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
return gone == list.Count || list.Count == 0;
|
|
}
|
|
|
|
private void KillDueToBan(EntityUid target)
|
|
{
|
|
_popup.PopupEntity(Loc.GetString("rev-banned"), target, target, PopupType.LargeCaution);
|
|
|
|
var randomDelay = new Random().Next(10, 60); // 10-60 seconds
|
|
var targetTime = _timing.CurTime + TimeSpan.FromSeconds(randomDelay);
|
|
_scheduledSmites[target] = targetTime;
|
|
}
|
|
|
|
private static readonly string[] Outcomes =
|
|
{
|
|
// revs survived and heads survived... how
|
|
"rev-reverse-stalemate",
|
|
// revs won and heads died
|
|
"rev-won",
|
|
// revs lost and heads survived
|
|
"rev-lost",
|
|
// revs lost and heads died
|
|
"rev-stalemate"
|
|
};
|
|
}
|