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
|
||||
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;
|
||||
|
||||
[HarmonyPrepare]
|
||||
static bool Prepare()
|
||||
{
|
||||
//If CE,use CE value as default instead.unpatching is done in main patchBootstrap.
|
||||
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");
|
||||
Verse.Log.Warning(
|
||||
"[LTS-II-Forked]Pawn_MechanitorTracker.CanCommandTo Patch Recognized CE,default Range changed from 24.9 to 43.9");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// pushed always commandable check to front to reduct compute.
|
||||
/// TODO perhaps need a custom patch order to make sure this logic always works.
|
||||
/// pushed always commandable check to front to reduce compute overhead.
|
||||
/// TODO:perhaps need a custom patch order to make sure this logic always works.
|
||||
/// </summary>
|
||||
/// <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>
|
||||
@ -55,15 +61,27 @@ namespace LTS_Implants
|
||||
SignalBoosterRange); //last line should mean that if something else makes it true, then it is(?)
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Pawn_MechanitorTracker))]
|
||||
[HarmonyPatch(nameof(Pawn_MechanitorTracker.DrawCommandRadius))]
|
||||
static class
|
||||
Pawn_MechanitorTracker_DrawCommandRadius_Patch //increases the displayed mechanitor range by MechRemoteControlDistanceOffset
|
||||
{
|
||||
private static float defaultRange = 24.9f;
|
||||
|
||||
[HarmonyPrepare]
|
||||
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)
|
||||
{
|
||||
defaultRange = 43.9f;
|
||||
@ -73,9 +91,11 @@ namespace LTS_Implants
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Skip original draw radius using a prefix.
|
||||
/// TODO may need specify fixed patch order to make sure this works.
|
||||
/// TODO:may need unpatch other conflict mods to make this work.
|
||||
/// </summary>
|
||||
/// <returns>return false to skip original draw.</returns>
|
||||
[HarmonyPrefix]
|
||||
@ -94,10 +114,6 @@ namespace LTS_Implants
|
||||
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));
|
||||
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;
|
||||
float radius = defaultRange +
|
||||
(__instance.Pawn?.GetStatValue(
|
||||
@ -109,14 +125,14 @@ namespace LTS_Implants
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Resurrect
|
||||
#region Resurrect
|
||||
|
||||
public class CompProperties_MechanitorResurrectMech : CompProperties_AbilityEffect
|
||||
{
|
||||
public class CompProperties_MechanitorResurrectMech : CompProperties_AbilityEffect
|
||||
{
|
||||
public CompProperties_MechanitorResurrectMech()
|
||||
{
|
||||
this.compClass = typeof(CompAbilityEffect_MechanitorResurrectMech);
|
||||
@ -129,10 +145,10 @@ namespace LTS_Implants
|
||||
public EffecterDef resolveEffecterDef;
|
||||
|
||||
//public EffecterDef centerEffecterDef;
|
||||
}
|
||||
}
|
||||
|
||||
public class CompAbilityEffect_MechanitorResurrectMech : CompAbilityEffect
|
||||
{
|
||||
public class CompAbilityEffect_MechanitorResurrectMech : CompAbilityEffect
|
||||
{
|
||||
public new CompProperties_MechanitorResurrectMech Props
|
||||
{
|
||||
get { return (CompProperties_MechanitorResurrectMech)this.props; }
|
||||
@ -237,22 +253,22 @@ namespace LTS_Implants
|
||||
this.Props.resolveEffecterDef.Spawn(intVec, map, 1f).EffectTick(new TargetInfo(intVec, map, false),
|
||||
new TargetInfo(intVec, map, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Remote Dominate
|
||||
#region Remote Dominate
|
||||
|
||||
public class CompProperties_MechanitorDominateMech : CompProperties_AbilityEffect
|
||||
{
|
||||
public class CompProperties_MechanitorDominateMech : CompProperties_AbilityEffect
|
||||
{
|
||||
public CompProperties_MechanitorDominateMech()
|
||||
{
|
||||
this.compClass = typeof(CompAbilityEffect_MechanitorDominateMech);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class CompAbilityEffect_MechanitorDominateMech : CompAbilityEffect
|
||||
{
|
||||
public class CompAbilityEffect_MechanitorDominateMech : CompAbilityEffect
|
||||
{
|
||||
public new CompProperties_MechanitorDominateMech Props
|
||||
{
|
||||
get { return (CompProperties_MechanitorDominateMech)this.props; }
|
||||
@ -345,14 +361,14 @@ namespace LTS_Implants
|
||||
//IntVec3 intVec = vector.ToIntVec3();
|
||||
//this.Props.resolveEffecterDef.Spawn(intVec, map, 1f).EffectTick(new TargetInfo(intVec, map, false), new TargetInfo(intVec, map, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Mech carrier
|
||||
#region Mech carrier
|
||||
|
||||
public class CompProperties_MechanitorMechCarrier : CompProperties_AbilityEffect
|
||||
{
|
||||
public class CompProperties_MechanitorMechCarrier : CompProperties_AbilityEffect
|
||||
{
|
||||
public CompProperties_MechanitorMechCarrier()
|
||||
{
|
||||
this.compClass = typeof(CompAbilityEffect_MechanitorMechCarrier);
|
||||
@ -365,10 +381,10 @@ namespace LTS_Implants
|
||||
public EffecterDef spawnedMechEffecter;
|
||||
public bool attachSpawnedEffecter;
|
||||
public bool attachSpawnedMechEffecter;
|
||||
}
|
||||
}
|
||||
|
||||
public class CompAbilityEffect_MechanitorMechCarrier : CompAbilityEffect
|
||||
{
|
||||
public class CompAbilityEffect_MechanitorMechCarrier : CompAbilityEffect
|
||||
{
|
||||
public new CompProperties_MechanitorMechCarrier Props
|
||||
{
|
||||
get { return (CompProperties_MechanitorMechCarrier)this.props; }
|
||||
@ -473,20 +489,20 @@ namespace LTS_Implants
|
||||
private int cooldownTicksRemaining;
|
||||
private List<Pawn> spawnedPawns = new List<Pawn>();
|
||||
public SoundDef soundReload;
|
||||
}
|
||||
}
|
||||
|
||||
public class HediffCompProperties_KillSpawnedPawns : HediffCompProperties
|
||||
{
|
||||
public class HediffCompProperties_KillSpawnedPawns : HediffCompProperties
|
||||
{
|
||||
public AbilityDef abilityDef;
|
||||
|
||||
public HediffCompProperties_KillSpawnedPawns()
|
||||
{
|
||||
compClass = typeof(HediffComp_KillSpawnedPawns);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HediffComp_KillSpawnedPawns : HediffComp
|
||||
{
|
||||
public class HediffComp_KillSpawnedPawns : HediffComp
|
||||
{
|
||||
public HediffCompProperties_KillSpawnedPawns Props => (HediffCompProperties_KillSpawnedPawns)props;
|
||||
|
||||
public override void Notify_PawnKilled()
|
||||
@ -500,24 +516,24 @@ namespace LTS_Implants
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Call a cluster
|
||||
#region Call a cluster
|
||||
|
||||
public class CompProperties_AbilityMechCluster : CompProperties_AbilityEffect
|
||||
{
|
||||
public class CompProperties_AbilityMechCluster : CompProperties_AbilityEffect
|
||||
{
|
||||
public CompProperties_AbilityMechCluster()
|
||||
{
|
||||
this.compClass = typeof(CompAbilityEffect_MechCluster);
|
||||
}
|
||||
|
||||
public float displayRadius;
|
||||
}
|
||||
}
|
||||
|
||||
public class CompAbilityEffect_MechCluster : CompAbilityEffect
|
||||
{
|
||||
public class CompAbilityEffect_MechCluster : CompAbilityEffect
|
||||
{
|
||||
public new CompProperties_AbilityMechCluster Props
|
||||
{
|
||||
get { return (CompProperties_AbilityMechCluster)this.props; }
|
||||
@ -575,7 +591,8 @@ namespace LTS_Implants
|
||||
return "AbilityMechSmokepopRecharging".Translate(
|
||||
this.parent.CooldownTicksRemaining.ToStringTicksToPeriod(true, false, true, true, false));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
@ -10,11 +10,11 @@
|
||||
<FileVersion>1.0.0.0</FileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>..\</OutputPath>
|
||||
<OutputPath>..\1.5\Assemblies\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
|
||||
<DocumentationFile>..\Implants.xml</DocumentationFile>
|
||||
<DocumentationFile>..\1.5\Assemblies\Implants.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<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 CompProperties_MechanitorMechCarrier()
|
||||
@ -448,9 +450,6 @@ namespace LTS_Implants
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// public override bool GizmoDisabled(out string reason)
|
||||
// {
|
||||
// //Log.Warning(ingredientCountRemaining + " out of "+ Props.costPerPawn + " steel.");
|
||||
@ -463,14 +462,6 @@ namespace LTS_Implants
|
||||
// return base.GizmoDisabled(out reason);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// public int remainingCharges
|
||||
// {
|
||||
// get
|
||||
@ -589,6 +580,10 @@ namespace LTS_Implants
|
||||
// // }
|
||||
// //}
|
||||
//}
|
||||
#endregion
|
||||
#region Psychic Shield
|
||||
|
||||
|
||||
|
||||
//public class LTS_ShieldHediff : Hediff_Implant
|
||||
//{
|
||||
@ -663,7 +658,7 @@ namespace LTS_Implants
|
||||
|
||||
// }
|
||||
//}
|
||||
|
||||
#endregion
|
||||
public class LTS_HediffCompProperties_Mote : HediffCompProperties
|
||||
{
|
||||
//public AbilityDef abilityDef;
|
||||
|
@ -9,20 +9,24 @@ namespace LTS_Implants
|
||||
public static class HarmonyPatches
|
||||
{
|
||||
public static bool IsCombatExtended = false;
|
||||
public static bool IsSarg = false;
|
||||
static HarmonyPatches()
|
||||
{
|
||||
Verse.Log.Message("[LTS-II-Forked]Unpatching CE patches to reduce overlap");
|
||||
Harmony harmony = new Harmony("rimworld.LTS.implants");
|
||||
Harmony.DEBUG = false;
|
||||
//Check if we are in a CE enabled env
|
||||
if(ModLister.GetModWithIdentifier("ceteam.combatextended")!=null)
|
||||
if (ModLister.GetModWithIdentifier("ceteam.combatextended") != null)
|
||||
{
|
||||
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)
|
||||
{
|
||||
Verse.Log.Message("[LTS-II-Forked]Biotech found, harmony patch running");
|
||||
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");
|
||||
harmony.Unpatch(mechanitorCanCommand,HarmonyPatchType.All,"CombatExtended.HarmonyCE");
|
||||
var mechanitorDrawCommandRange = typeof(Pawn_MechanitorTracker).GetMethod("DrawCommandRadius");
|
||||
|
Loading…
Reference in New Issue
Block a user