Skip to content

Commit

Permalink
Added a prefix for all the components that naturally have a tick (exc…
Browse files Browse the repository at this point in the history
…ept turrets since they have their own class system)
  • Loading branch information
pokegustavor committed Oct 1, 2021
1 parent f62a518 commit 0b09201
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
9 changes: 5 additions & 4 deletions PulsarModLoader/Content/Components/Shield/ShieldModManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,17 @@ static bool Prefix(int inSubType, int inLevel, ref PLShipComponent __result)
return false;
}
}
/*[HarmonyPatch(typeof(PLShieldGenerator), "Tick")]
//Applies the Tick of the modded shields
[HarmonyPatch(typeof(PLShieldGenerator), "Tick")]
class TickPatch
{
static void Postfix(PLShieldGenerator __instance)
{
int subtypeformodded = __instance.SubType - ShieldModManager.Instance.VanillaShieldMaxType;
if (subtypeformodded > -1 && subtypeformodded < ShieldModManager.Instance.ShieldTypes.Count && __instance.ShipStats != null && __instance.ShipStats.ShieldTempMax != 0f)
if (subtypeformodded > -1 && subtypeformodded < ShieldModManager.Instance.ShieldTypes.Count && __instance.ShipStats != null)
{
ShieldModManager.Instance.ShieldTypes[subtypeformodded].ShieldPowerCode(__instance);
ShieldModManager.Instance.ShieldTypes[subtypeformodded].Tick(__instance);
}
}
}*/
}
}
13 changes: 13 additions & 0 deletions PulsarModLoader/Content/Components/Thruster/ThrusterModManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,17 @@ static bool Prefix(int inSubType, int inLevel, ref PLShipComponent __result)
return false;
}
}

[HarmonyPatch(typeof(PLThruster), "Tick")]
class TickPatch
{
static void Postfix(PLThruster __instance)
{
int subtypeformodded = __instance.SubType - ThrusterModManager.Instance.VanillaThrusterMaxType;
if (subtypeformodded > -1 && subtypeformodded < ThrusterModManager.Instance.ThrusterTypes.Count && __instance.ShipStats != null)
{
ThrusterModManager.Instance.ThrusterTypes[subtypeformodded].Tick(__instance);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,17 @@ static bool Prefix(int inSubType, int inLevel, ref PLShipComponent __result)
return false;
}
}

[HarmonyPatch(typeof(PLInertiaThruster), "Tick")]
class TickPatch
{
static void Postfix(PLInertiaThruster __instance)
{
int subtypeformodded = __instance.SubType - InertiaThrusterModManager.Instance.VanillaInertiaThrusterMaxType;
if (subtypeformodded > -1 && subtypeformodded < InertiaThrusterModManager.Instance.InertiaThrusterTypes.Count && __instance.ShipStats != null)
{
InertiaThrusterModManager.Instance.InertiaThrusterTypes[subtypeformodded].Tick(__instance);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,16 @@ static bool Prefix(int inSubType, int inLevel, ref PLShipComponent __result)
return false;
}
}
[HarmonyPatch(typeof(PLManeuverThruster), "Tick")]
class TickPatch
{
static void Postfix(PLInertiaThruster __instance)
{
int subtypeformodded = __instance.SubType - ManeuverThrusterModManager.Instance.VanillaManeuverThrusterMaxType;
if (subtypeformodded > -1 && subtypeformodded < ManeuverThrusterModManager.Instance.ManeuverThrusterTypes.Count && __instance.ShipStats != null)
{
ManeuverThrusterModManager.Instance.ManeuverThrusterTypes[subtypeformodded].Tick(__instance);
}
}
}
}

0 comments on commit 0b09201

Please sign in to comment.