Skip to content

Commit d7bca12

Browse files
authored
Merge pull request #1 from VELD-Dev/nautilus
Update to Nautilus
2 parents c2c5572 + a7a5063 commit d7bca12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+871
-536
lines changed

AlterraWeaponry/AlterraWeaponry.csproj

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@
3535
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'BZ|AnyCPU' ">
3636
<OutputPath>bin\BZ\</OutputPath>
3737
<PlatformTarget>AnyCPU</PlatformTarget>
38+
<DefineConstants>BZ; BELOWZERO; BELOW_ZERO;</DefineConstants>
39+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
3840
</PropertyGroup>
3941
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'SN1|AnyCPU' ">
4042
<OutputPath>bin\SN1\</OutputPath>
43+
<DefineConstants>SN1; SN; SUBNAUTICA;</DefineConstants>
4144
</PropertyGroup>
4245
<ItemGroup>
4346
<Reference Include="0Harmony">
4447
<HintPath>B:\SteamLibrary\steamapps\common\SubnauticaZero\BepInEx\core\0Harmony.dll</HintPath>
4548
</Reference>
46-
<Reference Include="Assembly-CSharp">
47-
<HintPath>B:\SteamLibrary\steamapps\common\SubnauticaZero\SubnauticaZero_Data\Managed\Assembly-CSharp.dll</HintPath>
48-
</Reference>
4949
<Reference Include="Assembly-CSharp-firstpass">
5050
<HintPath>B:\SteamLibrary\steamapps\common\SubnauticaZero\SubnauticaZero_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
5151
</Reference>
@@ -55,20 +55,29 @@
5555
<Reference Include="BepInEx">
5656
<HintPath>B:\SteamLibrary\steamapps\common\SubnauticaZero\BepInEx\core\BepInEx.dll</HintPath>
5757
</Reference>
58+
<Reference Include="CuddleLibs">
59+
<HintPath>B:\SteamLibrary\steamapps\common\SubnauticaZero\BepInEx\plugins\CuddleLibs\CuddleLibs.dll</HintPath>
60+
</Reference>
5861
<Reference Include="FMODUnity">
5962
<HintPath>B:\SteamLibrary\steamapps\common\SubnauticaZero\SubnauticaZero_Data\Managed\FMODUnity.dll</HintPath>
6063
</Reference>
61-
<Reference Include="SMLHelper">
62-
<HintPath>B:\SteamLibrary\steamapps\common\SubnauticaZero\QMods\SMLHelper_BZ\SMLHelper.dll</HintPath>
64+
<Reference Include="Nautilus">
65+
<HintPath>B:\SteamLibrary\steamapps\common\SubnauticaZero\BepInEx\plugins\Nautilus\Nautilus.dll</HintPath>
6366
</Reference>
6467
<Reference Include="System" />
6568
<Reference Include="System.Core" />
69+
<Reference Include="System.IO.Compression" />
70+
<Reference Include="System.IO.Compression.FileSystem" />
6671
<Reference Include="System.Xml.Linq" />
6772
<Reference Include="System.Data.DataSetExtensions" />
6873
<Reference Include="Microsoft.CSharp" />
6974
<Reference Include="System.Data" />
7075
<Reference Include="System.Net.Http" />
7176
<Reference Include="System.Xml" />
77+
<Reference Include="Unity.Addressables, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
78+
<SpecificVersion>False</SpecificVersion>
79+
<HintPath>B:\SteamLibrary\steamapps\common\SubnauticaZero\SubnauticaZero_Data\Managed\Unity.Addressables.dll</HintPath>
80+
</Reference>
7281
<Reference Include="Unity.TextMeshPro">
7382
<HintPath>B:\SteamLibrary\steamapps\common\SubnauticaZero\SubnauticaZero_Data\Managed\Unity.TextMeshPro.dll</HintPath>
7483
</Reference>
@@ -103,39 +112,32 @@
103112
</Reference>
104113
</ItemGroup>
105114
<ItemGroup>
106-
<Compile Include="behaviours\CustomTriggerEventAssigner.cs" />
107-
<Compile Include="behaviours\ZapFunctionalityBehaviour.cs" />
108-
<Compile Include="items\PrawnSelfDefenseModule.cs" />
109-
<Compile Include="patches\ExosuitTorpedoArm_OpenTorpedoStorageExternal_Patch.cs" />
110-
<Compile Include="patches\GameSettings_SaveAsync_Patch.cs" />
111-
<Compile Include="patches\SeamothTorpedo_OnEnergyDepleted_Patch.cs" />
112-
<Compile Include="patches\Vehicle_ChargeModule_Patch.cs" />
113-
<Compile Include="patches\Vehicle_GetSlotCharge_Patch.cs" />
114-
<Compile Include="patches\Vehicle_OnUpgradeModuleChange_Patch.cs" />
115-
<Compile Include="patches\Vehicle_OnUpgradeModuleUse_Patch.cs" />
116-
<Compile Include="utils\ExplosiveTorpedoInitializer.cs" />
117-
<Compile Include="behaviours\TorpedoExplosionBehaviour.cs" />
115+
<Compile Include="Behaviours\CustomTriggerEventAssigner.cs" />
116+
<Compile Include="Behaviours\ZapFunctionalityBehaviour.cs" />
117+
<Compile Include="Items\PrawnSelfDefenseModule.cs" />
118+
<Compile Include="Patches\ExosuitTorpedoArm_OpenTorpedoStorageExternal_Patch.cs" />
119+
<Compile Include="Patches\SeamothTorpedo_OnEnergyDepleted_Patch.cs" />
120+
<Compile Include="Utils\ExplosiveTorpedoInitializer.cs" />
121+
<Compile Include="Behaviours\TorpedoExplosionBehaviour.cs" />
118122
<Compile Include="Global.cs" />
119-
<Compile Include="items\BlackPowder.cs" />
120-
<Compile Include="items\Coal.cs" />
121-
<Compile Include="items\ExplosiveTorpedo.cs" />
123+
<Compile Include="Items\BlackPowder.cs" />
124+
<Compile Include="Items\Coal.cs" />
125+
<Compile Include="Items\ExplosiveTorpedo.cs" />
122126
<Compile Include="Main.cs" />
123-
<Compile Include="patches\ItemGoalTracker_Start_Patch.cs" />
124-
<Compile Include="patches\uGUISceneLoading_End_Patch.cs" />
125-
<Compile Include="patches\Vehicle_Awake_Patch.cs" />
127+
<Compile Include="Patches\ItemGoalTracker_Start_Patch.cs" />
128+
<Compile Include="Patches\uGUISceneLoading_End_Patch.cs" />
129+
<Compile Include="Patches\Vehicle_Awake_Patch.cs" />
126130
<Compile Include="Properties\AssemblyInfo.cs" />
127-
<Compile Include="utils\LanguagesHandler.cs" />
131+
<Compile Include="Utils\GlobalInitializer.cs" />
132+
<Compile Include="Utils\LanguagesHandler.cs" />
133+
<Compile Include="Utils\Options.cs" />
134+
<Compile Include="Utils\ResourcesCacheManager.cs" />
128135
</ItemGroup>
129136
<ItemGroup />
130137
<ItemGroup>
131-
<Content Include="assets\Coal.png" />
132-
<Content Include="assets\ExplosiveTorpedo.png" />
133-
<Content Include="assets\first_lethal_weapon_message.mp3" />
134-
<Content Include="assets\first_lethal_weapon_message.ogg" />
135-
<Content Include="assets\PrawnPerimeterDefense.png" />
136-
<Content Include="assets\prawn_shield.png" />
137-
<Content Include="assets\xenoworx_pda_presentation.mp3" />
138138
<Content Include="Localizations.xml" />
139+
<None Include="Sounds\AudioClip.FirstLethalMessage.wav" />
140+
<None Include="Sounds\AudioClip.PWAPresentation.wav" />
139141
</ItemGroup>
140142
<ItemGroup>
141143
<None Include="mod.json" />
@@ -145,6 +147,7 @@
145147
<PostBuildEvent>mkdir "$(SubnauticaRootPath)\BepInEx\plugins\AlterraWeaponry"
146148
copy /Y "$(TargetPath)" "$(SubnauticaRootPath)\BepInEx\plugins\AlterraWeaponry\"
147149
copy /Y "$(ProjectDir)\alterraweaponry.assets" "$(SubnauticaRootPath)\BepInEx\plugins\AlterraWeaponry\"
150+
copy /Y "$(ProjectDir)\alterraweaponry.assets.meta" "$(SubnauticaRootPath)\BepInEx\plugins\AlterraWeaponry\"
148151
copy /Y "$(ProjectDir)\Localizations.xml" "$(SubnauticaRootPath)\BepInEx\plugins\AlterraWeaponry\"</PostBuildEvent>
149152
</PropertyGroup>
150153
</Project>

