-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e743b0
commit a6672fb
Showing
11 changed files
with
368 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
186 changes: 186 additions & 0 deletions
186
MoreEngineEfficiencyModulesBZ/MoreEngineEfficiencyModules.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
using HarmonyLib; | ||
using QModManager.API; | ||
using QModManager.API.ModLoading; | ||
using SMLHelper.V2.Assets; | ||
using SMLHelper.V2.Crafting; | ||
using SMLHelper.V2.Utility; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Reflection; | ||
using UnityEngine; | ||
using Logger = QModManager.Utility.Logger; | ||
|
||
namespace MoreEngineEfficiencyModules | ||
{ | ||
public class VehiclePowerUpgradeModule | ||
{ | ||
|
||
} | ||
public class VehiclePowerUpgradeModuleMK2 : Equipable | ||
{ | ||
public static TechType thisTechType; | ||
public override string AssetsFolder => Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Assets"); | ||
|
||
public VehiclePowerUpgradeModuleMK2() : base("VehiclePowerUpgradeModuleMK2", "Engine Efficiency Module MK2", "Boosts engine efficiency by 1.75x the mark 1 variant.") | ||
{ | ||
OnFinishedPatching += () => | ||
{ | ||
VehiclePowerUpgradeModuleMK2.thisTechType = this.TechType; | ||
VehicleUpgraderFix.AddUVEfficiencyBonus(VehiclePowerUpgradeModuleMK2.thisTechType, bForce: false); | ||
}; | ||
} | ||
|
||
public override EquipmentType EquipmentType => EquipmentType.VehicleModule; | ||
public override TechType RequiredForUnlock => TechType.BaseUpgradeConsole; | ||
public override TechGroup GroupForPDA => TechGroup.VehicleUpgrades; | ||
public override TechCategory CategoryForPDA => TechCategory.VehicleUpgrades; | ||
public override CraftTree.Type FabricatorType => CraftTree.Type.Workbench; | ||
public override string[] StepsToFabricatorTab => new[] { QMod.WorkBenchTab }; | ||
public override float CraftingTime => 3f; | ||
public override QuickSlotType QuickSlotType => QuickSlotType.Passive; | ||
protected override Sprite GetItemSprite() | ||
{ | ||
return ImageUtils.LoadSpriteFromFile(Path.Combine(AssetsFolder, "EngineEfficiencyModuleMK2Sprite.png")); | ||
} | ||
|
||
protected override RecipeData GetBlueprintRecipe() | ||
{ | ||
return new RecipeData() | ||
{ | ||
craftAmount = 1, | ||
Ingredients = new List<Ingredient>(new Ingredient[] | ||
{ | ||
new Ingredient(TechType.VehiclePowerUpgradeModule, 1), | ||
new Ingredient(TechType.ComputerChip, 1), | ||
new Ingredient(TechType.GenericRibbon, 4), | ||
new Ingredient(TechType.AluminumOxide, 2) | ||
|
||
} | ||
) | ||
}; | ||
} | ||
|
||
public override IEnumerator GetGameObjectAsync(IOut<GameObject> gameObject) | ||
{ | ||
var task = CraftData.GetPrefabForTechTypeAsync(TechType.VehiclePowerUpgradeModule, false); | ||
yield return task; | ||
var prefab = GameObject.Instantiate(task.GetResult()); | ||
gameObject.Set(prefab); | ||
} | ||
} | ||
public class VehiclePowerUpgradeModuleMK3 : Equipable | ||
{ | ||
public static TechType thisTechType; | ||
|
||
public override string AssetsFolder => Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Assets"); | ||
|
||
public VehiclePowerUpgradeModuleMK3() : base("VehiclePowerUpgradeModuleMK3", "Engine Efficiency Module MK3", "Boosts engine efficiency by 2.5x the mark 1 variant.") | ||
{ | ||
OnFinishedPatching += () => | ||
{ | ||
VehiclePowerUpgradeModuleMK3.thisTechType = this.TechType; | ||
VehicleUpgraderFix.AddUVEfficiencyBonus(VehiclePowerUpgradeModuleMK3.thisTechType ,bForce: false); | ||
}; | ||
} | ||
|
||
public override EquipmentType EquipmentType => EquipmentType.VehicleModule; | ||
public override TechType RequiredForUnlock => TechType.BaseUpgradeConsole; | ||
public override TechGroup GroupForPDA => TechGroup.VehicleUpgrades; | ||
public override TechCategory CategoryForPDA => TechCategory.VehicleUpgrades; | ||
public override CraftTree.Type FabricatorType => CraftTree.Type.Workbench; | ||
public override string[] StepsToFabricatorTab => new[] { QMod.WorkBenchTab }; | ||
public override float CraftingTime => 3f; | ||
public override QuickSlotType QuickSlotType => QuickSlotType.Passive; | ||
protected override Sprite GetItemSprite() | ||
{ | ||
return ImageUtils.LoadSpriteFromFile(Path.Combine(AssetsFolder, "EngineEfficiencyModuleMK3Sprite.png")); | ||
} | ||
|
||
protected override RecipeData GetBlueprintRecipe() | ||
{ | ||
return new RecipeData() | ||
{ | ||
craftAmount = 1, | ||
Ingredients = new List<Ingredient>(new Ingredient[] | ||
{ | ||
new Ingredient(VehiclePowerUpgradeModuleMK2.thisTechType, 1), | ||
new Ingredient(TechType.AdvancedWiringKit, 1), | ||
new Ingredient(TechType.Benzene, 2), | ||
new Ingredient(TechType.Kyanite, 2) | ||
|
||
} | ||
) | ||
}; | ||
} | ||
public override IEnumerator GetGameObjectAsync(IOut<GameObject> gameObject) | ||
{ | ||
var task = CraftData.GetPrefabForTechTypeAsync(TechType.VehiclePowerUpgradeModule, false); | ||
yield return task; | ||
var prefab = GameObject.Instantiate(task.GetResult()); | ||
gameObject.Set(prefab); | ||
} | ||
|
||
} | ||
|
||
class VehicleUpgraderFix | ||
{ | ||
private static readonly Type VehicleUpgraderType = Type.GetType("UpgradedVehicles.VehicleUpgrader, UpgradedVehicles", false, false); | ||
private static readonly MethodInfo VehicleUpgraderAddEfficiencyBonus = VehicleUpgraderType?.GetMethod("AddEfficiencyBonus", BindingFlags.Public | BindingFlags.Static); | ||
|
||
public static bool AddUVEfficiencyBonus(TechType module, bool bForce = false) | ||
{ | ||
float efficiencybonus; | ||
if (VehicleUpgraderAddEfficiencyBonus == null) | ||
return false; | ||
if (module == VehiclePowerUpgradeModuleMK2.thisTechType) { | ||
efficiencybonus = 1.75f; | ||
VehicleUpgraderAddEfficiencyBonus.Invoke(null, new object[] { VehiclePowerUpgradeModuleMK2.thisTechType, efficiencybonus, bForce }); | ||
return true; | ||
} | ||
efficiencybonus = 2.5f; | ||
VehicleUpgraderAddEfficiencyBonus.Invoke(null, new object[] { VehiclePowerUpgradeModuleMK3.thisTechType, efficiencybonus, bForce }); | ||
return true; | ||
} | ||
} | ||
|
||
[HarmonyPatch(typeof(Vehicle), nameof(Vehicle.OnUpgradeModuleChange))] | ||
class Patch | ||
{ | ||
[HarmonyPostfix] | ||
public static void PostUpgradeModuleChange(Vehicle __instance, TechType techType) | ||
{ | ||
if (!QModServices.Main.ModPresent("UpgradedVehicles")) | ||
{ | ||
if (techType == VehiclePowerUpgradeModuleMK2.thisTechType || techType == TechType.VehiclePowerUpgradeModule) | ||
{ | ||
__instance.enginePowerRating = 1f + (__instance.modules.GetCount(TechType.VehiclePowerUpgradeModule) + (1.75f * __instance.modules.GetCount(VehiclePowerUpgradeModuleMK2.thisTechType) + (2.5f * __instance.modules.GetCount(VehiclePowerUpgradeModuleMK3.thisTechType)))); | ||
ErrorMessage.AddMessage(Language.main.GetFormat("PowerRatingNowFormat", __instance.enginePowerRating)); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
[QModCore] | ||
public static class QMod | ||
{ | ||
|
||
internal const string WorkBenchTab = "EngineEfficiencyModUpgrades"; | ||
|
||
[QModPatch] | ||
public static void Patch() | ||
{ | ||
SMLHelper.V2.Handlers.CraftTreeHandler.AddCraftingNode(CraftTree.Type.SeamothUpgrades, TechType.VehiclePowerUpgradeModule, "ExosuitUpgrades"); | ||
SMLHelper.V2.Handlers.CraftTreeHandler.AddTabNode(CraftTree.Type.Workbench, WorkBenchTab, "Engine Efficiency Modules", SpriteManager.Get(TechType.VehiclePowerUpgradeModule)); | ||
var assembly = Assembly.GetExecutingAssembly(); | ||
var modName = ($"AkariTheSloth_{assembly.GetName().Name}"); | ||
Logger.Log(Logger.Level.Info, $"Patching {modName}"); | ||
Harmony harmony = new Harmony(modName); | ||
harmony.PatchAll(assembly); | ||
Logger.Log(Logger.Level.Info, "Patched successfully!"); | ||
new MoreEngineEfficiencyModules.VehiclePowerUpgradeModuleMK2().Patch(); | ||
new MoreEngineEfficiencyModules.VehiclePowerUpgradeModuleMK3().Patch(); | ||
} | ||
} |
97 changes: 97 additions & 0 deletions
97
MoreEngineEfficiencyModulesBZ/MoreEngineEfficiencyModulesBZ.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?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> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{777D7953-F1C3-444A-BC6C-F63E3012786B}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>MoreEngineEfficiencyModulesBZ</RootNamespace> | ||
<AssemblyName>moreEngineEfficiencyModulesBZ</AssemblyName> | ||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="0Harmony"> | ||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SubnauticaZero\BepInEx\core\0Harmony.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp-firstpass_publicized"> | ||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SubnauticaZero\SubnauticaZero_Data\Managed\publicized_assemblies\Assembly-CSharp-firstpass_publicized.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp_publicized"> | ||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SubnauticaZero\SubnauticaZero_Data\Managed\publicized_assemblies\Assembly-CSharp_publicized.dll</HintPath> | ||
</Reference> | ||
<Reference Include="QModInstaller"> | ||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SubnauticaZero\BepInEx\plugins\QModManager\QModInstaller.dll</HintPath> | ||
</Reference> | ||
<Reference Include="SMLHelper"> | ||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SubnauticaZero\QMods\SMLHelper_BZ\SMLHelper.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SubnauticaZero\SubnauticaZero_Data\Managed\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.CoreModule"> | ||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SubnauticaZero\SubnauticaZero_Data\Managed\UnityEngine.CoreModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UI"> | ||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SubnauticaZero\SubnauticaZero_Data\Managed\UnityEngine.UI.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="MoreEngineEfficiencyModules.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="manifest.json" /> | ||
<None Include="mod.json" /> | ||
<None Include="README.md" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="EngineEfficiencyModuleMK2Sprite.png" /> | ||
<Content Include="EngineEfficiencyModuleMK3Sprite.png" /> | ||
<Content Include="icon.png" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<PropertyGroup> | ||
<PostBuildEvent>mkdir "C:\Users\snorl\Documents\$(TargetName)" | ||
mkdir "C:\Users\snorl\Documents\$(TargetName)\QMods" | ||
mkdir "C:\Users\snorl\Documents\$(TargetName)\QMods\" | ||
mkdir "C:\Users\snorl\Documents\\$(TargetName)\QMods\Assets" | ||
copy /Y "$(TargetPath)" "C:\Users\snorl\Documents\$(TargetName)\QMods\MoreEngineEfficiencyModules" | ||
copy /Y "$(ProjectDir)\mod.json" "C:\Users\snorl\Documents\$(TargetName)\QMods\\MoreEngineEfficiencyModules\mod.json" | ||
copy /Y "$(ProjectDir)\EngineEfficiencyModuleMK2Sprite.png" "C:\Users\snorl\Documents\$(TargetName)\Qmods\\MoreEngineEfficiencyModules\Assets\EngineEfficiencyModuleMK2Sprite.png" | ||
copy /Y "$(ProjectDir)\EngineEfficiencyModuleMK3Sprite.png" "C:\Users\snorl\Documents\$(TargetName)\QMods\MoreEngineEfficiencyModules\Assets\EngineEfficiencyModuleMK3Sprite.png" | ||
copy /Y "$(ProjectDir)\manifest.json" "C:\Users\snorl\Documents\$(TargetName)\manifest.json" | ||
copy /Y "$(ProjectDir)\README.md" "C:\Users\snorl\Documents\$(TargetName)\README.md" | ||
copy /Y "$(ProjectDir)\icon.png" "C:\Users\snorl\Documents\$(TargetName)\icon.png" | ||
|
||
</PostBuildEvent> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("MoreEngineEfficiencyModulesBZ")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("MoreEngineEfficiencyModulesBZ")] | ||
[assembly: AssemblyCopyright("Copyright © 2022")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("777d7953-f1c3-444a-bc6c-f63e3012786b")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## More Engine Efficiency Modules BZ | ||
|
||
This mod re-adds the Engine Efficiency Module and adds a Mark 2 and Mark 3 Engine Efficiency Module for the Seatruck and PRAWN Suit.<br> | ||
This is a port of More Engine Efficiency Modules for SN1, with slight changes so it works properly. | ||
|
||
MK1 ID: VehiclePowerUpgradeModule | ||
|
||
MK2 ID: VehiclePowerUpgradeModuleMK2 | ||
|
||
MK3 ID: VehiclePowerUpgradeModuleMK3 | ||
|
||
The original is crafted at the Vehicle Upgrade Console in a Moonpool. | ||
The MK2 and MK3 are crafted at a modification station after unlocking the vehicle upgrade console. | ||
|
||
Needs: SMLHelper, QModManager. | ||
|
||
ThunderStore Page: https://subnautica.thunderstore.io/package/Akari/More_Engine_Efficiency_Modules_BZ/ | ||
|
||
To use with Upgraded Vehicles, please go to the Subnautica Modding Server and ping me: "Akari - アカリ#1302" for more information. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "More_Engine_Efficiency_Modules_BZ", | ||
"version_number": "1.0.0", | ||
"website_url": "https://github.com/Slothy-lol/AkarisSubnauticaMods", | ||
"description": "Re-adds the Engine Efficiency Module, and adds a Mark 2 and Mark 3 Engine Efficiency Module for the Seatruck and PRAWN Suit.", | ||
"dependencies": [ | ||
"Subnautica_Modding-QModManager_BZ-4.4.2", | ||
"Subnautica_Modding-SMLHelper_BZ-2.13.1" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"Id": "moreEngineEfficiencyModulesBZ", | ||
"DisplayName": "More Engine Efficiency Modules BZ", | ||
"Author": "Akari The Sloth", | ||
"Version": "1.0.0", | ||
"Enable": true, | ||
"AssemblyName": "moreEngineEfficiencyModulesBZ.dll", | ||
"Dependencies": [ "SMLHelper" ], | ||
"LoadAfter": [ "UpgradedVehicles" ], | ||
"VersionChecker": { | ||
"LatestVersionURL": "https://github.com/Slothy-lol/AkarisSubnauticaMods/raw/main/moreEngineEfficiencyModules/mod.json" | ||
}, | ||
"Game": "BelowZero" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters