mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-05-02 21:17:30 +03:00
Ports Blob from https://github.com/Goob-Station/Goob-Station/pull/975 that was ported from https://github.com/Rxup/space-station-14. Credit to VigersRay for original code, Roudenn and Rxup for maintaining and jorgun for the Goob port. --- - [X] Port https://github.com/Goob-Station/Goob-Station/pull/975; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/1209; - [X] Port Blob related code from https://github.com/Goob-Station/Goob-Station/pull/1262; - [X] Port Blob related code from https://github.com/Goob-Station/Goob-Station/pull/1340; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/1408; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/1419; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/1440; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/1817; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/2077; - [ ] ~Port https://github.com/Goob-Station/Goob-Station/pull/1916~; - [ ] ~Port https://github.com/Goob-Station/Goob-Station/pull/1917~; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/2077; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/2092; - [X] Port https://github.com/Goob-Station/Goob-Station/pull/2546; - [X] Port https://github.com/Rxup/space-station-14/pull/963; - [X] Port https://github.com/Rxup/space-station-14/pull/998; - [ ] ~Port https://github.com/Goob-Station/Goob-Station/pull/2563~. - [X] Enable Blob and Blob gamemode; - [X] Add `StationGlobConfig` to all stations; - [X] Use `AnnouncerSystem` in `BlobRuleSystem.cs`; - [X] Blob language and Hivemind (from https://github.com/Rxup/space-station-14/pull/176); - [x] Change CVars location; - [X] Add media. --- <details><summary><h1>Media</h1></summary> <p> https://youtu.be/-WtMQwRcmrU?si=su3An6RtiCTZg-DV </p> </details> --- 🆑 VigersRay, Roudenn, Rxup, vladospupuos, fishbait and Kyoth25f - add: Added a new antagonist: Blob --------- Co-authored-by: fishbait <gnesse@gmail.com> Co-authored-by: Fishbait <Fishbait@git.ml> Co-authored-by: Aiden <aiden@djkraz.com> Co-authored-by: beck-thompson <107373427+beck-thompson@users.noreply.github.com> Co-authored-by: lanse12 <cloudability.ez@gmail.com> Co-authored-by: BombasterDS <deniskaporoshok@gmail.com> Co-authored-by: Aviu00 <93730715+Aviu00@users.noreply.github.com> Co-authored-by: Piras314 <p1r4s@proton.me> Co-authored-by: shibe <95730644+shibechef@users.noreply.github.com> Co-authored-by: Ilya246 <57039557+Ilya246@users.noreply.github.com> Co-authored-by: JohnOakman <sremy2012@hotmail.fr> Co-authored-by: Fat Engineer Gaming <159075414+Fat-Engineer-Gaming@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Rouden <149893554+Roudenn@users.noreply.github.com>
92 lines
3.0 KiB
C#
92 lines
3.0 KiB
C#
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Content.Server.NPC;
|
|
using Content.Server.NPC.HTN.PrimitiveTasks;
|
|
using Content.Server.NPC.Pathfinding;
|
|
using Content.Shared.Humanoid;
|
|
using Content.Shared.Mobs.Systems;
|
|
using Content.Shared.NPC.Systems;
|
|
|
|
namespace Content.Server.NPC.HTN.PrimitiveTasks.Operators.Specific;
|
|
|
|
public sealed partial class PickBlobPodZombifyTargetOperator : HTNOperator
|
|
{
|
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
|
private NpcFactionSystem _factions = default!;
|
|
private MobStateSystem _mobSystem = default!;
|
|
|
|
private EntityLookupSystem _lookup = default!;
|
|
private PathfindingSystem _pathfinding = default!;
|
|
|
|
[DataField("rangeKey", required: true)]
|
|
public string RangeKey = string.Empty;
|
|
|
|
[DataField("targetKey", required: true)]
|
|
public string TargetKey = string.Empty;
|
|
|
|
[DataField("zombifyKey")]
|
|
public string ZombifyKey = string.Empty;
|
|
|
|
/// <summary>
|
|
/// Where the pathfinding result will be stored (if applicable). This gets removed after execution.
|
|
/// </summary>
|
|
[DataField("pathfindKey")]
|
|
public string PathfindKey = NPCBlackboard.PathfindKey;
|
|
|
|
public override void Initialize(IEntitySystemManager sysManager)
|
|
{
|
|
base.Initialize(sysManager);
|
|
_lookup = sysManager.GetEntitySystem<EntityLookupSystem>();
|
|
_pathfinding = sysManager.GetEntitySystem<PathfindingSystem>();
|
|
_mobSystem = sysManager.GetEntitySystem<MobStateSystem>();
|
|
_factions = sysManager.GetEntitySystem<NpcFactionSystem>();
|
|
}
|
|
|
|
public override async Task<(bool Valid, Dictionary<string, object>? Effects)> Plan(NPCBlackboard blackboard,
|
|
CancellationToken cancelToken)
|
|
{
|
|
var owner = blackboard.GetValue<EntityUid>(NPCBlackboard.Owner);
|
|
|
|
if (!blackboard.TryGetValue<float>(RangeKey, out var range, _entManager))
|
|
return (false, null);
|
|
|
|
var huAppQuery = _entManager.GetEntityQuery<HumanoidAppearanceComponent>();
|
|
var xformQuery = _entManager.GetEntityQuery<TransformComponent>();
|
|
|
|
var targets = new List<EntityUid>();
|
|
|
|
foreach (var entity in _factions.GetNearbyHostiles(owner, range))
|
|
{
|
|
if (!huAppQuery.TryGetComponent(entity, out var humanoidAppearance))
|
|
continue;
|
|
|
|
if (_mobSystem.IsAlive(entity))
|
|
continue;
|
|
|
|
targets.Add(entity);
|
|
}
|
|
|
|
foreach (var target in targets)
|
|
{
|
|
if (!xformQuery.TryGetComponent(target, out var xform))
|
|
continue;
|
|
|
|
var targetCoords = xform.Coordinates;
|
|
var path = await _pathfinding.GetPath(owner, target, range, cancelToken);
|
|
if (path.Result != PathResult.Path)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
return (true, new Dictionary<string, object>()
|
|
{
|
|
{ TargetKey, targetCoords },
|
|
{ ZombifyKey, target },
|
|
{ PathfindKey, path}
|
|
});
|
|
}
|
|
|
|
return (false, null);
|
|
}
|
|
}
|