Forwarded CommandRange Drawing incompatible mod check to prepare.
Source separated from Assemblies folder,Build target fix.
This commit is contained in:
parent
36977d9928
commit
e7c989431b
@ -21,21 +21,27 @@ namespace LTS_Implants
|
|||||||
static class
|
static class
|
||||||
Pawn_MechanitorTracker_CanCommandTo_Patch //increases the mechanitor's range by MechRemoteControlDistanceOffset
|
Pawn_MechanitorTracker_CanCommandTo_Patch //increases the mechanitor's range by MechRemoteControlDistanceOffset
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// default value of mechanitor command range.
|
||||||
|
/// </summary>
|
||||||
private static float defaultRange = 24.9f;
|
private static float defaultRange = 24.9f;
|
||||||
|
|
||||||
[HarmonyPrepare]
|
[HarmonyPrepare]
|
||||||
static bool Prepare()
|
static bool Prepare()
|
||||||
{
|
{
|
||||||
|
//If CE,use CE value as default instead.unpatching is done in main patchBootstrap.
|
||||||
if (LTS_Implants.HarmonyPatches.IsCombatExtended)
|
if (LTS_Implants.HarmonyPatches.IsCombatExtended)
|
||||||
{
|
{
|
||||||
defaultRange = 43.9f;
|
defaultRange = 43.9f;
|
||||||
Verse.Log.Warning("[LTS-II-Forked]Pawn_MechanitorTracker.CanCommandTo Patch Recognized CE,default Range changed from 24.9 to 43.9");
|
Verse.Log.Warning(
|
||||||
|
"[LTS-II-Forked]Pawn_MechanitorTracker.CanCommandTo Patch Recognized CE,default Range changed from 24.9 to 43.9");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// pushed always commandable check to front to reduct compute.
|
/// pushed always commandable check to front to reduce compute overhead.
|
||||||
/// TODO perhaps need a custom patch order to make sure this logic always works.
|
/// TODO:perhaps need a custom patch order to make sure this logic always works.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="target">target mech to command</param>
|
/// <param name="target">target mech to command</param>
|
||||||
/// <param name="__instance">should be mechanitor, but not always the mechanitor for example like Dead man switch ctrl mechs </param>
|
/// <param name="__instance">should be mechanitor, but not always the mechanitor for example like Dead man switch ctrl mechs </param>
|
||||||
@ -55,15 +61,27 @@ namespace LTS_Implants
|
|||||||
SignalBoosterRange); //last line should mean that if something else makes it true, then it is(?)
|
SignalBoosterRange); //last line should mean that if something else makes it true, then it is(?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPatch(typeof(Pawn_MechanitorTracker))]
|
[HarmonyPatch(typeof(Pawn_MechanitorTracker))]
|
||||||
[HarmonyPatch(nameof(Pawn_MechanitorTracker.DrawCommandRadius))]
|
[HarmonyPatch(nameof(Pawn_MechanitorTracker.DrawCommandRadius))]
|
||||||
static class
|
static class
|
||||||
Pawn_MechanitorTracker_DrawCommandRadius_Patch //increases the displayed mechanitor range by MechRemoteControlDistanceOffset
|
Pawn_MechanitorTracker_DrawCommandRadius_Patch //increases the displayed mechanitor range by MechRemoteControlDistanceOffset
|
||||||
{
|
{
|
||||||
private static float defaultRange = 24.9f;
|
private static float defaultRange = 24.9f;
|
||||||
|
|
||||||
[HarmonyPrepare]
|
[HarmonyPrepare]
|
||||||
static bool Prepare()
|
static bool Prepare()
|
||||||
{
|
{
|
||||||
|
//For conflict mods, disable the rendering patch entirely.
|
||||||
|
//TODO:make this a list.
|
||||||
|
if (ModsConfig.IsActive("swwu.MechanitorCommandRange") ||
|
||||||
|
ModsConfig.IsActive("Neronix17.TweaksGalore"))
|
||||||
|
{
|
||||||
|
Verse.Log.Message(
|
||||||
|
"[LTS-II-Forked/Biotech]Pawn_MechanitorTracker.DrawCommandRadius Patch Encountered Hard Incompatible mods,aborting patch");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (LTS_Implants.HarmonyPatches.IsCombatExtended)
|
if (LTS_Implants.HarmonyPatches.IsCombatExtended)
|
||||||
{
|
{
|
||||||
defaultRange = 43.9f;
|
defaultRange = 43.9f;
|
||||||
@ -73,9 +91,11 @@ namespace LTS_Implants
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Skip original draw radius using a prefix.
|
/// Skip original draw radius using a prefix.
|
||||||
/// TODO may need specify fixed patch order to make sure this works.
|
/// TODO may need specify fixed patch order to make sure this works.
|
||||||
|
/// TODO:may need unpatch other conflict mods to make this work.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>return false to skip original draw.</returns>
|
/// <returns>return false to skip original draw.</returns>
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
@ -94,10 +114,6 @@ namespace LTS_Implants
|
|||||||
if (__instance.Pawn.Spawned && __instance.AnySelectedDraftedMechs)
|
if (__instance.Pawn.Spawned && __instance.AnySelectedDraftedMechs)
|
||||||
{
|
{
|
||||||
//GenDraw.DrawRadiusRing(___pawn.Position, 24.9f + (3f*___pawn.health?.hediffSet?.GetFirstHediffOfDef(HediffDef.Named("SignalBoosterImplant"))?.Severity ?? 0f), Color.white, (IntVec3 c) => __instance.CanCommandTo(c));
|
//GenDraw.DrawRadiusRing(___pawn.Position, 24.9f + (3f*___pawn.health?.hediffSet?.GetFirstHediffOfDef(HediffDef.Named("SignalBoosterImplant"))?.Severity ?? 0f), Color.white, (IntVec3 c) => __instance.CanCommandTo(c));
|
||||||
if (!ModsConfig.IsActive("swwu.MechanitorCommandRange") &&
|
|
||||||
!ModsConfig.IsActive(
|
|
||||||
"Neronix17.TweaksGalore")) //for tweaks galore, it'd be better to try to find the setting specifically, with an inverted result and a null check true
|
|
||||||
{
|
|
||||||
IntVec3 position = __instance.Pawn.Position;
|
IntVec3 position = __instance.Pawn.Position;
|
||||||
float radius = defaultRange +
|
float radius = defaultRange +
|
||||||
(__instance.Pawn?.GetStatValue(
|
(__instance.Pawn?.GetStatValue(
|
||||||
@ -578,4 +594,5 @@ namespace LTS_Implants
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
@ -10,11 +10,11 @@
|
|||||||
<FileVersion>1.0.0.0</FileVersion>
|
<FileVersion>1.0.0.0</FileVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<OutputPath>..\</OutputPath>
|
<OutputPath>..\1.5\Assemblies\</OutputPath>
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||||
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
|
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
|
||||||
<DocumentationFile>..\Implants.xml</DocumentationFile>
|
<DocumentationFile>..\1.5\Assemblies\Implants.xml</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||||
|
@ -264,6 +264,8 @@ namespace LTS_Implants
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Mech Carrier
|
||||||
|
|
||||||
//public class CompProperties_MechanitorMechCarrier : CompProperties_AbilityEffect
|
//public class CompProperties_MechanitorMechCarrier : CompProperties_AbilityEffect
|
||||||
//{
|
//{
|
||||||
// public CompProperties_MechanitorMechCarrier()
|
// public CompProperties_MechanitorMechCarrier()
|
||||||
@ -448,9 +450,6 @@ namespace LTS_Implants
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public override bool GizmoDisabled(out string reason)
|
// public override bool GizmoDisabled(out string reason)
|
||||||
// {
|
// {
|
||||||
// //Log.Warning(ingredientCountRemaining + " out of "+ Props.costPerPawn + " steel.");
|
// //Log.Warning(ingredientCountRemaining + " out of "+ Props.costPerPawn + " steel.");
|
||||||
@ -463,14 +462,6 @@ namespace LTS_Implants
|
|||||||
// return base.GizmoDisabled(out reason);
|
// return base.GizmoDisabled(out reason);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// public int remainingCharges
|
// public int remainingCharges
|
||||||
// {
|
// {
|
||||||
// get
|
// get
|
||||||
@ -589,6 +580,10 @@ namespace LTS_Implants
|
|||||||
// // }
|
// // }
|
||||||
// //}
|
// //}
|
||||||
//}
|
//}
|
||||||
|
#endregion
|
||||||
|
#region Psychic Shield
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//public class LTS_ShieldHediff : Hediff_Implant
|
//public class LTS_ShieldHediff : Hediff_Implant
|
||||||
//{
|
//{
|
||||||
@ -663,7 +658,7 @@ namespace LTS_Implants
|
|||||||
|
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
#endregion
|
||||||
public class LTS_HediffCompProperties_Mote : HediffCompProperties
|
public class LTS_HediffCompProperties_Mote : HediffCompProperties
|
||||||
{
|
{
|
||||||
//public AbilityDef abilityDef;
|
//public AbilityDef abilityDef;
|
||||||
|
@ -9,20 +9,24 @@ namespace LTS_Implants
|
|||||||
public static class HarmonyPatches
|
public static class HarmonyPatches
|
||||||
{
|
{
|
||||||
public static bool IsCombatExtended = false;
|
public static bool IsCombatExtended = false;
|
||||||
|
public static bool IsSarg = false;
|
||||||
static HarmonyPatches()
|
static HarmonyPatches()
|
||||||
{
|
{
|
||||||
Verse.Log.Message("[LTS-II-Forked]Unpatching CE patches to reduce overlap");
|
|
||||||
Harmony harmony = new Harmony("rimworld.LTS.implants");
|
Harmony harmony = new Harmony("rimworld.LTS.implants");
|
||||||
Harmony.DEBUG = false;
|
Harmony.DEBUG = false;
|
||||||
//Check if we are in a CE enabled env
|
//Check if we are in a CE enabled env
|
||||||
if (ModLister.GetModWithIdentifier("ceteam.combatextended") != null)
|
if (ModLister.GetModWithIdentifier("ceteam.combatextended") != null)
|
||||||
|
{
|
||||||
IsCombatExtended = true;
|
IsCombatExtended = true;
|
||||||
|
Verse.Log.Message("[LTS-II-Forked]Found CombatExtended,Will unpatch some harmony patches to reduce overlap");
|
||||||
|
}
|
||||||
|
//TODO Detect Sarg`s mod and unpatch accordingly.
|
||||||
if (ModLister.BiotechInstalled)
|
if (ModLister.BiotechInstalled)
|
||||||
{
|
{
|
||||||
Verse.Log.Message("[LTS-II-Forked]Biotech found, harmony patch running");
|
Verse.Log.Message("[LTS-II-Forked]Biotech found, harmony patch running");
|
||||||
if (IsCombatExtended)
|
if (IsCombatExtended)
|
||||||
{
|
{
|
||||||
Verse.Log.Message("[LTS-II-Forked]Unpatching CE patches to reduce overlap");
|
Verse.Log.Message("[LTS-II-Forked]Unpatching CE Biotech Mechanitor Command Range patches to reduce overlap,CE range is used instead vanilla range");
|
||||||
var mechanitorCanCommand = typeof(Pawn_MechanitorTracker).GetMethod("CanCommandTo");
|
var mechanitorCanCommand = typeof(Pawn_MechanitorTracker).GetMethod("CanCommandTo");
|
||||||
harmony.Unpatch(mechanitorCanCommand,HarmonyPatchType.All,"CombatExtended.HarmonyCE");
|
harmony.Unpatch(mechanitorCanCommand,HarmonyPatchType.All,"CombatExtended.HarmonyCE");
|
||||||
var mechanitorDrawCommandRange = typeof(Pawn_MechanitorTracker).GetMethod("DrawCommandRadius");
|
var mechanitorDrawCommandRange = typeof(Pawn_MechanitorTracker).GetMethod("DrawCommandRadius");
|
||||||
|
Loading…
Reference in New Issue
Block a user