Skip to content

Commit

Permalink
ADD: Pacified component to clone entity (#2598)
Browse files Browse the repository at this point in the history
* ADD: Pacified component to clone entity

* fix fix commit
  • Loading branch information
ReeZer2 authored Feb 22, 2025
1 parent 7e2e66b commit f9b088a
Showing 1 changed file with 14 additions and 0 deletions.
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

0 comments on commit f9b088a

Please sign in to comment.