AlterraWeaponry/Global.cs

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,24 @@
1515
global using BepInEx.Bootstrap;
1616
global using BepInEx.Configuration;
1717
global using BepInEx.Logging;
18-
global using SMLHelper.V2.Assets;
19-
global using SMLHelper.V2.Commands;
20-
global using SMLHelper.V2.Crafting;
21-
global using SMLHelper.V2.FMod;
22-
global using SMLHelper.V2.FMod.Interfaces;
23-
global using SMLHelper.V2.Interfaces;
24-
global using SMLHelper.V2.Json;
25-
global using SMLHelper.V2.Json.Attributes;
26-
global using SMLHelper.V2.Json.Converters;
27-
global using SMLHelper.V2.Json.ExtensionMethods;
28-
global using SMLHelper.V2.Json.Interfaces;
29-
global using SMLHelper.V2.Handlers;
30-
global using SMLHelper.V2.MonoBehaviours;
31-
global using SMLHelper.V2.Options;
32-
global using SMLHelper.V2.Options.Attributes;
33-
global using SMLHelper.V2.Utility;
18+
global using Nautilus.Assets;
19+
global using Nautilus.Assets.Gadgets;
20+
global using Nautilus.Assets.PrefabTemplates;
21+
global using Nautilus.Commands;
22+
global using Nautilus.Crafting;
23+
global using Nautilus.Extensions;
24+
global using Nautilus.FMod;
25+
global using Nautilus.FMod.Interfaces;
26+
global using Nautilus.Handlers;
27+
global using Nautilus.Json;
28+
global using Nautilus.Json.Attributes;
29+
global using Nautilus.Json.Converters;
30+
global using Nautilus.Json.ExtensionMethods;
31+
global using Nautilus.Json.Interfaces;
32+
global using Nautilus.Options;
33+
global using Nautilus.Options.Attributes;
34+
global using Nautilus.Utility;
35+
global using Nautilus.Utility.MaterialModifiers;
3436
global using HarmonyLib;
3537
global using HarmonyLib.Public;
3638
global using HarmonyLib.Public.Patching;
@@ -44,9 +46,17 @@
4446
global using UWE;
4547
global using UWE.Timeline;
4648
global using UWEScript;
49+
global using FMOD;
4750

4851
// LOCAL
49-
global using VELD.AlterraWeaponry.items;
50-
global using VELD.AlterraWeaponry.patches;
51-
global using VELD.AlterraWeaponry.utils;
52-
global using VELD.AlterraWeaponry.behaviours;
52+
global using VELD.AlterraWeaponry.Items;
53+
global using VELD.AlterraWeaponry.Patches;
54+
global using VELD.AlterraWeaponry.Utils;
55+
global using VELD.AlterraWeaponry.Behaviours;
56+
57+
// MY LIBS
58+
global using CuddleLibs;
59+
global using CuddleLibs.Assets;
60+
global using CuddleLibs.Assets.Gadgets;
61+
global using CuddleLibs.Interfaces;
62+
global using CuddleLibs.Utility;

AlterraWeaponry/Localizations.xml

378 Bytes
Binary file not shown.

AlterraWeaponry/Main.cs

Lines changed: 38 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -4,149 +4,68 @@
44
public class Main : BaseUnityPlugin
55
{
66
// MOD INFO
7-
private const string modName = "Alterra Weaponry";
8-
private const string modGUID = "com.VELD.AlterraWeaponry";
9-
private const string modVers = "1.0.3";
7+
internal const string modName = "Alterra Weaponry";
8+
internal const string modGUID = "com.VELD.AlterraWeaponry";
9+
internal const string modVers = "1.0.5";
10+
internal const string modLongVers = "1.0.5.1";
1011

1112
// BepInEx/Harmony/Unity
1213
private static readonly Harmony harmony = new(modGUID);
1314
public static ManualLogSource logger;
1415

1516
// STORY GOALS
16-
#if BZ
17-
internal static StoryGoal AWPresentationGoal = new("Log_PDA_Goal_AWPresentation", Story.GoalType.PDA, 0f) { playInCreative = true, playInCinematics = false, delay = 8f };
18-
#endif
17+
internal static StoryGoal AWPresentationGoal;
18+
internal static ItemGoal AWFirstLethal;
1919

20-
public static readonly AssetBundle assets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "alterraweaponry.assets"));
20+
public static ResourcesCacheManager AssetsCache { get; private set; }
2121

