Skip to content

Commit 4beba97

Browse files
committed
Asses option to ui to disable the RC keep alive action. Increaded the delay when the world is loading to give preoduction blocks more time to start producing if they want to. Added a check for refineries to see if their input inventory has anything in it to refine, to prevent them from getting concealed when they shouldnt be.
1 parent 3049d87 commit 4beba97

4 files changed

Lines changed: 42 additions & 17 deletions

File tree

‎Concealment/Concealment.csproj‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
<AppDesignerFolder>Properties</AppDesignerFolder>
88
<RootNamespace>Concealment</RootNamespace>
99
<AssemblyName>Concealment</AssemblyName>
10-
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
10+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1111
<FileAlignment>512</FileAlignment>
12+
<TargetFrameworkProfile />
1213
</PropertyGroup>
1314
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
1415
<DebugSymbols>true</DebugSymbols>

‎Concealment/ConcealmentControl.xaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<CheckBox Content="Enable Concealment" Margin="3" IsChecked="{Binding Enabled}" />
2020
<CheckBox Content="Conceal Production" ToolTip="Conceal grids with active production blocks." Margin="3" IsChecked="{Binding ConcealProduction}" />
2121
<CheckBox Content="Conceal Pirates" ToolTip="Conceal grids owned by Space Pirates." Margin="3" IsChecked="{Binding ConcealPirates}" />
22+
<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}" />
2223
<StackPanel Orientation="Horizontal">
2324
<TextBox Margin="3" Width="150" Text="{Binding ConcealDistance}" />
2425
<Label Content="Conceal Distance (meters)" Margin="3" />

‎Concealment/ConcealmentPlugin.cs‎

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Sandbox.Definitions;
1212
using Sandbox.Engine.Multiplayer;
1313
using Sandbox.Game.Entities;
14+
using Sandbox.Game.Entities.Cube;
1415
using Sandbox.Game.EntityComponents;
1516
using Sandbox.Game.Multiplayer;
1617
using Sandbox.Game.World;
@@ -108,16 +109,19 @@ public override void Update()
108109
var delayTimer = new System.Timers.Timer
109110
{
110111
AutoReset = false,
111-
Interval = 5000,
112+
Interval = 30000,
112113
};
113114

114115
delayTimer.Elapsed += (sender, args) => _ready = true;
115116
delayTimer.Start();
116-
117-
var keepAliveAction = MyAPIGateway.TerminalControls.CreateAction<IMyRemoteControl>("Concealment.KeepAlive");
118-
keepAliveAction.Action = KeepAlive;
119-
MyAPIGateway.TerminalControls.AddAction<IMyRemoteControl>(keepAliveAction);
120-
117+
118+
if (Settings.Data.RCKeepAliveAction)
119+
{
120+
var keepAliveAction = MyAPIGateway.TerminalControls.CreateAction<IMyRemoteControl>("Concealment.KeepAlive");
121+
keepAliveAction.Action = KeepAlive;
122+
MyAPIGateway.TerminalControls.AddAction<IMyRemoteControl>(keepAliveAction);
123+
}
124+
121125
MyMultiplayer.Static.ClientJoined += RevealCryoPod;
122126

123127
_init = true;
@@ -367,14 +371,21 @@ public bool IsExcluded(ConcealGroup group)
367371
if (block == null)
368372
continue;
369373

370-
if (block is IMyProductionBlock p && !Settings.Data.ConcealProduction && p.IsProducing)
371-
{
372-
Log.Debug($"{group.GridNames} exempted production ({p.CustomName} active)");
373-
exclude = true;
374-
break;
375-
}
376-
377-
if (Settings.Data.ExcludedSubtypes.Contains(block.BlockDefinition.Id.SubtypeName))
374+
if (block is MyRefinery r && !Settings.Data.ConcealProduction && !r.InputInventory.Empty())
375+
{
376+
Log.Debug($"{group.GridNames} exempted refinery ({r.CustomName} active)");
377+
exclude = true;
378+
break;
379+
}
380+
381+
if (block is MyProductionBlock p && !Settings.Data.ConcealProduction && p.IsProducing)
382+
{
383+
Log.Debug($"{group.GridNames} exempted assembler ({p.CustomName} active)");
384+
exclude = true;
385+
break;
386+
}
387+
388+
if (Settings.Data.ExcludedSubtypes.Contains(block.BlockDefinition.Id.SubtypeName))
378389
{
379390
Log.Debug($"{group.GridNames} exempted subtype {block.BlockDefinition.Id.SubtypeName}");
380391
exclude = true;

‎Concealment/Settings.cs‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ public class Settings : ViewModel
2323
private int _revealInterval = 60;
2424
private bool _concealProduction;
2525
private bool _concealPirates;
26+
private bool _keepAliveAction;
2627

27-
private double _dynamicConcealQueryInterval = 15;
28+
29+
private double _dynamicConcealQueryInterval = 15;
2830
private double _dynamicConcealScanInterval = 2;
2931

3032
/// <summary>
@@ -252,5 +254,15 @@ public bool ConcealPirates
252254
OnPropertyChanged();
253255
}
254256
}
255-
}
257+
258+
public bool RCKeepAliveAction
259+
{
260+
get => _keepAliveAction;
261+
set
262+
{
263+
_keepAliveAction = value;
264+
OnPropertyChanged();
265+
}
266+
}
267+
}
256268
}

0 commit comments

Comments
 (0)