Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Concealment/ConcealmentControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<StackPanel Grid.Row="0">
<StackPanel DataContext="{Binding Settings.Data}">
<CheckBox Content="Enable Concealment" Margin="3" IsChecked="{Binding Enabled}" />
<CheckBox Content="Conceal Grids In Movement (above 20m/s)" Margin="3" IsChecked="{Binding ConcealInMovement}" />
<CheckBox Content="Conceal Production" ToolTip="Conceal grids with active production blocks." Margin="3" IsChecked="{Binding ConcealProduction}" />
<CheckBox Content="Conceal Pirates" ToolTip="Conceal grids owned by Space Pirates." Margin="3" IsChecked="{Binding ConcealPirates}" />
<CheckBox Content="RC Keep Alive Action" ToolTip="Adds a toolbar action to remote control blocks to allow players to forcefully keep a grid from being concealed using a PB or Timer." Margin="3" IsChecked="{Binding RCKeepAliveAction}" />
Expand Down
23 changes: 21 additions & 2 deletions Concealment/ConcealmentPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public override void Update()
if (_ready)
{
if (_counter % (ulong)Settings.Data.ConcealInterval == 0)
ConcealGrids(Settings.Data.ConcealDistance);
ConcealGrids(Settings.Data.ConcealDistance, Settings.Data.ConcealInMovement);
if (_counter % (ulong)Settings.Data.RevealInterval == 0)
RevealGrids(Settings.Data.RevealDistance);
_counter += 1;
Expand Down Expand Up @@ -329,7 +329,7 @@ public int RevealGrids(double distanceFromPlayers)
return revealed;
}

public int ConcealGrids(double distanceFromPlayers = 0)
public int ConcealGrids(double distanceFromPlayers = 0, bool concealInMovement = false)
{
Log.Debug("Concealing grids");

Expand All @@ -342,6 +342,25 @@ public int ConcealGrids(double distanceFromPlayers = 0)
{
var concealGroup = new ConcealGroup(group);

if (!concealInMovement)
{
var isInMovement = false;
foreach (var grid in group.Nodes)
{
if (grid?.NodeData?.Speed > 20f)
{
isInMovement = true;
break;
}
}

if (isInMovement)
{
Log.Trace("group in movement");
return;
}
}

if (distanceFromPlayers != 0)
{
var volume = group.GetWorldAABB();
Expand Down
11 changes: 11 additions & 0 deletions Concealment/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace Concealment
public class Settings : ViewModel
{
private bool _enabled = true;
private bool _concealInMovement;
private double _concealDistance = 75000;
private int _concealInterval = 3600;
private double _revealDistance = 50000;
Expand Down Expand Up @@ -197,6 +198,16 @@ public bool Enabled
}
}

public bool ConcealInMovement
{
get => _concealInMovement;
set
{
_concealInMovement = value;
OnPropertyChanged();
}
}

public int ConcealInterval
{
get => _concealInterval;
Expand Down