Целью на убийство для антагониста может быть только экипаж основной станции
This commit is contained in:
parent
898730ee53
commit
ed452581ce
8 changed files with 62 additions and 10 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using Content.Server._Sunrise.Station;
|
||||
using Content.Server.Administration.Managers;
|
||||
using Content.Server.GameTicking.Events;
|
||||
using Content.Server.Ghost;
|
||||
|
|
@ -23,6 +24,7 @@ using Robust.Shared.Player;
|
|||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Utility;
|
||||
using Content.Server._Sunrise.TraitorTarget; // Sunrise-Edit
|
||||
|
||||
namespace Content.Server.GameTicking
|
||||
{
|
||||
|
|
@ -254,6 +256,11 @@ namespace Content.Server.GameTicking
|
|||
DebugTools.AssertNotNull(mobMaybe);
|
||||
var mob = mobMaybe!.Value;
|
||||
|
||||
// Sunrise-Start
|
||||
if (HasComp<StationAntagsTargetsComponent>(station))
|
||||
EntityManager.AddComponent<AntagTargetComponent>(mob);
|
||||
// Sunrise-End
|
||||
|
||||
_mind.TransferTo(newMind, mob);
|
||||
|
||||
if (lateJoin && !silent)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Linq;
|
||||
using Content.Server._Sunrise.TraitorTarget;
|
||||
using Content.Server.Objectives.Components;
|
||||
using Content.Server.Shuttles.Systems;
|
||||
using Content.Shared.CCVar;
|
||||
|
|
@ -55,6 +57,15 @@ public sealed class KillPersonConditionSystem : EntitySystem
|
|||
|
||||
// no other humans to kill
|
||||
var allHumans = _mind.GetAliveHumansExcept(args.MindId);
|
||||
|
||||
// Sunrise-Start
|
||||
foreach (var entityUid in allHumans.ToList())
|
||||
{
|
||||
if (!HasComp<AntagTargetComponent>(entityUid))
|
||||
allHumans.Remove(entityUid);
|
||||
}
|
||||
// Sunrise-End
|
||||
|
||||
if (allHumans.Count == 0)
|
||||
{
|
||||
args.Cancelled = true;
|
||||
|
|
@ -79,6 +90,13 @@ public sealed class KillPersonConditionSystem : EntitySystem
|
|||
|
||||
// no other humans to kill
|
||||
var allHumans = _mind.GetAliveHumansExcept(args.MindId);
|
||||
|
||||
foreach (var entityUid in allHumans.ToList())
|
||||
{
|
||||
if (!HasComp<AntagTargetComponent>(entityUid))
|
||||
allHumans.Remove(entityUid);
|
||||
}
|
||||
|
||||
if (allHumans.Count == 0)
|
||||
{
|
||||
args.Cancelled = true;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Server._Sunrise.TraitorTarget;
|
||||
using Content.Server.DetailExaminable;
|
||||
using Content.Server.Forensics;
|
||||
using Content.Server.GameTicking;
|
||||
|
|
@ -41,8 +42,6 @@ public sealed class EvilTwinSystem : EntitySystem
|
|||
[Dependency] private readonly MetaDataSystem _metaDataSystem = default!;
|
||||
[Dependency] private readonly TargetObjectiveSystem _target = default!;
|
||||
[Dependency] private readonly SharedObjectivesSystem _objectives = default!;
|
||||
[Dependency] private readonly LoadoutSystem _loadoutSystem = default!;
|
||||
|
||||
|
||||
[ValidatePrototypeId<AntagPrototype>]
|
||||
private const string EvilTwinRole = "EvilTwin";
|
||||
|
|
@ -59,7 +58,7 @@ public sealed class EvilTwinSystem : EntitySystem
|
|||
SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEnd);
|
||||
}
|
||||
|
||||
private void OnPlayerAttached(EntityUid uid, _Sunrise.EvilTwin.EvilTwinSpawnerComponent component, PlayerAttachedEvent args)
|
||||
private void OnPlayerAttached(EntityUid uid, EvilTwinSpawnerComponent component, PlayerAttachedEvent args)
|
||||
{
|
||||
if (TryGetEligibleHumanoid(out var targetUid))
|
||||
{
|
||||
|
|
@ -88,8 +87,8 @@ public sealed class EvilTwinSystem : EntitySystem
|
|||
_roleSystem.MindAddRole(mindId, role, mind);
|
||||
_mindSystem.TryAddObjective(mindId, mind, EscapeObjective);
|
||||
_mindSystem.TryAddObjective(mindId, mind, KillObjective);
|
||||
if (_mindSystem.TryGetObjectiveComp<TargetObjectiveComponent>(uid, out var obj)) // Sunrise-edit
|
||||
_target.SetTarget(uid, evilTwin.TargetMindId, obj); // Sunrise-edit
|
||||
if (_mindSystem.TryGetObjectiveComp<TargetObjectiveComponent>(uid, out var obj))
|
||||
_target.SetTarget(uid, evilTwin.TargetMindId, obj);
|
||||
}
|
||||
|
||||
private void OnRoundEnd(RoundEndTextAppendEvent ev)
|
||||
|
|
@ -176,9 +175,9 @@ public sealed class EvilTwinSystem : EntitySystem
|
|||
/// <returns>false if not found</returns>
|
||||
private bool TryGetEligibleHumanoid([NotNullWhen(true)] out EntityUid? uid)
|
||||
{
|
||||
var targets = EntityQuery<ActorComponent, HumanoidAppearanceComponent>().ToList();
|
||||
var targets = EntityQuery<ActorComponent, AntagTargetComponent, HumanoidAppearanceComponent>().ToList();
|
||||
_random.Shuffle(targets);
|
||||
foreach (var (actor, _) in targets)
|
||||
foreach (var (actor, _, _) in targets)
|
||||
{
|
||||
if (!_mindSystem.TryGetMind(actor.PlayerSession, out var mindId, out var mind) || mind.OwnedEntity == null)
|
||||
continue;
|
||||
|
|
@ -186,8 +185,6 @@ public sealed class EvilTwinSystem : EntitySystem
|
|||
if (!_jobSystem.MindTryGetJob(mindId, out _, out _))
|
||||
continue;
|
||||
|
||||
// There was check for nukeops or evil twin, but ist it will be fun?
|
||||
|
||||
uid = mind.OwnedEntity;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -229,7 +226,6 @@ public sealed class EvilTwinSystem : EntitySystem
|
|||
{
|
||||
pref.Loadouts.TryGetValue(jobLoadout, out var loadout);
|
||||
|
||||
// Set to default if not present
|
||||
if (loadout == null)
|
||||
{
|
||||
loadout = new RoleLoadout(jobLoadout);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
namespace Content.Server._Sunrise.Station;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class StationAntagsTargetsComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace Content.Server._Sunrise.TraitorTarget
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed partial class AntagTargetComponent : Component
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -1578,3 +1578,13 @@
|
|||
type: Tweak
|
||||
id: 119
|
||||
time: '2024-07-12T02:17:26.755638+00:00'
|
||||
- author: VigersRay
|
||||
changes:
|
||||
- message: "\u0426\u0435\u043B\u044C\u044E \u0434\u043B\u044F \u0443\u0431\u0438\
|
||||
\u0439\u0441\u0442\u0432\u0430 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\
|
||||
\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u044D\u043A\u0438\u043F\u0430\u0436\
|
||||
\ \u043E\u0441\u043D\u043E\u0432\u043D\u043E\u0439 \u0441\u0442\u0430\u043D\u0446\
|
||||
\u0438\u0438."
|
||||
type: Tweak
|
||||
id: 120
|
||||
time: '2024-07-12T03:12:49.272328+00:00'
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
- BaseStationPlanetPrison
|
||||
- BaseStationGoal
|
||||
- BaseStationGammaArmory
|
||||
- BaseStationAntagsTargets
|
||||
# Sunrise-End
|
||||
noSpawn: true
|
||||
components:
|
||||
|
|
|
|||
|
|
@ -104,3 +104,9 @@
|
|||
components:
|
||||
- type: AlertLevel
|
||||
alertLevelPrototype: stationPrisonAlerts
|
||||
|
||||
- type: entity
|
||||
id: BaseStationAntagsTargets
|
||||
abstract: true
|
||||
components:
|
||||
- type: StationAntagsTargetsComponent
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue