Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD: Pacified component to clone entity #2598

Merged
merged 2 commits into from
Feb 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Content.Shared/CombatMode/Pacification/PacificationSystem.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using System.Diagnostics.CodeAnalysis;
using Content.Shared.Actions;
using Content.Shared.Alert;
using Content.Shared.Cloning;
using Content.Shared.FixedPoint;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction.Events;
using Content.Shared.Popups;
using Content.Shared.Throwing;
using Content.Shared.Weapons.Ranged.Events;
using Robust.Shared.Serialization.Manager;
using Robust.Shared.Timing;

namespace Content.Shared.CombatMode.Pacification;
Expand All @@ -18,6 +20,7 @@ public sealed class PacificationSystem : EntitySystem
[Dependency] private readonly SharedCombatModeSystem _combatSystem = default!;
[Dependency] private readonly SharedPopupSystem _popup = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly ISerializationManager _serialization = default!; //ss220 add clone pacified comp to clone entity

public override void Initialize()
{
Expand All @@ -28,6 +31,8 @@ public override void Initialize()
SubscribeLocalEvent<PacifiedComponent, AttackAttemptEvent>(OnAttackAttempt);
SubscribeLocalEvent<PacifiedComponent, ShotAttemptedEvent>(OnShootAttempt);
SubscribeLocalEvent<PacifismDangerousAttackComponent, AttemptPacifiedAttackEvent>(OnPacifiedDangerousAttack);

SubscribeLocalEvent<PacifiedComponent, CloningEvent>(OnCloning); //ss220 add clone pacified comp to clone entity
}

private bool PacifiedCanAttack(EntityUid user, EntityUid target, [NotNullWhen(false)] out string? reason)
Expand Down Expand Up @@ -151,6 +156,15 @@ private void OnPacifiedDangerousAttack(Entity<PacifismDangerousAttackComponent>
args.Cancelled = true;
args.Reason = "pacified-cannot-harm-indirect";
}

//ss220 add clone pacified comp to clone entity start
private void OnCloning(Entity<PacifiedComponent> ent, ref CloningEvent args)
{
RemComp<PacifiedComponent>(args.Target);
var newComp = EnsureComp<PacifiedComponent>(args.Target);
_serialization.CopyTo(ent.Comp, ref newComp, notNullableOverride: true);
}
//ss220 add clone pacified comp to clone entity end
}


Expand Down
Loading