22+
internal static Options Options { get; } = OptionsPanelHandler.RegisterModOptions<Options>();
2223

2324
private void Awake()
2425
{
2526
logger = Logger;
27+
try
28+
{
29+
AssetsCache = ResourcesCacheManager.LoadResources(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "alterraweaponry.assets"));
30+
}
31+
catch (Exception ex)
32+
{
33+
logger.LogFatal($"Fatal error occured: Unable to load resources to cache.\n{ex}");
34+
}
2635
logger.LogInfo($"{modName} {modVers} started patching.");
2736
harmony.PatchAll();
2837
logger.LogInfo($"{modName} {modVers} harmony patched.");
29-
30-
Coal coal = new();
31-
BlackPowder blackPowder = new();
32-
ExplosiveTorpedo explosiveTorpedo = new();
33-
PrawnSelfDefenseModule prawnSelfDefenseModule = new();
34-
35-
coal.Patch();
36-
blackPowder.Patch();
37-
explosiveTorpedo.Patch();
38-
prawnSelfDefenseModule.Patch();
39-
40-
logger.LogInfo($"{modName} {modVers} items registered.");
41-
42-
LanguagesHandler.LanguagePatch();
38+
LanguagesHandler.GlobalPatch();
4339
logger.LogInfo($"{modName} {modVers} languages lines patched.");
44-
45-
RegisterPDAEncyEntries();
40+
GlobalInitializer.PatchPDAEncyEntries();
4641
logger.LogInfo($"{modName} {modVers} PDA encyclopedia entries registered.");
47-
RegisterPDALogs();
42+
GlobalInitializer.PatchGoals();
43+
logger.LogInfo($"{modName} {modVers} PDA goals initialized.");
44+
GlobalInitializer.PatchPDALogs();
4845
logger.LogInfo($"{modName} {modVers} PDA logs registered.");
4946

50-
}
51-
52-
private void Update()
53-
{
54-
if(UnityInput.Current.GetKeyDown(KeyCode.P))
47+
ModDatabankHandler.RegisterMod(new ModDatabankHandler.ModData()
5548
{
56-
logger.LogInfo("Should play audio.");
57-
GameObject cameraObject = Camera.main.gameObject;
58-
AudioSource audioSource = cameraObject.GetComponent<AudioSource>();
59-
audioSource.clip = Main.assets.LoadAsset<AudioClip>("AudioClip.PWAPresentation");
60-
audioSource.Play();
61-
logger.LogInfo("Should have played an audio.");
62-
}
63-
}
64-
65-
private static void RegisterPDALogs()
66-
{
67-
// Load audio clips
68-
logger.LogInfo($"{modName} {modVers} Loading audio clips...");
69-
#if BZ
70-
AudioClip AWPresentationAudioClip = assets.LoadAsset<AudioClip>("pwa_presentation_message");
71-
AudioClip AWFirstLethalAudioClip = assets.LoadAsset<AudioClip>("first_lethal_message");
72-
#endif
73-
logger.LogInfo($"{modName} {modVers} Audio clips loaded!");
74-
75-
logger.LogInfo($"{modName} {modVers} Registering PDA Logs...");
76-
77-
// Presentation PDA log "Hello xenoworker 91802..."
78-
#if BZ
79-
CustomSoundHandler.RegisterCustomSound(AWPresentationGoal.key, AWPresentationAudioClip, AudioUtils.BusPaths.PDAVoice);
80-
FMODAsset presentation = ScriptableObject.CreateInstance<FMODAsset>();
81-
presentation.path = AWPresentationGoal.key;
82-
presentation.id = AWPresentationGoal.key;
83-
PDALogHandler.AddCustomEntry(
84-
AWPresentationGoal.key,
85-
"Subtitles_AWPresentation",
86-
sound: presentation
87-
);
88-
#endif
49+
guid = modGUID,
50+
version = modVers,
51+
image = AssetsCache.GetAsset<Texture2D>("ModLogo"),
52+
name = "Alterra Weaponry",
53+
desc = "Since the return of the Aurora survivor, Alterra secretely added a few weapons blueprints.\nThis information is kept confidential, by using the PWA (Personal Weaponry Assistance) you agree the Alterra's NDA (Non-Divulgation Accord)."
54+
});
8955

