Skip to content

Commit a9947e9

Browse files
authored
Fix Queen screech not stunning parasites (RMC-14#5118)
1 parent 11fd43f commit a9947e9

File tree

8 files changed

+102
-21
lines changed

8 files changed

+102
-21
lines changed

Content.Server/_RMC14/Atmos/RMCFlammableSystem.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ private void OnShowFireAlert(Entity<FlammableComponent> ent, ref ShowFireAlertEv
2121
args.Show = true;
2222
}
2323

24-
public override bool Ignite(Entity<FlammableComponent?> flammable, int intensity, int duration, int? maxStacks)
24+
public override bool Ignite(Entity<FlammableComponent?> flammable, int intensity, int duration, int? maxStacks, bool igniteDamage = true)
2525
{
2626
base.Ignite(flammable, intensity, duration, maxStacks);
2727

Content.Shared/_RMC14/Atmos/SharedRMCFlammableSystem.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public override void Initialize()
102102

103103
private void OnIgniteOnProjectileHit(Entity<IgniteOnProjectileHitComponent> ent, ref ProjectileHitEvent args)
104104
{
105-
Ignite(args.Target, ent.Comp.Stacks, ent.Comp.Intensity, ent.Comp.Duration);
105+
Ignite(args.Target, ent.Comp.Stacks, ent.Comp.Intensity, ent.Comp.Duration, false);
106106
}
107107

108108
private void OnTileFireMapInit(Entity<TileFireComponent> ent, ref MapInitEvent args)
@@ -321,7 +321,7 @@ public bool IsOnFire(Entity<FlammableComponent?> ent)
321321
return Resolve(ent, ref ent.Comp, false) && ent.Comp.OnFire;
322322
}
323323

324-
public virtual bool Ignite(Entity<FlammableComponent?> flammable, int intensity, int duration, int? maxStacks)
324+
public virtual bool Ignite(Entity<FlammableComponent?> flammable, int intensity, int duration, int? maxStacks, bool igniteDamage = true)
325325
{
326326
// TODO RMC14
327327
return false;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Content.Shared.FixedPoint;
2+
using Robust.Shared.GameStates;
3+
4+
namespace Content.Shared._RMC14.Damage;
5+
6+
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
7+
[Access(typeof(SharedRMCDamageableSystem))]
8+
public sealed partial class ProjectileDamageReceivedComponent : Component
9+
{
10+
[DataField(required: true), AutoNetworkedField]
11+
public FixedPoint2 Multiplier = 1;
12+
}

Content.Shared/_RMC14/Damage/SharedRMCDamageableSystem.cs

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System.Linq;
2-
using Content.Shared._RMC14.Armor;
1+
using Content.Shared._RMC14.Armor;
32
using Content.Shared._RMC14.Entrenching;
43
using Content.Shared._RMC14.Map;
54
using Content.Shared._RMC14.Marines.Orders;
@@ -17,6 +16,7 @@
1716
using Content.Shared.Mobs.Components;
1817
using Content.Shared.Mobs.Systems;
1918
using Content.Shared.Popups;
19+
using Content.Shared.Projectiles;
2020
using Content.Shared.Silicons.Borgs;
2121
using Content.Shared.Weapons.Melee.Events;
2222
using Content.Shared.Weapons.Ranged.Events;
@@ -100,6 +100,13 @@ public override void Initialize()
100100
typeof(SharedMarineOrdersSystem), typeof(CMArmorSystem), typeof(SharedXenoPheromonesSystem)
101101
]);
102102

103+
SubscribeLocalEvent<ProjectileDamageReceivedComponent, DamageModifyEvent>(OnProjectileDamageReceivedModify,
104+
after:
105+
[
106+
typeof(SharedArmorSystem), typeof(BlockingSystem), typeof(InventorySystem), typeof(SharedBorgSystem),
107+
typeof(SharedMarineOrdersSystem), typeof(CMArmorSystem), typeof(SharedXenoPheromonesSystem)
108+
]);
109+
103110
_bruteTypes.Clear();
104111
_burnTypes.Clear();
105112

@@ -120,6 +127,12 @@ public override void Initialize()
120127
}
121128
}
122129

