Skip to content

Commit 39b8582

Browse files
ferynnfunkystationbottaydeo
authored
Mindshields break on Cosmic Cult members (funky-station#1313)
Co-authored-by: funkystationbot <funky@funkystation.org> Co-authored-by: Tay <td12233a@gmail.com>
1 parent f211f9e commit 39b8582

3 files changed

Lines changed: 52 additions & 13 deletions

File tree

Content.Shared/Mindshield/Components/MindShieldComponent.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
// SPDX-FileCopyrightText: 2024 BombasterDS <115770678+BombasterDS@users.noreply.github.com>
55
// SPDX-FileCopyrightText: 2024 Tadeo <td12233a@gmail.com>
66
// SPDX-FileCopyrightText: 2024 slarticodefast <161409025+slarticodefast@users.noreply.github.com>
7+
// SPDX-FileCopyrightText: 2025 ferynn <witchy.girl.me@gmail.com>
78
// SPDX-FileCopyrightText: 2025 taydeo <td12233a@gmail.com>
89
//
910
// SPDX-License-Identifier: MIT
1011

12+
using Content.Shared._DV.CosmicCult;
1113
using Content.Shared.Revolutionary;
1214
using Robust.Shared.GameStates;
1315
using Content.Shared.StatusIcon;
@@ -18,7 +20,7 @@ namespace Content.Shared.Mindshield.Components;
1820
/// <summary>
1921
/// If a player has a Mindshield they will get this component to prevent conversion.
2022
/// </summary>
21-
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedRevolutionarySystem))] //Goobstation - AutoGenerateComponentState
23+
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, Access(typeof(SharedRevolutionarySystem),typeof(SharedCosmicCultSystem))] //Goobstation - AutoGenerateComponentState
2224
public sealed partial class MindShieldComponent : Component
2325
{
2426
[DataField, ViewVariables(VVAccess.ReadWrite)]

Content.Shared/Revolutionary/SharedRevolutionarySystem.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// SPDX-FileCopyrightText: 2024 nikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com>
77
// SPDX-FileCopyrightText: 2025 Skye <57879983+Rainbeon@users.noreply.github.com>
88
// SPDX-FileCopyrightText: 2025 Tadeo <td12233a@gmail.com>
9+
// SPDX-FileCopyrightText: 2025 ferynn <witchy.girl.me@gmail.com>
910
// SPDX-FileCopyrightText: 2025 taydeo <td12233a@gmail.com>
1011
//
1112
// SPDX-License-Identifier: MIT
@@ -21,6 +22,8 @@
2122
using Robust.Shared.Player;
2223
using Content.Shared.Antag;
2324
using Content.Shared.Strip.Components;
25+
using Content.Shared._DV.CosmicCult.Components;
26+
using Content.Shared._DV.Roles;
2427

2528
namespace Content.Shared.Revolutionary;
2629

@@ -70,6 +73,13 @@ private void MindShieldImplanted(EntityUid uid, MindShieldComponent comp, MapIni
7073
_sharedStun.TryParalyze(uid, stunTime, true);
7174
_popupSystem.PopupEntity(Loc.GetString("rev-break-control", ("name", name)), uid);
7275
}
76+
77+
if (HasComp<CosmicCultComponent>(uid) || HasComp<CosmicCultLeadComponent>(uid))
78+
{
79+
comp.Broken = true; // Goobstation - Broken mindshield implant instead of break it
80+
Dirty(uid, comp);
81+
return;
82+
}
7383
}
7484

7585
/// <summary>
@@ -104,7 +114,7 @@ private bool CanGetState(ICommonSession? player)
104114