90-
// First lethal weapon PDA log "A lethal weapon have been detected into your inventory..."
91-
#if BZ
92-
CustomSoundHandler.RegisterCustomSound("Log_PDA_Goal_FirstLethal", AWFirstLethalAudioClip, AudioUtils.BusPaths.PDAVoice);
93-
FMODAsset firstLethal = ScriptableObject.CreateInstance<FMODAsset>();
94-
firstLethal.path = "Log_PDA_Goal_FirstLethal";
95-
firstLethal.id = "Log_PDA_Goal_FirstLethal";
96-
PDALogHandler.AddCustomEntry(
97-
"Log_PDA_Goal_FirstLethal",
98-
"Subtitles_AWFirstLethal",
99-
sound: firstLethal
100-
);
101-
#endif
102-
}
56+
Coal coal = new();
57+
coal.Patch();
10358

104-
private static void RegisterPDAEncyEntries()
105-
{
106-
// Register AWModInfo entry
107-
PDAEncyclopediaHandler.AddCustomEntry(new()
108-
{
109-
key = "AWModInfo",
110-
kind = PDAEncyclopedia.EntryData.Kind.Encyclopedia,
111-
nodes = new[] { "Meta" },
112-
path = "Meta",
113-
unlocked = true,
114-
});
59+
BlackPowder blackPowder = new();
60+
blackPowder.Patch();
11561

116-
// Explosive torpedoes entry
117-
#if BZ
118-
PDAEncyclopediaHandler.AddCustomEntry(new()
119-
{
120-
key = "ExplosiveTorpedo",
121-
kind = PDAEncyclopedia.EntryData.Kind.Encyclopedia,
122-
nodes = new[] { "Tech", "Weaponry" },
123-
path = "Tech/Weaponry",
124-
unlocked = false,
125-
});
126-
#endif
62+
ExplosiveTorpedo explosiveTorpedo = new();
63+
explosiveTorpedo.Patch();
12764

128-
// Prawn laser arm entry
129-
#if BZ
130-
PDAEncyclopediaHandler.AddCustomEntry(new()
131-
{
132-
key = "PrawnLaserArm",
133-
kind = PDAEncyclopedia.EntryData.Kind.Encyclopedia,
134-
nodes = new[] { "Tech", "Weaponry" },
135-
path = "Tech/Weaponry",
136-
unlocked = false,
137-
});
138-
#endif
65+
PrawnSelfDefenseModule prawnSelfDefenseModule = new();
66+
prawnSelfDefenseModule.Patch();
13967

140-
// Prawn Self Defense Module
141-
#if BZ
142-
PDAEncyclopediaHandler.AddCustomEntry(new()
143-
{
144-
key = "PrawnDefensePerimeter",
145-
kind = PDAEncyclopedia.EntryData.Kind.Encyclopedia,
146-
nodes = new[] { "Tech", "Modules" },
147-
path = "Tech/Modules",
148-
unlocked = false,
149-
});
150-
#endif
68+
logger.LogInfo($"{modName} {modVers} items registered.");
15169
}
70+
15271
}

AlterraWeaponry/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.Resources;
2-
using System.Reflection;
3-
using System.Runtime.CompilerServices;
42
using System.Runtime.InteropServices;
3+
using VELD.AlterraWeaponry;
54

65
// General Information about an assembly is controlled through the following
76
// set of attributes. Change these attribute values to modify the information
@@ -33,6 +32,6 @@
3332
// You can specify all the values or you can default the Build and Revision Numbers
3433
// by using the '*' as shown below:
3534
// [assembly: AssemblyVersion("1.0.*")]
36-
[assembly: AssemblyVersion("1.0.3.0")]
37-
[assembly: AssemblyFileVersion("1.0.3.0")]
35+
[assembly: AssemblyVersion(Main.modVers)]
36+
[assembly: AssemblyFileVersion(Main.modLongVers)]
3837
[assembly: NeutralResourcesLanguage("en")]
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)