* Adds Survivor Antag * Adds Survivor Role * Adds Survivor Rule ECS, adds a survivor role event, adds make antagonist to random global spawn spell * Moves Survivor Ensurecomp to event handler. Makes Add Survivor Role a broadcast. Adds Survivor Component. Removes redundant briefing. * Adds Survivor Antagonist role type for admins to keep track of this easier, adds it to Survivor. * Adds access to survivor game rule system * Adds Survivor Rule * Adds end of round survivor text * Adds end of round reporting logic. Adds logic to start the survivor rule. * Changes desc from centcomm to shuttle * survivor (S) * Checks if they're alive on the shuttle instead of centcomm. * ftl text selection based on number of survivors. * Removed Survivor Antagonist, replaced it with Free Agent. * Adds InvalidForGlobalSpawnSpell tag, checks for it on spawnspell, and adds it to a zombified person. * Changes logic so we launch the game rule if it hasnt launched yet. Moves rule logic starting to server. Moved survivor rule logic out of event and into Start method. * Fixes invalid entity issue * Descs for Survivor Rule and Survivor comps * Moves Survivor Rule to its own yml * Checks for dead survivors, changes survivor checks for mind. Adds survivor comp to mind to fix any mindswap issues. Same for invalid survivor tag * Changes shuttle xform call to just mapid * Protoid fix * THE WIZARD * Wizard spawner * adds the correct state * Wizard preset and weight * Fixes wizard rule * Weight back to 100% * Adds Random Metadata * Wizard locs * Puts requirements in the right place * Adds wiz ghost spawner and mob * wizard spawnpoint fix + shuttle mapping * wizard loadout + fix wizard spawning + wizard random name * comment * Adds Wizard testing * FIXES SHUTTLE ISSUE BASED REI * THE WIZARD LOBBY SONG. Special thanks to song creator Chris Remo for allowing us to use this. * Free Objective ECS + Base Free Objective * Space Wizard Federation for Wiz Obj issuer. * Wizard Objectives * Moves wizard shuttle to base wizard rule. Gives Wizard their objectives. Removes WizardRule * Renames midround to subgamemodes. Adds wizard sub game mode. * Adds SubWizard to SubGameModesRule. Adds a SubGameMode with no wizard. Adds No SubGamemodeRule for Wizard preset * Wizard midround event * Fixes wizard midround * Wizard Guidebook * Removes todo * Fixes text * Removes wizard rule ECS, not needed * Wizard jetpack --------- Co-authored-by: ScarKy0 <scarky0@onet.eu> Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
109 lines
3.9 KiB
C#
109 lines
3.9 KiB
C#
using Content.Server.Antag;
|
|
using Content.Server.GameTicking.Rules.Components;
|
|
using Content.Server.Mind;
|
|
using Content.Server.Roles;
|
|
using Content.Server.Shuttles.Systems;
|
|
using Content.Shared.GameTicking.Components;
|
|
using Content.Shared.Mind;
|
|
using Content.Shared.Mobs.Systems;
|
|
using Content.Shared.Survivor.Components;
|
|
using Content.Shared.Tag;
|
|
using Robust.Server.GameObjects;
|
|
|
|
namespace Content.Server.GameTicking.Rules;
|
|
|
|
public sealed class SurvivorRuleSystem : GameRuleSystem<SurvivorRuleComponent>
|
|
{
|
|
[Dependency] private readonly RoleSystem _role = default!;
|
|
[Dependency] private readonly MindSystem _mind = default!;
|
|
[Dependency] private readonly AntagSelectionSystem _antag = default!;
|
|
[Dependency] private readonly TransformSystem _xform = default!;
|
|
[Dependency] private readonly EmergencyShuttleSystem _eShuttle = default!;
|
|
[Dependency] private readonly TagSystem _tag = default!;
|
|
[Dependency] private readonly MobStateSystem _mobState = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<SurvivorRoleComponent, GetBriefingEvent>(OnGetBriefing);
|
|
}
|
|
|
|
// TODO: Planned rework post wizard release when RandomGlobalSpawnSpell becomes a gamerule
|
|
protected override void Started(EntityUid uid, SurvivorRuleComponent component, GameRuleComponent gameRule, GameRuleStartedEvent args)
|
|
{
|
|
base.Started(uid, component, gameRule, args);
|
|
|
|
var allAliveHumanMinds = _mind.GetAliveHumans();
|
|
|
|
foreach (var humanMind in allAliveHumanMinds)
|
|
{
|
|
if (!humanMind.Comp.OwnedEntity.HasValue)
|
|
continue;
|
|
|
|
var mind = humanMind.Owner;
|
|
var ent = humanMind.Comp.OwnedEntity.Value;
|
|
|
|
if (HasComp<SurvivorComponent>(mind) || _tag.HasTag(mind, "InvalidForSurvivorAntag"))
|
|
continue;
|
|
|
|
EnsureComp<SurvivorComponent>(mind);
|
|
_role.MindAddRole(mind, "MindRoleSurvivor");
|
|
_antag.SendBriefing(ent, Loc.GetString("survivor-role-greeting"), Color.Olive, null);
|
|
}
|
|
}
|
|
|
|
private void OnGetBriefing(Entity<SurvivorRoleComponent> ent, ref GetBriefingEvent args)
|
|
{
|
|
args.Append(Loc.GetString("survivor-role-greeting"));
|
|
}
|
|
|
|
protected override void AppendRoundEndText(EntityUid uid,
|
|
SurvivorRuleComponent component,
|
|
GameRuleComponent gameRule,
|
|
ref RoundEndTextAppendEvent args)
|
|
{
|
|
base.AppendRoundEndText(uid, component, gameRule, ref args);
|
|
|
|
// Using this instead of alive antagonists to make checking for shuttle & if the ent is alive easier
|
|
var existingSurvivors = AllEntityQuery<SurvivorComponent, MindComponent>();
|
|
|
|
var deadSurvivors = 0;
|
|
var aliveMarooned = 0;
|
|
var aliveOnShuttle = 0;
|
|
var eShuttle = _eShuttle.GetShuttle();
|
|
|
|
while (existingSurvivors.MoveNext(out _, out _, out var mindComp))
|
|
{
|
|
// If their brain is gone or they respawned/became a ghost role
|
|
if (mindComp.CurrentEntity is null)
|
|
{
|
|
deadSurvivors++;
|
|
continue;
|
|
}
|
|
|
|
var survivor = mindComp.CurrentEntity.Value;
|
|
|
|
if (!_mobState.IsAlive(survivor))
|
|
{
|
|
deadSurvivors++;
|
|
continue;
|
|
}
|
|
|
|
if (eShuttle != null && eShuttle.Value.IsValid() && (Transform(eShuttle.Value).MapID == _xform.GetMapCoordinates(survivor).MapId))
|
|
{
|
|
aliveOnShuttle++;
|
|
continue;
|
|
}
|
|
|
|
aliveMarooned++;
|
|
}
|
|
|
|
args.AddLine(Loc.GetString("survivor-round-end-dead-count", ("deadCount", deadSurvivors)));
|
|
args.AddLine(Loc.GetString("survivor-round-end-alive-count", ("aliveCount", aliveMarooned)));
|
|
args.AddLine(Loc.GetString("survivor-round-end-alive-on-shuttle-count", ("aliveCount", aliveOnShuttle)));
|
|
|
|
// Player manifest at EOR shows who's a survivor so no need for extra info here.
|
|
}
|
|
}
|