105115
return HasComp<ShowAntagIconsComponent>(uid);
106116
}
107-
117+
108118
/// <summary>
109119
/// Dirties all the Rev components so they are sent to clients.
110120
///
@@ -150,7 +160,7 @@ private bool TryCancelSelfMindshield(EntityUid user, EntityUid target, EntityUid
150160
{
151161
if (user != target)
152162
return false;
153-
163+
154164
if (!TryComp<TagComponent>(implant, out var tagComp))
155165
return false;
156166

Content.Shared/_DV/CosmicCult/SharedCosmicCultSystem.cs

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// SPDX-FileCopyrightText: 2025 corresp0nd <46357632+corresp0nd@users.noreply.github.com>
22
// SPDX-FileCopyrightText: 2025 deltanedas <@deltanedas:kde.org>
3+
// SPDX-FileCopyrightText: 2025 ferynn <witchy.girl.me@gmail.com>
34
// SPDX-FileCopyrightText: 2025 taydeo <td12233a@gmail.com>
45
//
56
// SPDX-License-Identifier: AGPL-3.0-or-later AND MIT
@@ -12,6 +13,7 @@
1213
using Content.Shared._DV.Roles;
1314
using Robust.Shared.GameStates;
1415
using Robust.Shared.Player;
16+
using Content.Shared.Mindshield.Components;
1517

1618
namespace Content.Shared._DV.CosmicCult;
1719

@@ -26,8 +28,12 @@ public override void Initialize()
2628

2729
SubscribeLocalEvent<CosmicCultComponent, ComponentGetStateAttemptEvent>(OnCosmicCultCompGetStateAttempt);
2830
SubscribeLocalEvent<CosmicCultLeadComponent, ComponentGetStateAttemptEvent>(OnCosmicCultCompGetStateAttempt);
29-
SubscribeLocalEvent<CosmicCultComponent, ComponentStartup>(DirtyCosmicCultComps);
30-
SubscribeLocalEvent<CosmicCultLeadComponent, ComponentStartup>(DirtyCosmicCultComps);
31+
SubscribeLocalEvent<CosmicCultComponent, ComponentStartup>(OnCosmicCultConversion);
32+
SubscribeLocalEvent<CosmicCultLeadComponent, ComponentStartup>(OnCosmicCultConversion);
33+
SubscribeLocalEvent<CosmicCultComponent, ComponentRemove>(OnCosmicCultDeconversion);
34+
SubscribeLocalEvent<CosmicCultLeadComponent, ComponentRemove>(OnCosmicCultDeconversion);
35+
36+
3137
}
3238

3339
public bool EntityIsCultist(EntityUid user)
@@ -75,15 +81,16 @@ private bool CanGetState(ICommonSession? player)
7581
return HasComp<ShowAntagIconsComponent>(uid);
7682
}
7783

78-
/// <summary>
79-
/// Dirties all the Cult components so they are sent to clients.
80-
///
81-
/// We need to do this because if a Cult component was not earlier sent to a client and for example the client
82-
/// becomes a Cult then we need to send all the components to it. To my knowledge there is no way to do this on a
83-
/// per client basis so we are just dirtying all the components.
84-
/// </summary>
85-
private void DirtyCosmicCultComps<T>(EntityUid someUid, T someComp, ComponentStartup ev)
84+
private void OnCosmicCultConversion<T>(EntityUid someUid, T someComp, ComponentStartup ev)
8685
{
86+
///DirtyCosmicCultComps
87+
/// <summary>
88+
/// Dirties all the Cult components so they are sent to clients.
89+
///
90+
/// We need to do this because if a Cult component was not earlier sent to a client and for example the client
91+
/// becomes a Cult then we need to send all the components to it. To my knowledge there is no way to do this on a
92+
/// per client basis so we are just dirtying all the components.
93+
/// </summary>
8794
var cosmicCultComps = AllEntityQuery<CosmicCultComponent>();
8895
while (cosmicCultComps.MoveNext(out var uid, out var comp))
8996
{
@@ -95,5 +102,25 @@ private void DirtyCosmicCultComps<T>(EntityUid someUid, T someComp, ComponentSta
95102
{
96103
Dirty(uid, comp);
97104
}
105+
//If the cultist has a mindshield, break it //Funky
106+
if (HasComp<MindShieldComponent>(someUid))
107+
{
108+
if (TryComp<MindShieldComponent>(someUid, out var mindShieldComp))
109+
{
110+
mindShieldComp.Broken = true;
111+
Dirty(someUid, mindShieldComp);
112+
}
113+
}
114+
}
115+
private void OnCosmicCultDeconversion<T>(EntityUid uid, T someComp, ComponentRemove ev)
116+
{
117+
if (HasComp<MindShieldComponent>(uid))
118+
{
119+
if (TryComp<MindShieldComponent>(uid, out var mindShieldComp))
120+
{
121+
mindShieldComp.Broken = false;
122+
Dirty(uid, mindShieldComp);
123+
}
124+
}
98125
}
99126
}

0 commit comments

Comments
 (0)