130+
private void OnProjectileDamageReceivedModify(Entity<ProjectileDamageReceivedComponent> ent, ref DamageModifyEvent args)
131+
{
132+
if (HasComp<ProjectileComponent>(args.Tool))
133+
args.Damage *= ent.Comp.Multiplier;
134+
}
135+
123136
private void OnDamageMobStateMapInit(Entity<DamageMobStateComponent> ent, ref MapInitEvent args)
124137
{
125138
ent.Comp.DamageAt = _timing.CurTime + ent.Comp.Cooldown;

Content.Shared/_RMC14/Xenonids/Screech/SharedXenoScreechSystem.cs

+31-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Content.Shared._RMC14.Marines;
22
using Content.Shared._RMC14.Xenonids.Hive;
3+
using Content.Shared._RMC14.Xenonids.Parasite;
34
using Content.Shared._RMC14.Xenonids.Plasma;
45
using Content.Shared.Coordinates;
56
using Content.Shared.Examine;
@@ -21,7 +22,8 @@ public sealed class XenoScreechSystem : EntitySystem
2122
[Dependency] private readonly SharedStunSystem _stun = default!;
2223
[Dependency] private readonly SharedAudioSystem _audio = default!;
2324

24-
private readonly HashSet<Entity<MarineComponent>> _receivers = new();
25+
private readonly HashSet<Entity<MarineComponent>> _marines = new();
26+
private readonly HashSet<Entity<XenoParasiteComponent>> _parasites = new();
2527

2628
public override void Initialize()
2729
{
@@ -52,10 +54,10 @@ private void OnXenoScreechAction(Entity<XenoScreechComponent> xeno, ref XenoScre
5254
if (_net.IsServer)
5355
_audio.PlayPvs(xeno.Comp.Sound, xeno);
5456

55-
_receivers.Clear();
56-
_entityLookup.GetEntitiesInRange(xform.Coordinates, xeno.Comp.StunRange, _receivers);
57+
_parasites.Clear();
58+
_entityLookup.GetEntitiesInRange(xform.Coordinates, xeno.Comp.StunRange, _parasites);
5759

58-
foreach (var receiver in _receivers)
60+
foreach (var receiver in _parasites)
5961
{
6062
if (_mobState.IsDead(receiver))
6163
continue;
@@ -69,24 +71,37 @@ private void OnXenoScreechAction(Entity<XenoScreechComponent> xeno, ref XenoScre
6971
_stun.TryStun(receiver, xeno.Comp.StunTime, false);
7072
}
7173

72-
_receivers.Clear();
73-
_entityLookup.GetEntitiesInRange(xform.Coordinates, xeno.Comp.ParalyzeRange, _receivers);
74+
_marines.Clear();
75+
_entityLookup.GetEntitiesInRange(xform.Coordinates, xeno.Comp.ParalyzeRange, _marines);
7476

75-
foreach (var receiver in _receivers)
76-
{
77-
if (_mobState.IsDead(receiver))
78-
continue;
79-
80-
if (!_examineSystem.InRangeUnOccluded(xeno.Owner, receiver.Owner))
81-
continue;
77+
_parasites.Clear();
78+
_entityLookup.GetEntitiesInRange(xform.Coordinates, xeno.Comp.ParalyzeRange, _parasites);
8279

83-
if (_hive.FromSameHive(xeno.Owner, receiver.Owner))
84-
continue;
80+
foreach (var receiver in _marines)
81+
{
82+
Stun(xeno, receiver, xeno.Comp.ParalyzeTime);
83+
}
8584

86-
_stun.TryParalyze(receiver, xeno.Comp.ParalyzeTime, true);
85+
foreach (var receiver in _parasites)
86+
{
87+
Stun(xeno, receiver, xeno.Comp.ParalyzeTime);
8788
}
8889

8990
if (_net.IsServer)
9091
SpawnAttachedTo(xeno.Comp.Effect, xeno.Owner.ToCoordinates());
9192
}
93+
94+
private void Stun(EntityUid xeno, EntityUid receiver, TimeSpan time)
95+
{
96+
if (_mobState.IsDead(receiver))
97+
return;
98+
99+
if (!_examineSystem.InRangeUnOccluded(xeno, receiver))
100+
return;
101+
102+
if (_hive.FromSameHive(xeno, receiver))
103+
return;
104+
105+
_stun.TryParalyze(receiver, time, true);
106+
}
92107
}

Resources/Prototypes/_RMC14/Entities/Objects/Weapons/Sentries/lz_sentries.yml

+2
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,5 @@
129129
curve: !type:BoolCurve
130130
- !type:TargetInLOSOrCurrentCon
131131
curve: !type:BoolCurve
132+
- !type:CanFaceCon
133+
curve: !type:BoolCurve

Resources/Prototypes/_RMC14/Entities/Objects/Weapons/Sentries/sentries.yml

+33
Original file line numberDiff line numberDiff line change
@@ -415,3 +415,36 @@
415415
- type: RMCWeaponAccuracy
416416
accuracyMultiplier: 2
417417
accuracyMultiplierUnwielded: 2
418+
419+
- type: entity
420+
parent: RMCBaseTurret
421+
id: RMCTurretGaussDumb
422+
name: damaged UN-577 gauss turret
423+
description: A deployable, semi-automated turret with AI targeting capabilities. Armed with an M30 Autocannon and a high-capacity drum magazine. This one's IFF system has been fried via acid damage, and it will open fire on any targets within range.
424+
components:
425+
- type: Gun
426+
fireRate: 2.5
427+
- type: BallisticAmmoProvider
428+
cycleable: false
429+
proto: RMCCartridgeSentry
430+
capacity: 99999
431+
- type: NpcFactionMember
432+
factions:
433+
- RMCDumb
434+
- type: Damageable
435+
damageContainer: Inorganic
436+
- type: Destructible
437+
thresholds:
438+
- trigger:
439+
!type:DamageTrigger
440+
damage: 200
441+
behaviors:
442+
- !type:PlaySoundBehavior
443+
sound:
444+
collection: MetalBreak
445+
- !type:DoActsBehavior
446+
acts: [ "Destruction" ]
447+
- type: MaxRotation
448+
deviation: 75
449+
- type: ProjectileDamageReceived
450+
multiplier: 0.1

Resources/Prototypes/_RMC14/Factions/rmc_factions.yml

+6
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@
77
id: RMCXeno
88
hostile:
99
- UNMC
10+
11+
- type: npcFaction
12+
id: RMCDumb
13+
hostile:
14+
- UNMC
15+
- RMCXeno

0 commit comments

Comments
 (0)