UBOAT
[2022.1] Removed Deckgun Boost
c82k 21 Dec, 2022 @ 10:07am
"Cheaty-Version" wanted
Hi,

i would ask if you would like to release a version, that we can use to speed up even if the cannon is existing?
< >
Showing 1-1 of 1 comments
Tyler Durden 1 Mar, 2023 @ 4:07am 
That's relatively easy.
Just change the percentage in the DeckgunBoostConfig.xlsx.
500% gives you smove 55 knots top speed.

If you dont want to miss out on the deck gun, make sure the DeckgunEnginePatches.cs looks like this:

using System.Collections.Generic;
using Harmony;
using UBOAT.Game.Core;
using UBOAT.Game.Core.Data;
using UBOAT.Game.Sandbox;
using UBOAT.Game.Scene.Items;
using UBOAT.Game.Scene.Entities;
using UBOAT.Game.Scene.Characters.Actions;
using DWS.Common.InjectionFramework;

using UnityEngine;

namespace UBOAT.Mods.DeckgunEngine
{
class DeckgunEnginePatches
{
[Inject] private static PlayerShip playerShip;

static bool RecheckDeckGun = true;
static bool RemovedDeckGun = false;

private static readonly GameDataReference Boost = new GameDataReference("DeckgunBoostConfig/Settings/DeckgunBoost/Underwater Speed Boost");
private static bool CheckRemovedDeckGun()
{
if (RecheckDeckGun)
{
Debug.Log($"{Constants.ModName} Rechecking Deck Gun");
List<Equipment> equiment = playerShip.Equipment;
foreach (Equipment item in equiment)
{
if (item.Name == "Removed Deck Gun" || item.Name == "Deck Gun Mount Cover")
{
Debug.Log($"{Constants.ModName} Found Removed Deck Gun");
RemovedDeckGun = true;
break;
}
if (item.Name == "Artillery - 8.8 cm")
{
Debug.Log($"{Constants.ModName} Found Deck Gun");
RemovedDeckGun = true;
break;
}
}
RecheckDeckGun = false;
}
return RemovedDeckGun;
}

[HarmonyPatch(typeof(Propeller), "FixedUpdate")]
public class FixedUpdatePatch
{
public static bool modified = false;
public static void Prefix(ref float __state, ref float ___power)
{
if (!Physics.autoSimulation)
return;
if (!CheckRemovedDeckGun() || playerShip.DeckDepth < 1.5f)
return;

modified = true;
__state = ___power;
___power += __state * Boost;
//Debug.Log($"{Constants.ModName} Old Power {__state} Power Increase {__state * Boost} New Power {___power} ");
}
public static void Postfix(float __state, ref float ___power)
{
if (!modified)
return;

___power = __state;
modified = false;
}
}

[HarmonyPatch(typeof(PlayerCareer), "OnAfterDeserialize")]
public class OnAfterDeserialize
{
public static void Postfix()
{
Debug.Log($"{Constants.ModName} Deck Gun Recheck Needed");
RecheckDeckGun = true;
}
}

[HarmonyPatch(typeof(EnterUpgradeModeAction), "GameState_UpgradeModeChanged")]
public class EnterUpgradeModeActionPatch
{
public static void Prefix(GameState ___gameState)
{
if (!___gameState.UpgradeMode)
{
Debug.Log($"{Constants.ModName} Deck Gun Recheck Needed");
RecheckDeckGun = true;
}
}
}
}
}
< >
Showing 1-1 of 1 comments
Per page: 1530 50