Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
Rxup committed May 6, 2024
1 parent 0e0c8ce commit e8e942d
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 18 deletions.
20 changes: 20 additions & 0 deletions Content.Server/Backmen/Blob/NPC/BlobPod/BlobPodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
using Content.Server.DoAfter;
using Content.Server.Explosion.EntitySystems;
using Content.Server.NPC.HTN;
using Content.Server.NPC.Systems;
using Content.Server.Popups;
using Content.Shared.ActionBlocker;
using Content.Shared.Backmen.Blob.Components;
using Content.Shared.Backmen.Blob.NPC.BlobPod;
using Content.Shared.CombatMode;
using Content.Shared.Damage;
using Content.Shared.Destructible;
using Content.Shared.DoAfter;
using Content.Shared.Humanoid;
using Content.Shared.Interaction.Components;
using Content.Shared.Inventory;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Components;
using Content.Shared.Rejuvenate;
using Robust.Server.Audio;
using Robust.Shared.Containers;
Expand All @@ -29,6 +32,8 @@ public sealed class BlobPodSystem : SharedBlobPodSystem
[Dependency] private readonly AudioSystem _audioSystem = default!;
[Dependency] private readonly InventorySystem _inventory = default!;
[Dependency] private readonly ExplosionSystem _explosionSystem = default!;
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
[Dependency] private readonly NPCSystem _npc = default!;

public override void Initialize()
{
Expand All @@ -37,7 +42,18 @@ public override void Initialize()
SubscribeLocalEvent<BlobPodComponent, BlobPodZombifyDoAfterEvent>(OnZombify);
SubscribeLocalEvent<BlobPodComponent, DestructionEventArgs>(OnDestruction);
SubscribeLocalEvent<BlobPodComponent, EntGotRemovedFromContainerMessage>(OnUnequip);
SubscribeLocalEvent<BlobPodComponent, BeforeDamageChangedEvent>(OnGetDamage);
}



private void OnGetDamage(Entity<BlobPodComponent> ent, ref BeforeDamageChangedEvent args)
{
if (ent.Comp.ZombifiedEntityUid == null || TerminatingOrDeleted(ent.Comp.ZombifiedEntityUid.Value))
return;
// relay damage
args.Cancelled = true;
_damageableSystem.TryChangeDamage(ent.Comp.ZombifiedEntityUid.Value, args.Damage, origin: args.Origin);
}

private void OnUnequip(Entity<BlobPodComponent> ent, ref EntGotRemovedFromContainerMessage args)
Expand Down Expand Up @@ -105,6 +121,10 @@ private void OnZombify(EntityUid uid, BlobPodComponent component, BlobPodZombify

var zombieBlob = EnsureComp<ZombieBlobComponent>(args.Args.Target.Value);
zombieBlob.BlobPodUid = uid;
if (HasComp<ActorComponent>(uid))
{
_npc.SleepNPC(args.Args.Target.Value);
}
}


Expand Down
14 changes: 10 additions & 4 deletions Content.Server/Backmen/Blob/ZombieBlobSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
using Content.Shared.NPC.Systems;
using Content.Shared.Physics;
using Content.Shared.Tag;
using Content.Shared.Zombies;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

namespace Content.Server.Backmen.Blob;
Expand All @@ -40,7 +42,6 @@ public sealed class ZombieBlobSystem : EntitySystem
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly IChatManager _chatMan = default!;
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
[Dependency] private readonly RoleSystem _roleSystem = default!;
[Dependency] private readonly TriggerSystem _trigger = default!;

private const int ClimbingCollisionGroup = (int) (CollisionGroup.BlobImpassable);
Expand Down Expand Up @@ -171,16 +172,21 @@ private void OnStartup(EntityUid uid, ZombieBlobComponent component, ComponentSt
var htn = EnsureComp<HTNComponent>(uid);
htn.RootTask = new HTNCompoundTask() {Task = "SimpleHostileCompound"};
htn.Blackboard.SetValue(NPCBlackboard.Owner, uid);
_npc.WakeNPC(uid, htn);

if (!HasComp<ActorComponent>(component.BlobPodUid))
{
_npc.WakeNPC(uid, htn);
}
}

var ev = new EntityZombifiedEvent(uid);
RaiseLocalEvent(uid, ref ev, true);
}

private void OnShutdown(EntityUid uid, ZombieBlobComponent component, ComponentShutdown args)
{
if (TerminatingOrDeleted(uid))
{
return;
}

RemComp<BlobSpeakComponent>(uid);
RemComp<BlobMobComponent>(uid);
Expand Down
33 changes: 21 additions & 12 deletions Content.Server/Objectives/Commands/ListObjectivesCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Server.Administration;
using Content.Shared.Administration;
using Content.Shared.Mind;
using Content.Shared.Objectives.Components;
using Content.Shared.Objectives.Systems;
using Robust.Server.Player;
using Robust.Shared.Console;
Expand Down Expand Up @@ -33,27 +34,35 @@ public override void Execute(IConsoleShell shell, string argStr, string[] args)
}

