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
46 changes: 39 additions & 7 deletions AdvancedHighlighting/AdvancedHighlighting.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="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand All @@ -9,18 +9,20 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AdvancedHighlighting</RootNamespace>
<AssemblyName>AdvancedHighlighting</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>true</Optimize>
<OutputPath>bin\BZ\</OutputPath>
<DefineConstants>BZ</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -30,6 +32,12 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'BZ|AnyCPU'">
<OutputPath>bin\BZ\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'SN|AnyCPU'">
<OutputPath>bin\SN\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony20">
<HintPath>D:\SteamLibrary\SteamApps\common\SubnauticaZero\BepInEx\core\0Harmony20.dll</HintPath>
Expand All @@ -47,6 +55,9 @@
<Reference Include="QModInstaller">
<HintPath>D:\SteamLibrary\SteamApps\common\SubnauticaZero\BepInEx\plugins\QModManager\QModInstaller.dll</HintPath>
</Reference>
<Reference Include="SMLHelper">
<HintPath>D:\SteamLibrary\steamapps\common\SubnauticaZero\QMods\SMLHelper_BZ\SMLHelper.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
Expand Down Expand Up @@ -303,15 +314,36 @@
<Compile Include="Patches\SaveLoadManager_Patch.cs" />
<Compile Include="Patches\uGUI_OptionsPanel_Patch.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Settings.cs" />
<Compile Include="Patches\uGUI_Pings_Patch.cs" />
<Compile Include="Utils.cs" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy /Y "$(TargetPath)" "D:\SteamLibrary\SteamApps\common\SubnauticaZero\QMods\AdvancedHighlighting\AdvancedHighlighting.dll"</PostBuildEvent>
<PostBuildEvent>if $(ConfigurationName) == BZ (
mkdir "D:\SteamLibrary\steamapps\common\SubnauticaZero\QMods\$(TargetName)"
xcopy /Y "$(TargetPath)" "D:\SteamLibrary\steamapps\common\SubnauticaZero\QMods\$(TargetName)"
copy /Y "$(ProjectDir)\mod_BZ.json" "D:\SteamLibrary\steamapps\common\SubnauticaZero\QMods\$(TargetName)\mod.json"
del "D:\SteamLibrary\steamapps\common\SubnauticaZero\qmodmanager_log-SubnauticaZero.txt" )

if $(ConfigurationName) == SN (
mkdir "D:\SteamLibrary\steamapps\common\Subnautica\QMods\$(TargetName)"
xcopy /Y "$(TargetPath)" "D:\SteamLibrary\steamapps\common\Subnautica\QMods\$(TargetName)"
copy /Y "$(ProjectDir)\mod_SN.json" "D:\SteamLibrary\steamapps\common\Subnautica\QMods\$(TargetName)\mod.json"
del "D:\SteamLibrary\steamapps\common\Subnautica\qmodmanager_log-Subnautica.txt")</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>
144 changes: 78 additions & 66 deletions AdvancedHighlighting/HighlightEnum.cs
Original file line number Diff line number Diff line change
@@ -1,73 +1,85 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#if SN
#elif BZ
#endif

