3131
3232namespace Concealment
3333{
34- [ Plugin ( "Concealment" , "1.1.2 " , "17f44521-b77a-4e85-810f-ee73311cf75d" ) ]
34+ [ Plugin ( "Concealment" , "1.1.3 " , "17f44521-b77a-4e85-810f-ee73311cf75d" ) ]
3535 public sealed class ConcealmentPlugin : TorchPluginBase , IWpfPlugin
3636 {
3737 public Persistent < Settings > Settings { get ; private set ; }
3838 public MTObservableCollection < ConcealGroup > ConcealGroups { get ; } = new MTObservableCollection < ConcealGroup > ( ) ;
3939
4040 private static readonly Logger Log = LogManager . GetLogger ( "Concealment" ) ;
4141 private UserControl _control ;
42- private ulong _counter ;
42+ private ulong _counter = 1 ;
4343 private bool _init ;
4444 private readonly List < ConcealGroup > _concealGroups = new List < ConcealGroup > ( ) ;
4545 private readonly List < ConcealGroup > _intersectGroups ;
@@ -59,11 +59,16 @@ public override void Init(ITorchBase torch)
5959 {
6060 base . Init ( torch ) ;
6161 Settings = Persistent < Settings > . Load ( Path . Combine ( StoragePath , "Concealment.cfg" ) ) ;
62+ Settings . Data . PropertyChanged += Data_PropertyChanged ;
6263 _concealedAabbTree = new MyDynamicAABBTreeD ( MyConstants . GAME_PRUNING_STRUCTURE_AABB_EXTENSION ) ;
63- //torch.SessionUnloading += Torch_SessionUnloading;
6464 RegisterEntityStorage ( "Concealment" , Id ) ;
6565 }
6666
67+ private void Data_PropertyChanged ( object sender , System . ComponentModel . PropertyChangedEventArgs e )
68+ {
69+ RevealAll ( ) ;
70+ }
71+
6772 private void RegisterEntityStorage ( string name , Guid id )
6873 {
6974 var comp = new MyModStorageComponentDefinition
@@ -74,14 +79,9 @@ private void RegisterEntityStorage(string name, Guid id)
7479 MyDefinitionManager . Static . Definitions . AddDefinition ( comp ) ;
7580 }
7681
77- private void Torch_SessionUnloading ( )
78- {
79- RevealAll ( ) ;
80- }
81-
8282 public override void Update ( )
8383 {
84- if ( MyAPIGateway . Session == null )
84+ if ( MyAPIGateway . Session == null || ! Settings . Data . Enabled )
8585 return ;
8686
8787 if ( _counter % Settings . Data . ConcealInterval == 0 )
@@ -93,7 +93,6 @@ public override void Update()
9393 if ( _init )
9494 return ;
9595
96- //MySession.Static.Players.PlayerRequesting += RevealSpawns;
9796 MyMultiplayer . Static . ClientJoined += RevealCryoPod ;
9897
9998 _init = true ;
@@ -236,6 +235,7 @@ public int RevealGroup(ConcealGroup group)
236235#if ! NOPHYS
237236 _concealGroups . Remove ( group ) ;
238237 _concealedAabbTree . RemoveProxy ( group . ProxyId ) ;
238+ group . UpdatePostReveal ( ) ;
239239#endif
240240 return count ;
241241 }
0 commit comments