shell.WriteLine($"Objectives for player {player.UserId}:");
var objectives = mind.AllObjectives.ToList();
if (objectives.Count == 0)
var objectivesGr = mind.AllObjectives
.Select(x=> (Entity<ObjectiveComponent?>)(x,_entities.GetComponentOrNull<ObjectiveComponent>(x))).GroupBy(x=>x.Comp?.Issuer ?? "") //backmen: locale
.ToList();
if (objectivesGr.Count == 0)
{
shell.WriteLine("None.");
}

var objectivesSystem = _entities.System<SharedObjectivesSystem>();
for (var i = 0; i < objectives.Count; i++)
// start-backmen: locale
foreach (var objective in objectivesGr)
{
var info = objectivesSystem.GetInfo(objectives[i], mindId, mind);
if (info == null)
var objectives = objective.ToList();
shell.WriteMarkup(Loc.GetString($"objective-issuer-{objective.Key}")+":");
for (var i = 0; i < objectives.Count; i++)
{
shell.WriteLine($"- [{i}] {objectives[i]} - INVALID");
}
else
{

var progress = (int) (info.Value.Progress * 100f);
shell.WriteLine($"- [{i}] {objectives[i]} ({info.Value.Title}) ({progress}%)");
var info = objectivesSystem.GetInfo(objectives[i], mindId, mind);
if (info == null)
{
shell.WriteLine($"- [{i}] {objectives[i].Owner} - INVALID");
}
else
{
var progress = (int) (info.Value.Progress * 100f);
shell.WriteLine($"- [{i}] {objectives[i].Owner} ({info.Value.Title}) ({progress}%)");
}
}
}
// end-backmen: locale
}

public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
Expand Down
1 change: 1 addition & 0 deletions Content.Shared/Backmen/Blob/Components/BlobPodComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public sealed partial class BlobPodComponent : Component
[ViewVariables(VVAccess.ReadOnly)]
public bool IsZombifying = false;

[AutoNetworkedField]
[ViewVariables(VVAccess.ReadOnly)]
public EntityUid? ZombifiedEntityUid = default!;

Expand Down
18 changes: 16 additions & 2 deletions Content.Shared/Backmen/Blob/NPC/BlobPod/SharedBlobPodSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using Content.Shared.Inventory.Events;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Events;
using Content.Shared.Verbs;
using Robust.Shared.Containers;
using Robust.Shared.Serialization;
Expand All @@ -18,19 +20,31 @@ public abstract class SharedBlobPodSystem : EntitySystem
[Dependency] private readonly MobStateSystem _mobs = default!;

private EntityQuery<HumanoidAppearanceComponent> _query;
private EntityQuery<InputMoverComponent> _inputQuery;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<BlobPodComponent, GetVerbsEvent<InnateVerb>>(AddDrainVerb);
SubscribeLocalEvent<BlobPodComponent, BeingUnequippedAttemptEvent>(OnUnequipAttempt);


SubscribeLocalEvent<BlobPodComponent, CanDropTargetEvent>(OnCanDragDropOn);
SubscribeLocalEvent<BlobPodComponent, DragDropTargetEvent>(OnBlobPodDragDrop);

SubscribeLocalEvent<BlobPodComponent, MoveInputEvent>(OnRelayMoveInput);

_query = GetEntityQuery<HumanoidAppearanceComponent>();
_inputQuery = GetEntityQuery<InputMoverComponent>();
}

private void OnRelayMoveInput(Entity<BlobPodComponent> ent, ref MoveInputEvent args)
{
if (ent.Comp.ZombifiedEntityUid == null || TerminatingOrDeleted(ent.Comp.ZombifiedEntityUid.Value) || !_inputQuery.TryComp(ent.Comp.ZombifiedEntityUid.Value, out var inputMoverComponent))
return;

var moveEvent = new MoveInputEvent(ent.Comp.ZombifiedEntityUid.Value, inputMoverComponent, args.Component.HeldMoveButtons);
inputMoverComponent.HeldMoveButtons = args.Component.HeldMoveButtons;
RaiseLocalEvent(ent.Comp.ZombifiedEntityUid.Value, ref moveEvent);
}

private void OnBlobPodDragDrop(Entity<BlobPodComponent> ent, ref DragDropTargetEvent args)
Expand Down

0 comments on commit e8e942d

Please sign in to comment.