Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Subnautica support #1532

Closed
wants to merge 4 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public class GameState_Subnautica : GameState<GameState_Subnautica> {
private NotificationNode _Notification;
private WorldNode _World;
private PlayerNode _Player;
private VehicleSubNode _VehicleSub;


/// <summary>
/// Provider node provides information about the data source so that Aurora can update the correct gamestate.
Expand Down Expand Up @@ -73,6 +75,19 @@ public PlayerNode Player {
}
}

/// <summary>
/// VehicleSub node provides information about the vehicle (Seamoth and Prawn) or sub (Base and Cyclops)).
/// </summary>
public VehicleSubNode VehicleSub
{
get
{
if (_VehicleSub == null)
_VehicleSub = new VehicleSubNode(_ParsedData["vehicle_sub"]?.ToString() ?? "");
return _VehicleSub;
}
}

/// <summary>
/// Creates a default GameState_Subnautica instance.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,28 @@ namespace Aurora.Profiles.Subnautica.GSI.Nodes {
public class GameStateNode : Node<GameStateNode> {

public int GameState;

/*
0 = Menu
1 = Loading
2 = Playing
*/
public bool InGame;
public bool InMenu;
public bool loading;
public bool Playing;
public bool Paused;

public bool InGame;

internal GameStateNode(string json) : base(json) {

GameState = GetInt("game_state");
InGame = GameState == 2;
InMenu = GameState == 0;
loading = GameState == 1;
Playing = GameState == 2;
Paused = GameState == 3;

InGame = Playing || Paused;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,49 @@ namespace Aurora.Profiles.Subnautica.GSI.Nodes {
public class PlayerNode : Node<PlayerNode> {

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 bool InSafeShallows;
public bool InLostRiver;
public bool InKelpForest;
public bool InGrassyPlateus;
public bool InUnderwaterIslands;
public bool InFloatingIsland;
public bool InLavaZone;
public bool InInactiveLavaZone;
public bool InMushroomForest;
public bool InBloodKelp;
public bool InSandDunes;
public bool InGrandReef;
public bool InBulbZone;
public bool InMountains;
public bool InSparseReef;
public bool InJellyshroom;
public bool InCrashZone;
public bool InCragField;

//public int Depth;
//public int SurfaceDepth; //always 0?
public int Depth;
public int DepthLevel;

public int Health;
public int Food;
public int Water;

public int GameMode;
public bool InSurvivalMode;
public bool InCreativeMode;
public bool InFreedomMode;
public bool InHardcoreMode;
/*
Survival = 0,
Freedom = 1,
Hardcore = 2,
Creative = 3,
None = 4
*/

public bool CanBreathe;
public int OxygenCapacity;
public int OxygenAvailable;
Expand Down Expand Up @@ -52,7 +78,12 @@ public class PlayerNode : Node<PlayerNode> {
Mech = 4
Run = 5
*/
//public bool IsWalking; //when walking? when walking in Base or Cyclops!
//public bool IsDiving; //Seagliding does not count
public bool IsSeagliding;
//public bool IsInVehicle;
//public bool IsInMech;
//public bool IsRunning; //is also when in Water?

public int Mode;
/*
Expand All @@ -68,21 +99,39 @@ internal PlayerNode(string json) : base(json) {

InLifePod = Biom == "Lifepod";

//Base, Cyclops, Seamoth or Prawn
Type = GetString("type");

InBase = Type == "Base";
InCyclops = Type == "Cyclops";
InSeamoth = Type == "Seamoth";
InPrawn = Type == "Prawn";
InSafeShallows = Biom == "safe" || Biom == "Lifepod";
InLostRiver = Biom == "lostriver";
InKelpForest = Biom == "kelpforest";
InGrassyPlateus = Biom == "grassy";
InUnderwaterIslands = Biom == "underwaterislands";
InFloatingIsland = Biom == "floatingisland";
InLavaZone = Biom == "lava";
InInactiveLavaZone = Biom == "ilz";
InMushroomForest = Biom == "mushroom";
InBloodKelp = Biom == "bloodkelp";
InSandDunes = Biom == "dunes";
InGrandReef = Biom == "grandreef";
InBulbZone = Biom == "koosh";
InMountains = Biom == "mountains";
InSparseReef = Biom == "sparse";
InJellyshroom = Biom == "jellyshroom";
InCrashZone = Biom == "crash";
InCragField = Biom == "crag";

//SurfaceDepth = GetInt("surface_depth");
DepthLevel = GetInt("depth_level");
Depth = DepthLevel >= 0 ? 0 : Math.Abs(DepthLevel);

Health = GetInt("health");
Food = GetInt("food");
Water = GetInt("water");

GameMode = GetInt("game_mode");
InSurvivalMode = GameMode == 0;
InFreedomMode = GameMode == 1;
InHardcoreMode = GameMode == 2;
InCreativeMode = GameMode == 3;

CanBreathe = GetBool("can_breathe");

if (GetInt("oxygen_capacity") >= 1)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Aurora.Profiles.Subnautica.GSI.Nodes {
public class VehicleSubNode : Node<VehicleSubNode> {

//public string type; //Base, Cyclops, Seamoth or Prawn
public string Type;

//General Vehicle/Sub Variables:
public bool InBase;
public bool InCyclops;
public bool InSeamoth;
public bool InPrawn;
public float Power;
public float MaxPower;
public bool FloodlightOn;
public float VehicleHealth;
public float VehicleMaxHealth;
public float CrushDepth;

//General Sub Variables:
public int LightState;
public bool LightOn;
public bool LightOnDanger;
public bool LightOff;

//Cyclops Variables:
public bool CyclopsWarning;
public bool CyclopsFireSuppressionActive;
public bool CyclopsSilentRunning;
public int CyclopsMotorMode;

public bool CyclopsMotorSlow { get; private set; }
public bool CyclopsMotorNormal { get; private set; }
public bool CyclopsMotorFlank { get; private set; }

public bool CyclopsEngineOn;

public float CyclopsNoice;

//Base Variables:

//Vehicle Variables:
public float VehicleTemperatur;

internal VehicleSubNode(string json) : base(json) {

//Base, Cyclops, Seamoth or Prawn
Type = GetString("type");

//General Vehicle/Sub Variables:
InBase = Type == "Base";
InCyclops = Type == "Cyclops";
InSeamoth = Type == "Seamoth";
InPrawn = Type == "Prawn";

Power = GetFloat("power");
MaxPower = GetFloat("max_power");

FloodlightOn = GetBool("floodlight");

VehicleHealth = GetFloat("vehicle_health");
VehicleMaxHealth = GetFloat("vehicle_max_health");
CrushDepth = GetFloat("crushDepth");

//General Sub Variables:
LightState = GetInt("lightstate"); // On = 0, On with Danger = 1, Off = 2
LightOn = LightState == 0;
LightOnDanger = LightState == 1;
LightOff = LightState == 2;


//Cyclops Variables:
CyclopsWarning = GetBool("cyclops_warning");
CyclopsFireSuppressionActive = GetBool("cyclops_fire_suppression_state");
CyclopsSilentRunning = GetBool("cyclops_silent_running");

CyclopsMotorMode = GetInt("cyclops_motor_mode");
CyclopsMotorSlow = CyclopsMotorMode == 0;
CyclopsMotorNormal = CyclopsMotorMode == 1;
CyclopsMotorFlank = CyclopsMotorMode == 2;

CyclopsEngineOn = GetBool("cyclops_engine_on");

CyclopsNoice = GetFloat("cyclops_noice_percent");

//Base Variables:

//Vehicle Variables:
VehicleTemperatur = GetFloat("temperatur");

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ namespace Aurora.Profiles.Subnautica.GSI.Nodes {
public class WorldNode : Node<WorldNode> {

public float DayScalar;
public float DayLightScalar;
//public bool IsDay;

internal WorldNode(string json) : base(json) {
DayScalar = GetFloat("day_scalar");
DayLightScalar = GetFloat("daylight_scaler");
/*if (DayScalar >= 0.15 && DayScalar <= 0.89)
IsDay = true;
else
Expand Down
3 changes: 2 additions & 1 deletion Project-Aurora/Project-Aurora/Project-Aurora.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -575,6 +575,7 @@
<Compile Include="Profiles\RocketLeague\RocketLeagueProfile.cs" />
<Compile Include="Profiles\Subnautica\Control_Subnautica.xaml.cs" />
<Compile Include="Profiles\Subnautica\GSI\GameState_Subnautica.cs" />
<Compile Include="Profiles\Subnautica\GSI\Nodes\VehicleSubNode.cs" />
<Compile Include="Profiles\Subnautica\GSI\Nodes\GameStateNode.cs" />
<Compile Include="Profiles\Subnautica\GSI\Nodes\NotificationNode.cs" />
<Compile Include="Profiles\Subnautica\GSI\Nodes\PlayerNode.cs" />
Expand Down