namespace AdvancedHighlighting
{
public enum Highlight
public enum Highlight
{
ScannableItems,
ScannableFragments,
ScannedFragments,
AnythingElse,

Pickupable,
PickupableCreatures,
PickupableResource,
BreakableResource,
Interactables,
StoryItems,
JukeboxDisk,
SealedDoor,
GrownPlant,
Bladderfish,
CreatureEgg,
BaseLadder,
LaserCutObject
}
public static class HighlightExtenstions
{
private static readonly Dictionary<Highlight, string> highlightToText = new Dictionary<Highlight, string>()
{
[Highlight.ScannableItems] = "Scannable Items",
[Highlight.ScannableFragments] = "Scannable Fragments",
[Highlight.ScannedFragments] = "Already Scanned Fragments",
[Highlight.AnythingElse] = "Anything Else",

[Highlight.Pickupable] = "Pickupable Items",
[Highlight.PickupableCreatures] = "Pickupable Creatures",
[Highlight.PickupableResource] = "Pickupable Resources",
[Highlight.BreakableResource] = "Breakable Outcrops",
[Highlight.Interactables] = "Interactables",
[Highlight.StoryItems] = "PDA Logs",
[Highlight.JukeboxDisk] = "Jukebox Disks",
[Highlight.SealedDoor] = "Sealed Ship Doors",
[Highlight.GrownPlant] = "Grown Plant",
[Highlight.Bladderfish] = "Bladder Fish",
[Highlight.CreatureEgg] = "Creature Egg",
[Highlight.BaseLadder] = "Base Ladder",
[Highlight.LaserCutObject] = "Laser Cut Object",
};
private static readonly Dictionary<Highlight, Type> highlightToType = new Dictionary<Highlight, Type>()
{
Pickupable,
PickupableCreatures,
PickupableResource,
BreakableResource,
ScannableItems,
ScannableFragments,
ScannedFragments,
Interactables,
StoryItems,
DiskItems,
SealedDoor,
FruitAndVeg,
OxygenFish,
AnythingElse
}
public static class HighlightExtenstions
[Highlight.Pickupable] = typeof(Pickupable),
[Highlight.PickupableCreatures] = typeof(Creature),
[Highlight.PickupableResource] = typeof(ResourceTracker),
[Highlight.BreakableResource] = typeof(BreakableResource),
[Highlight.Interactables] = typeof(HandTarget),
[Highlight.StoryItems] = typeof(StoryHandTarget),
[Highlight.JukeboxDisk] = typeof(JukeboxDisk),
[Highlight.SealedDoor] = typeof(StarshipDoor),
[Highlight.GrownPlant] = typeof(GrownPlant),
[Highlight.Bladderfish] = typeof(Bladderfish),
[Highlight.CreatureEgg] = typeof(CreatureEgg),
[Highlight.BaseLadder] = typeof(BaseLadder),
[Highlight.LaserCutObject] = typeof(Sealed),
};
private static readonly List<Highlight> notComponentHighlights = new List<Highlight>()
{
private static readonly Dictionary<Highlight, string> highlightToText = new Dictionary<Highlight, string>()
{
[Highlight.Pickupable] = "Pickupable Items",
[Highlight.PickupableCreatures] = "Pickupable Creatures",
[Highlight.PickupableResource] = "Pickupable Resources",
[Highlight.BreakableResource] = "Breakable Outcrops",
[Highlight.ScannableItems] = "Scannable Items",
[Highlight.ScannableFragments] = "Scannable Fragments",
[Highlight.ScannedFragments] = "Already Scanned Fragments",
[Highlight.Interactables] = "Interactables",
[Highlight.StoryItems] = "PDA Logs",
[Highlight.DiskItems] = "Jukebox Disks",
[Highlight.SealedDoor] = "Sealed Ship Doors",
[Highlight.FruitAndVeg] = "Fruits and Vegetables",
[Highlight.OxygenFish] = "Oxygen Fish",
[Highlight.AnythingElse] = "Anything Else",
};
private static readonly Dictionary<Highlight, Type> highlightToType = new Dictionary<Highlight, Type>() {
[Highlight.Pickupable] = typeof(Pickupable),
[Highlight.PickupableCreatures] = typeof(Creature),
[Highlight.PickupableResource] = typeof(ResourceTracker),
[Highlight.BreakableResource] = typeof(BreakableResource),
[Highlight.Interactables] = typeof(GenericHandTarget),
[Highlight.StoryItems] = typeof(StoryHandTarget),
[Highlight.DiskItems] = typeof(JukeboxDisk),
[Highlight.SealedDoor] = typeof(StarshipDoor),
[Highlight.FruitAndVeg] = typeof(PickPrefab),
[Highlight.OxygenFish] = typeof(TitanHolefishOxygen),
};
private static readonly List<Highlight> notComponentHighlights = new List<Highlight>()
{
Highlight.ScannableItems,
Highlight.ScannableFragments,
Highlight.ScannedFragments,
Highlight.AnythingElse
};
public static bool IsPressent(this Highlight highlight, UnityEngine.Behaviour behaviour) =>
highlight.IsComponent() && behaviour.TryGetComponent(highlight.GetComponentType(), out _);
public static bool IsPressentAndActive(this Highlight highlight, UnityEngine.Behaviour behaviour) =>
highlight.IsComponent() && highlight.IsActive() && behaviour.TryGetComponent(highlight.GetComponentType(), out _);
public static bool IsActive(this Highlight highlight) => Settings.GetInstance().IsHighlightActive(highlight);
public static bool IsComponent(this Highlight highlight) => !notComponentHighlights.Contains(highlight);
public static string GetName(this Highlight highlight) => highlightToText.TryGetValue(highlight, out string name) ? name : null;
public static Type GetComponentType(this Highlight highlight) => highlightToType.TryGetValue(highlight, out Type type) ? type : null;
}
Highlight.ScannableItems,
Highlight.ScannableFragments,
Highlight.ScannedFragments,
Highlight.AnythingElse
};
public static bool IsPressent(this Highlight highlight, UnityEngine.Behaviour behaviour) =>
highlight.IsComponent() && behaviour.TryGetComponent(highlight.GetComponentType(), out _);
public static bool IsPressentAndActive(this Highlight highlight, UnityEngine.Behaviour behaviour) =>
highlight.IsComponent() && highlight.IsActive() && behaviour.TryGetComponent(highlight.GetComponentType(), out _);
public static bool IsActive(this Highlight highlight) => Settings.GetInstance().IsHighlightActive(highlight);
public static bool IsComponent(this Highlight highlight) => !notComponentHighlights.Contains(highlight);
public static string GetName(this Highlight highlight) => highlightToText.TryGetValue(highlight, out string name) ? name : null;
public static Type GetComponentType(this Highlight highlight) => highlightToType.TryGetValue(highlight, out Type type) ? type : null;
}
}
29 changes: 15 additions & 14 deletions AdvancedHighlighting/HighlightingMod.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
using HarmonyLib;
using HarmonyLib;
using QModManager.API.ModLoading;
using SMLHelper.V2.Handlers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#if SN
#elif BZ
#endif

namespace AdvancedHighlighting
{
[QModCore]
public static class HighlightingMod
[QModCore]

public static class HighlightingMod
{
[QModPatch]
public static void InitMod()
{
[QModPatch]
public static void InitMod()
{
Console.WriteLine("[AdvancedHighlighting] Start Patching...");
Harmony harmony = new Harmony("net.ogmods.highlighting");
harmony.PatchAll();
}
Console.WriteLine("[AdvancedHighlighting] Start Patching...");
Harmony harmony = new Harmony("net.ogmods.highlighting");
harmony.PatchAll();
}
}
}
Loading