|
1 | 1 | using Content.Shared.Administration.Logs;
|
2 | 2 | using Content.Shared.Camera;
|
| 3 | +using Content.Shared.CombatMode.Pacification; |
3 | 4 | using Content.Shared.Contests;
|
4 | 5 | using Content.Shared.Damage;
|
5 | 6 | using Content.Shared.Damage.Components;
|
@@ -39,6 +40,7 @@ public override void Initialize()
|
39 | 40 | SubscribeLocalEvent<DamageOtherOnHitComponent, MapInitEvent>(OnMapInit);
|
40 | 41 | SubscribeLocalEvent<DamageOtherOnHitComponent, ThrowDoHitEvent>(OnDoHit);
|
41 | 42 | SubscribeLocalEvent<DamageOtherOnHitComponent, ThrownEvent>(OnThrown);
|
| 43 | + SubscribeLocalEvent<DamageOtherOnHitComponent, AttemptPacifiedThrowEvent>(OnAttemptPacifiedThrow); |
42 | 44 |
|
43 | 45 | SubscribeLocalEvent<ItemToggleDamageOtherOnHitComponent, MapInitEvent>(OnItemToggleMapInit);
|
44 | 46 | SubscribeLocalEvent<DamageOtherOnHitComponent, ItemToggledEvent>(OnItemToggle);
|
@@ -181,6 +183,16 @@ private void OnThrown(EntityUid uid, DamageOtherOnHitComponent component, Thrown
|
181 | 183 | component.HitQuantity = 0;
|
182 | 184 | }
|
183 | 185 |
|
| 186 | + /// <summary> |
| 187 | + /// Prevent Pacified entities from throwing damaging items. |
| 188 | + /// </summary> |
| 189 | + private void OnAttemptPacifiedThrow(EntityUid uid, DamageOtherOnHitComponent comp, ref AttemptPacifiedThrowEvent args) |
| 190 | + { |
| 191 | + // Allow healing projectiles, forbid any that do damage |
| 192 | + if (comp.Damage.AnyPositive()) |
| 193 | + args.Cancel("pacified-cannot-throw"); |
| 194 | + } |
| 195 | + |
184 | 196 | /// <summary>
|
185 | 197 | /// Gets the total damage a throwing weapon does.
|
186 | 198 | /// </summary>
|
|
0 commit comments