diff --git a/Project-Aurora/Project-Aurora/Profiles/Subnautica/Control_Subnautica.xaml.cs b/Project-Aurora/Project-Aurora/Profiles/Subnautica/Control_Subnautica.xaml.cs index 4caa0df11..f635d36f4 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Subnautica/Control_Subnautica.xaml.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Subnautica/Control_Subnautica.xaml.cs @@ -55,7 +55,7 @@ private void GameEnabled_Checked(object sender, RoutedEventArgs e) private void GoToQModManagerPage_Click(object sender, RoutedEventArgs e) { - Process.Start(@"https://www.nexusmods.com/subnautica/mods/16/"); + Process.Start(@"https://www.nexusmods.com/subnautica/mods/201"); } private void GoToModDownloadPage_Click(object sender, RoutedEventArgs e) @@ -72,13 +72,11 @@ private void InGameCh_Checked(object sender, RoutedEventArgs e) { if ((sender as CheckBox).IsChecked == true) { - State.GameState.GameState = 2; - State.GameState.InGame = true; + State.GameState.State = GSI.Nodes.GameState.Playing; } else { - State.GameState.GameState = 0; - State.GameState.InGame = false; + State.GameState.State = GSI.Nodes.GameState.Menu; } } diff --git a/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/GameState_Subnautica.cs b/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/GameState_Subnautica.cs index d81eaf5ed..7848a38c9 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/GameState_Subnautica.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/GameState_Subnautica.cs @@ -15,6 +15,7 @@ public class GameState_Subnautica : GameState { private NotificationNode _Notification; private WorldNode _World; private PlayerNode _Player; + private VehicleSubNode _VehicleSub; /// /// Provider node provides information about the data source so that Aurora can update the correct gamestate. @@ -73,6 +74,19 @@ public PlayerNode Player { } } + /// + /// VehicleSub node provides information about the Vehicle (e.g. Power and light status). + /// + public VehicleSubNode VehicleSub + { + get + { + if (_VehicleSub == null) + _VehicleSub = new VehicleSubNode(_ParsedData["vehicle_sub"]?.ToString() ?? ""); + return _VehicleSub; + } + } + /// /// Creates a default GameState_Subnautica instance. /// diff --git a/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/GameStateNode.cs b/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/GameStateNode.cs index 0cf2eab17..09eeb27b1 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/GameStateNode.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/GameStateNode.cs @@ -5,24 +5,20 @@ using System.Threading.Tasks; namespace Aurora.Profiles.Subnautica.GSI.Nodes { + public enum GameState + { + Menu = 0, + Loading = 1, + Playing = 2, + Paused = 3 + } + public class GameStateNode : Node { - public int GameState; - /* - 0 = Menu - 1 = Loading - 2 = Playing - */ - public bool InGame; - public bool InMenu; - public bool loading; + public GameState State; internal GameStateNode(string json) : base(json) { - - GameState = GetInt("game_state"); - InGame = GameState == 2; - InMenu = GameState == 0; - loading = GameState == 1; + State = (GameState)GetInt("game_state"); } } } diff --git a/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/PlayerNode.cs b/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/PlayerNode.cs index 9fdb69a2a..6018b16a7 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/PlayerNode.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/PlayerNode.cs @@ -1,22 +1,50 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Aurora.Profiles.Subnautica.GSI.Nodes { + public enum PDAState + { + Opened = 0, + Closed = 1, + Opening = 2, + Closing = 3 + } + + public enum MotorMode + { + Walk = 0, + Dive = 1, + Seaglide = 2, + Vehicle = 3, + Mech = 4, + Run = 5 + } + + public enum Modes + { + Normal = 0, + Piloting = 1, + LockedPiloting = 2, + Sitting = 3 + } + + public enum GameModes + { + Survival = 0, + Freedom = 1, + Hardcore = 2, + Creative = 3, + None = 4 + } + public class PlayerNode : Node { public string Biom; public bool InLifePod; - //public string type; //Base, Cyclops, Seamoth or Prawn - public string Type; - public bool InBase; - public bool InCyclops; - public bool InSeamoth; - public bool InPrawn; - //public int Depth; //public int SurfaceDepth; //always 0? public int DepthLevel; @@ -29,53 +57,19 @@ public class PlayerNode : Node { public int OxygenCapacity; public int OxygenAvailable; - public int PDAState; - /* - Opened = 0 - Closed = 1 - Opening = 2 - Closing = 3 - */ - public bool PDAopened; - public bool PDAclosed; - public bool PDAopening; - public bool PDAclosing; - public bool IsSwimming; //Seagliding does also count :) - public int MotorMode; - /* - Walk = 0 - Dive = 1 - Seaglide = 2 - Vehicle = 3 - Mech = 4 - Run = 5 - */ - public bool IsSeagliding; - - public int Mode; - /* - Normal = 0 - Piloting = 1 - LockedPiloting = 2 - Sitting = 3 - */ - public bool IsPiloting; + public PDAState PDAState; + public MotorMode MotorMode; + public Modes Mode; + public GameModes GameMode; - internal PlayerNode(string json) : base(json) { + internal PlayerNode(string json) : base(json) + { Biom = GetString("biom"); InLifePod = Biom == "Lifepod"; - //Base, Cyclops, Seamoth or Prawn - Type = GetString("type"); - - InBase = Type == "Base"; - InCyclops = Type == "Cyclops"; - InSeamoth = Type == "Seamoth"; - InPrawn = Type == "Prawn"; - //SurfaceDepth = GetInt("surface_depth"); DepthLevel = GetInt("depth_level"); @@ -94,21 +88,12 @@ internal PlayerNode(string json) : base(json) { OxygenAvailable = GetInt("oxygen_available"); - PDAState = GetInt("pda_state"); - - PDAopened = PDAState == 0; - PDAclosed = PDAState == 1; - PDAopening = PDAState == 2; - PDAclosing = PDAState == 3; - IsSwimming = GetBool("is_in_water_for_swimming"); - MotorMode = GetInt("motor_mode"); - - IsSeagliding = MotorMode == 2; - - Mode = GetInt("mode"); - IsPiloting = Mode == 1 || Mode == 2; // Mode 1 = Piloting/Mode 2 = locked Piloting + PDAState = (PDAState)GetInt("pda_state"); + MotorMode = (MotorMode)GetInt("motor_mode"); + Mode = (Modes)GetInt("mode"); + GameMode = (GameModes)GetInt("game_mode"); } } diff --git a/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/VehicleSubNode.cs b/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/VehicleSubNode.cs new file mode 100644 index 000000000..76bc7d3bf --- /dev/null +++ b/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/VehicleSubNode.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Aurora.Profiles.Subnautica.GSI.Nodes { + public enum VehicleSubs + { + None = -1, + Base = 0, + Cyclops = 1, + Seamoth = 2, + Prawn = 3 + } + public enum LightingStates + { //Meaning in Game: + OnNoDanger = 0, //Operational = 0 + OnDanger = 1, //Danger = 1 + Off = 2 //Damaged = 2 + } + public enum CyclopsMotorModes + { + Slow = 0, + Standard = 1, + Flank = 2 + } + public class VehicleSubNode : Node { + public VehicleSubs In; + + public int Power; + public int MaxPower; + + public bool FloodlightEnabled; + + public int VehicleHealth; + public int VehicleMaxHealth; + + public int CrushDepth; + + public LightingStates LightState; + + public bool CyclopsWarning; + public bool CyclopsFireSuppression; + public bool CyclopsSilentRunning; + + public CyclopsMotorModes CyclopsMotorMode; + + public bool CyclopsEngineOn; + public float CyclopsNoice; + + public float PrawnThrust; + + internal VehicleSubNode(string json) : base(json) { + In = (VehicleSubs)GetInt("type"); + + Power = GetInt("power"); + MaxPower = GetInt("max_power"); + + FloodlightEnabled = GetBool("floodlight"); + + LightState = (LightingStates)GetInt("lightstate"); + + VehicleHealth = GetInt("vehicle_health"); + VehicleMaxHealth = GetInt("vehicle_max_health"); + CrushDepth = GetInt("crush_depth"); + + CyclopsWarning = GetBool("cyclops_warning"); + CyclopsFireSuppression = GetBool("cyclops_fire_suppression_state"); + CyclopsSilentRunning = GetBool("cyclops_silent_running"); + + CyclopsMotorMode = (CyclopsMotorModes)GetInt("cyclops_motor_mode"); + + CyclopsEngineOn = GetBool("cyclops_engine_on"); + CyclopsNoice = GetFloat("cyclops_noice_percent"); + + PrawnThrust = GetFloat("thrust"); + } + } +} diff --git a/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/WorldNode.cs b/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/WorldNode.cs index c4362dec2..8a0c0785c 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/WorldNode.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Subnautica/GSI/Nodes/WorldNode.cs @@ -8,6 +8,7 @@ namespace Aurora.Profiles.Subnautica.GSI.Nodes { public class WorldNode : Node { public float DayScalar; + public float daylight_scaler; //public bool IsDay; internal WorldNode(string json) : base(json) { @@ -17,6 +18,7 @@ internal WorldNode(string json) : base(json) { else IsDay = false; */ + this.daylight_scaler = GetFloat("daylight_scaler"); } } } diff --git a/Project-Aurora/Project-Aurora/Profiles/Subnautica/SubnauticaProfile.cs b/Project-Aurora/Project-Aurora/Profiles/Subnautica/SubnauticaProfile.cs index 001832f69..1d27d6481 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Subnautica/SubnauticaProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Subnautica/SubnauticaProfile.cs @@ -3,6 +3,9 @@ //using Aurora.Profiles.Subnautica.Layers; using Aurora.Settings; using Aurora.Settings.Layers; +using Aurora.Settings.Overrides; +using Aurora.Settings.Overrides.Logic; +using Aurora.Settings.Overrides.Logic.Builder; using System; using System.Collections.Generic; using System.Drawing; @@ -11,61 +14,78 @@ using System.Threading.Tasks; using DK = Aurora.Devices.DeviceKeys; -namespace Aurora.Profiles.Subnautica { +namespace Aurora.Profiles.Subnautica +{ - public class SubnauticaProfile : ApplicationProfile { + public class SubnauticaProfile : ApplicationProfile + { public SubnauticaProfile() : base() { } - - public override void Reset() { + + public override void Reset() + { base.Reset(); Layers = new System.Collections.ObjectModel.ObservableCollection() { - new Layer("PDA Open", new ConditionalLayerHandler{ - Properties = new ConditionalLayerProperties + new Layer("PDA Open", new SolidFillLayerHandler + { + Properties = new SolidFillLayerHandlerProperties { - _ConditionPath = "Player/PDAopened", - _PrimaryColor = Color.FromArgb(170,0,0,0), - _SecondaryColor = Color.FromArgb(0,0,0,0), - _Sequence = new KeySequence(new FreeFormObject(0, -50, 980, 280)) + _PrimaryColor = Color.FromArgb(170,0,0,0) } - } + }, + new OverrideLogicBuilder() + .SetLookupTable("_Enabled", new OverrideLookupTableBuilder() + .AddEntry(false, new BooleanNot(new BooleanGSIEnum("Player/PDAState", GSI.Nodes.PDAState.Opened))) + ) ), - new Layer("PDA Close Animation", new AnimationLayerHandler { - Properties = new AnimationLayerHandlerProperties { + + new Layer("PDA Close Animation", new AnimationLayerHandler + { + Properties = new AnimationLayerHandlerProperties + { _AnimationDuration = .5f, _AnimationRepeat = 1, - _AnimationMix = new EffectsEngine.Animations.AnimationMix(new []{ + _AnimationMix = new EffectsEngine.Animations.AnimationMix(new[]{ new EffectsEngine.Animations.AnimationTrack("Rectangle", 1) .SetFrame(0, new EffectsEngine.Animations.AnimationFilledRectangle(new Rectangle(0, 0, 1000, 60), Color.FromArgb(170, 0, 0, 0))) .SetFrame(.5f, new EffectsEngine.Animations.AnimationFilledRectangle(new Rectangle(0, 70, 1000, 60), Color.FromArgb(170, 0, 0, 0))) - }), - _TriggerMode = AnimationTriggerMode.OnTrue, - _TriggerPath = "Player/PDAclosing", + }), + _TriggerMode = AnimationTriggerMode.OnEvaluatableTrue, + _EvaluatableTrigger = new BooleanGSIEnum("Player/PDAState", GSI.Nodes.PDAState.Closing), _StackMode = AnimationStackMode.Ignore, _Sequence = new KeySequence(new FreeFormObject(0, -50, 980, 280)) } }), - new Layer("PDA Open Animation", new AnimationLayerHandler { - Properties = new AnimationLayerHandlerProperties { + new Layer("PDA Open Animation", new AnimationLayerHandler + { + Properties = new AnimationLayerHandlerProperties + { _AnimationDuration = .5f, _AnimationRepeat = 1, - _AnimationMix = new EffectsEngine.Animations.AnimationMix(new []{ + _AnimationMix = new EffectsEngine.Animations.AnimationMix(new[]{ new EffectsEngine.Animations.AnimationTrack("Rectangle", 1) .SetFrame(0, new EffectsEngine.Animations.AnimationFilledRectangle(new Rectangle(0, 70, 1000, 60), Color.FromArgb(170, 0, 0, 0))) .SetFrame(.5f, new EffectsEngine.Animations.AnimationFilledRectangle(new Rectangle(0, 0, 1000, 60), Color.FromArgb(170, 0, 0, 0))) }), - _TriggerMode = AnimationTriggerMode.OnTrue, - _TriggerPath = "Player/PDAopening", + _TriggerMode = AnimationTriggerMode.OnEvaluatableTrue, + _EvaluatableTrigger = new BooleanGSIEnum("Player/PDAState", GSI.Nodes.PDAState.Opening), _StackMode = AnimationStackMode.Ignore, _Sequence = new KeySequence(new FreeFormObject(0, -50, 980, 280)) } - }), + }, + new OverrideLogicBuilder() + .SetLookupTable("_Enabled", new OverrideLookupTableBuilder() + .AddEntry(false, new BooleanGSIEnum("Player/PDAState", GSI.Nodes.PDAState.Opened)) + ) + ), - new Layer("Health", new PercentLayerHandler() { - Properties = new PercentLayerHandlerProperties() { + new Layer("Health", new PercentLayerHandler() + { + Properties = new PercentLayerHandlerProperties() + { _VariablePath = "Player/Health", _MaxVariablePath = "100", _PrimaryColor = Color.FromArgb(255, 0, 0), @@ -77,8 +97,10 @@ public override void Reset() { } }), - new Layer("Food", new PercentLayerHandler() { - Properties = new PercentLayerHandlerProperties() { + new Layer("Food", new PercentLayerHandler() + { + Properties = new PercentLayerHandlerProperties() + { _VariablePath = "Player/Food", _MaxVariablePath = "100", _PrimaryColor = Color.FromArgb(139, 69, 19), @@ -90,8 +112,10 @@ public override void Reset() { } }), - new Layer("Water", new PercentLayerHandler() { - Properties = new PercentLayerHandlerProperties() { + new Layer("Water", new PercentLayerHandler() + { + Properties = new PercentLayerHandlerProperties() + { _VariablePath = "Player/Water", _MaxVariablePath = "100", _PrimaryColor = Color.FromArgb(0, 0, 255), @@ -103,8 +127,10 @@ public override void Reset() { } }), - new Layer("Oxygen", new PercentLayerHandler() { - Properties = new PercentLayerHandlerProperties() { + new Layer("Oxygen", new PercentLayerHandler() + { + Properties = new PercentLayerHandlerProperties() + { _VariablePath = "Player/OxygenAvailable", _MaxVariablePath = "Player/OxygenCapacity", _PrimaryColor = Color.FromArgb(0, 170, 65), @@ -116,9 +142,12 @@ public override void Reset() { } }), - new Layer("Background", new PercentGradientLayerHandler() { - Properties = new PercentGradientLayerHandlerProperties { - _Gradient = new EffectBrush() { + new Layer("Background", new PercentGradientLayerHandler() + { + Properties = new PercentGradientLayerHandlerProperties + { + _Gradient = new EffectBrush() + { type = EffectBrush.BrushType.Linear, start = new PointF(0, 0), end = new PointF(1, 0), @@ -138,6 +167,6 @@ public override void Reset() { }; } - + } } diff --git a/Project-Aurora/Project-Aurora/Project-Aurora.csproj b/Project-Aurora/Project-Aurora/Project-Aurora.csproj index 9d5bee45e..7cc5141f6 100644 --- a/Project-Aurora/Project-Aurora/Project-Aurora.csproj +++ b/Project-Aurora/Project-Aurora/Project-Aurora.csproj @@ -1,4 +1,4 @@ - + @@ -397,6 +397,7 @@ +