Skip to content

Commit

Permalink
* Concealment 1.1.3
Browse files Browse the repository at this point in the history
    - Fixed crash related to MyDynamicAABBTree.RemoveLeaf
    - Fixed button bindings in the UI
    - Fixed "Enabled" setting not working
  • Loading branch information
Jimmacle committed Jul 1, 2017
1 parent df8e209 commit c7362e0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
7 changes: 7 additions & 0 deletions Concealment/ConcealGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ public void UpdatePostConceal()
HookOnClosing();
}

public void UpdatePostReveal()
{
IsConcealed = false;
foreach (var grid in Grids)
grid.OnClosing -= Grid_OnClosing;
}

private void HookOnClosing()
{
foreach (var grid in Grids)
Expand Down
4 changes: 2 additions & 2 deletions Concealment/ConcealmentControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
<Button Content="Manual Conceal" Margin="3" Click="Conceal_OnClick" />
<Button Content="Manual Reveal" Margin="3" Click="Reveal_OnClick" />
</StackPanel>
<Button Content="Edit Excluded Subtypes" Margin="3" Click="RevealSelected_OnClick"/>
<Button Content="Edit Excluded Subtypes" Margin="3" Click="EditExclusion_OnClick"/>
</StackPanel>
<Button Content="Reveal Selected" Margin="3" DockPanel.Dock="Bottom" Click="EditExclusion_OnClick" />
<Button Content="Reveal Selected" Margin="3" DockPanel.Dock="Bottom" Click="RevealSelected_OnClick" />
<ListView Name="Concealed" Margin="3" DockPanel.Dock="Bottom" ItemsSource="{Binding ConcealGroups}">
<ItemsControl.ItemTemplate>
<DataTemplate>
Expand Down
20 changes: 10 additions & 10 deletions Concealment/ConcealmentPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@

namespace Concealment
{
[Plugin("Concealment", "1.1.2", "17f44521-b77a-4e85-810f-ee73311cf75d")]
[Plugin("Concealment", "1.1.3", "17f44521-b77a-4e85-810f-ee73311cf75d")]
public sealed class ConcealmentPlugin : TorchPluginBase, IWpfPlugin
{
public Persistent<Settings> Settings { get; private set; }
public MTObservableCollection<ConcealGroup> ConcealGroups { get; } = new MTObservableCollection<ConcealGroup>();

private static readonly Logger Log = LogManager.GetLogger("Concealment");
private UserControl _control;
private ulong _counter;
private ulong _counter = 1;
private bool _init;
private readonly List<ConcealGroup> _concealGroups = new List<ConcealGroup>();
private readonly List<ConcealGroup> _intersectGroups;
Expand All @@ -59,11 +59,16 @@ public override void Init(ITorchBase torch)
{
base.Init(torch);
Settings = Persistent<Settings>.Load(Path.Combine(StoragePath, "Concealment.cfg"));
Settings.Data.PropertyChanged += Data_PropertyChanged;
_concealedAabbTree = new MyDynamicAABBTreeD(MyConstants.GAME_PRUNING_STRUCTURE_AABB_EXTENSION);
//torch.SessionUnloading += Torch_SessionUnloading;
RegisterEntityStorage("Concealment", Id);
}

private void Data_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
RevealAll();
}

private void RegisterEntityStorage(string name, Guid id)
{
var comp = new MyModStorageComponentDefinition
Expand All @@ -74,14 +79,9 @@ private void RegisterEntityStorage(string name, Guid id)
MyDefinitionManager.Static.Definitions.AddDefinition(comp);
}

private void Torch_SessionUnloading()
{
RevealAll();
}

public override void Update()
{
if (MyAPIGateway.Session == null)
if (MyAPIGateway.Session == null || !Settings.Data.Enabled)
return;

if (_counter % Settings.Data.ConcealInterval == 0)
Expand All @@ -93,7 +93,6 @@ public override void Update()
if (_init)
return;

//MySession.Static.Players.PlayerRequesting += RevealSpawns;
MyMultiplayer.Static.ClientJoined += RevealCryoPod;

_init = true;
Expand Down Expand Up @@ -236,6 +235,7 @@ public int RevealGroup(ConcealGroup group)
#if !NOPHYS
_concealGroups.Remove(group);
_concealedAabbTree.RemoveProxy(group.ProxyId);
group.UpdatePostReveal();
#endif
return count;
}
Expand Down
1 change: 1 addition & 0 deletions Concealment/Settings.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using System.Xml.Serialization;
using Torch;

Expand Down

0 comments on commit c7362e0

Please sign in to comment.