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
1213using Content . Shared . _DV . Roles ;
1314using Robust . Shared . GameStates ;
1415using Robust . Shared . Player ;
16+ using Content . Shared . Mindshield . Components ;
1517
1618namespace 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