Moved Source out from assemblies folder to avoid dll dupe errors.
Confirmed CE compat on biotech mechanitor control range works. now heads to next part.
This commit is contained in:
parent
b34353deae
commit
36977d9928
Binary file not shown.
Binary file not shown.
@ -4,7 +4,7 @@
|
|||||||
<name>Implants</name>
|
<name>Implants</name>
|
||||||
</assembly>
|
</assembly>
|
||||||
<members>
|
<members>
|
||||||
<member name="M:Implants.Biotech.BiotechMechanitorPatches.Pawn_MechanitorTracker_CanCommandTo_Patch.CanCommandToPostfix(Verse.LocalTargetInfo,RimWorld.Pawn_MechanitorTracker,System.Boolean@)">
|
<member name="M:LTS_Implants.BiotechMechanitorPatches.Pawn_MechanitorTracker_CanCommandTo_Patch.CanCommandToPostfix(Verse.LocalTargetInfo,RimWorld.Pawn_MechanitorTracker,System.Boolean@)">
|
||||||
<summary>
|
<summary>
|
||||||
pushed always commandable check to front to reduct compute.
|
pushed always commandable check to front to reduct compute.
|
||||||
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.
|
||||||
@ -13,14 +13,14 @@
|
|||||||
<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>
|
||||||
<param name="__result">Commandable result from original code.</param>
|
<param name="__result">Commandable result from original code.</param>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Implants.Biotech.BiotechMechanitorPatches.Pawn_MechanitorTracker_DrawCommandRadius_Patch.DrawCommandRadiusPrefix">
|
<member name="M:LTS_Implants.BiotechMechanitorPatches.Pawn_MechanitorTracker_DrawCommandRadius_Patch.DrawCommandRadiusPrefix">
|
||||||
<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.
|
||||||
</summary>
|
</summary>
|
||||||
<returns>return false to skip original draw.</returns>
|
<returns>return false to skip original draw.</returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Implants.Biotech.BiotechMechanitorPatches.Pawn_MechanitorTracker_DrawCommandRadius_Patch.DrawCommandRadiusPostfix(RimWorld.Pawn_MechanitorTracker)">
|
<member name="M:LTS_Implants.BiotechMechanitorPatches.Pawn_MechanitorTracker_DrawCommandRadius_Patch.DrawCommandRadiusPostfix(RimWorld.Pawn_MechanitorTracker)">
|
||||||
<summary>
|
<summary>
|
||||||
Postfix the draw radius by apply our extended radius on top.
|
Postfix the draw radius by apply our extended radius on top.
|
||||||
</summary>
|
</summary>
|
||||||
|
@ -8,7 +8,7 @@ using RimWorld;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Verse;
|
using Verse;
|
||||||
|
|
||||||
namespace Implants.Anomaly
|
namespace LTS_Implants
|
||||||
{
|
{
|
||||||
|
|
||||||
public class LTS_Hediff_PsychicReaper : Hediff
|
public class LTS_Hediff_PsychicReaper : Hediff
|
@ -8,7 +8,7 @@ using RimWorld;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Verse;
|
using Verse;
|
||||||
|
|
||||||
namespace Implants.Biotech
|
namespace LTS_Implants
|
||||||
{
|
{
|
||||||
[HarmonyPatch(typeof(Gene_Deathrest))]
|
[HarmonyPatch(typeof(Gene_Deathrest))]
|
||||||
[HarmonyPatch(nameof(Gene_Deathrest.RemoveOldDeathrestBonuses))]
|
[HarmonyPatch(nameof(Gene_Deathrest.RemoveOldDeathrestBonuses))]
|
@ -9,18 +9,30 @@ using UnityEngine;
|
|||||||
using Verse;
|
using Verse;
|
||||||
using Verse.AI.Group;
|
using Verse.AI.Group;
|
||||||
|
|
||||||
namespace Implants.Biotech
|
namespace LTS_Implants
|
||||||
{
|
{
|
||||||
#region Command Range
|
#region Command Range
|
||||||
|
|
||||||
[HarmonyPatchCategory("Biotech")]
|
[HarmonyPatchCategory("Biotech")]
|
||||||
class BiotechMechanitorPatches
|
static class BiotechMechanitorPatches
|
||||||
{
|
{
|
||||||
[HarmonyPatch(typeof(Pawn_MechanitorTracker))]
|
[HarmonyPatch(typeof(Pawn_MechanitorTracker))]
|
||||||
[HarmonyPatch(nameof(Pawn_MechanitorTracker.CanCommandTo))]
|
[HarmonyPatch(nameof(Pawn_MechanitorTracker.CanCommandTo))]
|
||||||
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
|
||||||
{
|
{
|
||||||
|
private static float defaultRange = 24.9f;
|
||||||
|
[HarmonyPrepare]
|
||||||
|
static bool Prepare()
|
||||||
|
{
|
||||||
|
if (LTS_Implants.HarmonyPatches.IsCombatExtended)
|
||||||
|
{
|
||||||
|
defaultRange = 43.9f;
|
||||||
|
Verse.Log.Warning("[LTS-II-Forked]Pawn_MechanitorTracker.CanCommandTo Patch Recognized CE,default Range changed from 24.9 to 43.9");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// pushed always commandable check to front to reduct compute.
|
/// pushed always commandable check to front to reduct compute.
|
||||||
/// 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.
|
||||||
@ -38,17 +50,29 @@ namespace Implants.Biotech
|
|||||||
__instance.Pawn?.GetStatValue(StatDef.Named("MechRemoteControlDistanceOffset")) ?? 0f;
|
__instance.Pawn?.GetStatValue(StatDef.Named("MechRemoteControlDistanceOffset")) ?? 0f;
|
||||||
__result = target.Cell.InBounds(__instance.Pawn.MapHeld) &&
|
__result = target.Cell.InBounds(__instance.Pawn.MapHeld) &&
|
||||||
(float)__instance.Pawn.Position.DistanceToSquared(target.Cell) <
|
(float)__instance.Pawn.Position.DistanceToSquared(target.Cell) <
|
||||||
(24.9f + SignalBoosterRange) *
|
(defaultRange + SignalBoosterRange) *
|
||||||
(24.9f +
|
(defaultRange +
|
||||||
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))]
|
||||||
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;
|
||||||
|
[HarmonyPrepare]
|
||||||
|
static bool Prepare()
|
||||||
|
{
|
||||||
|
if (LTS_Implants.HarmonyPatches.IsCombatExtended)
|
||||||
|
{
|
||||||
|
defaultRange = 43.9f;
|
||||||
|
Verse.Log.Warning(
|
||||||
|
"[LTS-II-Forked]Pawn_MechanitorTracker.DrawCommandRadius Patch Recognized CE,default Range changed from 24.9 to 43.9");
|
||||||
|
}
|
||||||
|
|
||||||
|
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.
|
||||||
@ -75,7 +99,7 @@ namespace Implants.Biotech
|
|||||||
"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
|
"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 = 24.9f +
|
float radius = defaultRange +
|
||||||
(__instance.Pawn?.GetStatValue(
|
(__instance.Pawn?.GetStatValue(
|
||||||
StatDef.Named("MechRemoteControlDistanceOffset")) ?? 0f);
|
StatDef.Named("MechRemoteControlDistanceOffset")) ?? 0f);
|
||||||
//Make our command circle yellow. And make sure this postfix implemented draw follows vanilla impl.
|
//Make our command circle yellow. And make sure this postfix implemented draw follows vanilla impl.
|
@ -7,7 +7,7 @@ using RimWorld;
|
|||||||
using Verse;
|
using Verse;
|
||||||
using Verse.Sound;
|
using Verse.Sound;
|
||||||
|
|
||||||
namespace Implants
|
namespace LTS_Implants
|
||||||
{
|
{
|
||||||
|
|
||||||
public class LTS_CompProperties_CaptiveControl : CompProperties_AbilityEffect
|
public class LTS_CompProperties_CaptiveControl : CompProperties_AbilityEffect
|
@ -264,76 +264,6 @@ namespace LTS_Implants
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CompProperties_AbilityMechCluster : CompProperties_AbilityEffect
|
|
||||||
{
|
|
||||||
public CompProperties_AbilityMechCluster()
|
|
||||||
{
|
|
||||||
this.compClass = typeof(CompAbilityEffect_MechCluster);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float displayRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class CompAbilityEffect_MechCluster : CompAbilityEffect
|
|
||||||
{
|
|
||||||
public new CompProperties_AbilityMechCluster Props
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return (CompProperties_AbilityMechCluster)this.props;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ShouldHaveInspectString
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return ModsConfig.BiotechActive && this.parent.pawn.RaceProps.IsMechanoid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest)
|
|
||||||
{
|
|
||||||
base.Apply(target, dest);
|
|
||||||
if (Faction.OfMechanoids == null)
|
|
||||||
{
|
|
||||||
Messages.Message("MessageNoFactionForVerbMechCluster".Translate(), this.parent.pawn, MessageTypeDefOf.RejectInput, null, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MechClusterUtility.SpawnCluster(target.Cell, this.parent.pawn.MapHeld, MechClusterGenerator.GenerateClusterSketch(2500f, this.parent.pawn.MapHeld, true, true), true, false, null);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void PostApplied(List<LocalTargetInfo> targets, Map map)
|
|
||||||
{
|
|
||||||
base.PostApplied(targets, map);
|
|
||||||
if (this.parent.def.defName == "MechhiveSatelliteUplink") //add field for cooldownFactorStat. Change this if statement to if it's not null. change the contents of getstatvalue on the next line to that field.
|
|
||||||
{
|
|
||||||
this.parent.StartCooldown(Mathf.RoundToInt(this.parent.def.cooldownTicksRange.RandomInRange * this.parent.pawn?.GetStatValue(StatDef.Named("MechhiveSatelliteUplinkCooldownFactor")) ?? 1f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void DrawEffectPreview(LocalTargetInfo target)
|
|
||||||
{
|
|
||||||
GenDraw.DrawRadiusRing(target.Cell, this.Props.displayRadius);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string CompInspectStringExtra()
|
|
||||||
{
|
|
||||||
if (!this.ShouldHaveInspectString)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (this.parent.CanCast)
|
|
||||||
{
|
|
||||||
return "AbilityMechSmokepopCharged".Translate();
|
|
||||||
}
|
|
||||||
return "AbilityMechSmokepopRecharging".Translate(this.parent.CooldownTicksRemaining.ToStringTicksToPeriod(true, false, true, true, false));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//public class CompProperties_MechanitorMechCarrier : CompProperties_AbilityEffect
|
//public class CompProperties_MechanitorMechCarrier : CompProperties_AbilityEffect
|
||||||
//{
|
//{
|
||||||
// public CompProperties_MechanitorMechCarrier()
|
// public CompProperties_MechanitorMechCarrier()
|
@ -1,5 +1,6 @@
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using RimWorld;
|
||||||
using Verse;
|
using Verse;
|
||||||
|
|
||||||
namespace LTS_Implants
|
namespace LTS_Implants
|
||||||
@ -10,6 +11,7 @@ namespace LTS_Implants
|
|||||||
public static bool IsCombatExtended = false;
|
public static bool IsCombatExtended = 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
|
||||||
@ -17,15 +19,22 @@ namespace LTS_Implants
|
|||||||
IsCombatExtended = true;
|
IsCombatExtended = true;
|
||||||
if (ModLister.BiotechInstalled)
|
if (ModLister.BiotechInstalled)
|
||||||
{
|
{
|
||||||
Verse.Log.Message("[LTS Intrgated Implants Forked]Biotech found, harmony patch running");
|
Verse.Log.Message("[LTS-II-Forked]Biotech found, harmony patch running");
|
||||||
harmony.PatchCategory("Biotech");
|
if (IsCombatExtended)
|
||||||
|
{
|
||||||
|
Verse.Log.Message("[LTS-II-Forked]Unpatching CE patches to reduce overlap");
|
||||||
|
var mechanitorCanCommand = typeof(Pawn_MechanitorTracker).GetMethod("CanCommandTo");
|
||||||
|
harmony.Unpatch(mechanitorCanCommand,HarmonyPatchType.All,"CombatExtended.HarmonyCE");
|
||||||
|
var mechanitorDrawCommandRange = typeof(Pawn_MechanitorTracker).GetMethod("DrawCommandRadius");
|
||||||
|
harmony.Unpatch(mechanitorDrawCommandRange,HarmonyPatchType.All,"CombatExtended.HarmonyCE");
|
||||||
|
}
|
||||||
|
harmony.PatchCategory(Assembly.GetExecutingAssembly(), "Biotech");
|
||||||
}
|
}
|
||||||
|
|
||||||
harmony.PatchAllUncategorized(Assembly.GetExecutingAssembly());
|
harmony.PatchAllUncategorized(Assembly.GetExecutingAssembly());
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
foreach (var method in harmony.GetPatchedMethods())
|
foreach (var method in harmony.GetPatchedMethods())
|
||||||
{
|
{
|
||||||
Verse.Log.Message($"[LTS Implants]Patched Method {method.Name}");
|
Verse.Log.Message($"[LTSIIF]Patched Method {method.Name}");
|
||||||
var patchinfo = Harmony.GetPatchInfo(method);
|
var patchinfo = Harmony.GetPatchInfo(method);
|
||||||
foreach (var VARIABLE in patchinfo.Owners)
|
foreach (var VARIABLE in patchinfo.Owners)
|
||||||
{
|
{
|
Loading…
Reference in New Issue
Block a user