Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

наследственный глава революции #330

Merged
merged 5 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 38 additions & 23 deletions Content.Server/GameTicking/Rules/RevolutionaryRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ private void OnHeadRevMobStateChanged(EntityUid uid, HeadRevolutionaryComponent
/// </summary>
private bool CheckRevsLose()
{
var stunTime = TimeSpan.FromSeconds(4);
///ADT метод полностью переписан
///ADT start
var headRevList = new List<EntityUid>();

var headRevs = AllEntityQuery<HeadRevolutionaryComponent, MobStateComponent>();
Expand All @@ -204,37 +205,51 @@ private bool CheckRevsLose()
}

// 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))
if (IsGroupDead(headRevList, false))
{
var rev = AllEntityQuery<RevolutionaryComponent, MindContainerComponent>();
while (rev.MoveNext(out var uid, out _, out var mc))
var headrev = AllEntityQuery<RevolutionaryComponent, MindContainerComponent>();
while (headrev.MoveNext(out var uid, out _, out var mc))
{
if (HasComp<HeadRevolutionaryComponent>(uid))
continue;
if (TryComp<MobStateComponent>(uid, out var mobstate) && mobstate.CurrentState != MobState.Dead)
{
AddComp<HeadRevolutionaryComponent>(uid);
return false;
}
}
}
return true;

_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);
KashRas2 marked this conversation as resolved.
Show resolved Hide resolved
_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);
}
private bool IsGroupDead(List<EntityUid> list, bool checkOffStation, int? Dead = 0)
{
var dead = Dead;
foreach (var entity in list)
{
if (TryComp<MobStateComponent>(entity, out var state))
{
if (state.CurrentState == MobState.Dead || state.CurrentState == MobState.Invalid)
{
dead++;
}
else if (checkOffStation && _stationSystem.GetOwningStation(entity) == null && !_emergencyShuttle.EmergencyShuttleArrived)
{
dead++;
}
}
//If they don't have the MobStateComponent they might as well be dead.
else
{
dead++;
}
return true;
}

return false;
return dead == list.Count || list.Count == 0;
}
///ADT end



/// <summary>
/// Will take a group of entities and check if these entities are alive, dead or cuffed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ head-rev-break-mindshield = The Mindshield was destroyed!
roles-antag-rev-name = Revolutionary
roles-antag-rev-objective = Your objective is to ensure the safety and follow the orders of the Head Revolutionaries as well as getting rid of all Command staff on station.

rev-break-control = {$name} has remembered their true allegiance!

rev-role-greeting =
You are a Revolutionary.
You are tasked with taking over the station and protecting the Head Revolutionaries.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ head-rev-break-mindshield = Щит разума был уничтожен!

roles-antag-rev-name = Революционер
roles-antag-rev-objective = Ваша задача - защищать и выполнять приказы глав революции, а также избавиться от всего командного состава станции.
rev-break-control = { $name } { GENDER($name) ->
[male] вспомнил, кому он верен
[female] вспомнила, кому она верна
[epicene] вспомнили, кому они верни
*[neuter] вспомнило, кому оно верно
} на самом деле!
rev-role-greeting =
Вы - Революционер.
Вам поручено захватить станцию и защищать глав революции.
Expand Down
Loading