Store ninja objectives in conditions 2 (#20894)

* move spider charge target from role

* shorter field names

* remove ninja role comment

* remove unused systems in SpaceNinjaSystem

* GenericAntagObjectivesAddedEvent

* check if warp point is on same map

* remove unnecessary import

* add missing loc when spider charge has no target

* a

* remove spider charge target requirement comp

* inline SpiderChargeTitle

* allow planting charge without objective

* remove map check

* fix role check when planting

* obj.Target

* Fix merge

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Vyacheslav Kovalevsky
2024-01-29 07:06:32 +03:00
committed by GitHub
parent 2a6705818b
commit 7311ce671f
10 changed files with 67 additions and 83 deletions

View File

@@ -7,7 +7,6 @@ using Content.Server.PowerCell;
using Content.Server.Research.Systems;
using Content.Server.Roles;
using Content.Server.GenericAntag;
using Content.Server.Warps;
using Content.Shared.Alert;
using Content.Shared.Clothing.EntitySystems;
using Content.Shared.Doors.Components;
@@ -17,9 +16,11 @@ using Content.Shared.Ninja.Components;
using Content.Shared.Ninja.Systems;
using Content.Shared.Popups;
using Content.Shared.Rounding;
using Robust.Shared.Random;
using Robust.Shared.Audio;
using Robust.Shared.Player;
using System.Diagnostics.CodeAnalysis;
using Content.Server.Objectives.Components;
using Robust.Shared.Audio.Systems;
namespace Content.Server.Ninja.Systems;
@@ -37,9 +38,9 @@ public sealed class SpaceNinjaSystem : SharedSpaceNinjaSystem
[Dependency] private readonly AlertsSystem _alerts = default!;
[Dependency] private readonly BatterySystem _battery = default!;
[Dependency] private readonly IChatManager _chatMan = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly PowerCellSystem _powerCell = default!;
[Dependency] private readonly RoleSystem _role = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedMindSystem _mind = default!;
[Dependency] private readonly StealthClothingSystem _stealthClothing = default!;
@@ -161,18 +162,9 @@ public sealed class SpaceNinjaSystem : SharedSpaceNinjaSystem
_role.MindAddRole(mindId, role, mind);
_role.MindPlaySound(mindId, config.GreetingSound, mind);
// choose spider charge detonation point
var warps = new List<EntityUid>();
var query = EntityQueryEnumerator<BombingTargetComponent, WarpPointComponent>();
while (query.MoveNext(out var warpUid, out _, out var warp))
{
warps.Add(warpUid);
}
if (warps.Count > 0)
role.SpiderChargeTarget = _random.Pick(warps);
_chatMan.DispatchServerMessage(mind.Session, Loc.GetString("ninja-role-greeting"));
var session = mind.Session;
_audio.PlayGlobal(config.GreetingSound, Filter.Empty().AddPlayer(session), false, AudioParams.Default);
_chatMan.DispatchServerMessage(session, Loc.GetString("ninja-role-greeting"));
}
// TODO: PowerCellDraw, modify when cloak enabled