Skip to content

Commit

Permalink
Workaround for mod lists that contain other mods with an outdated cop…
Browse files Browse the repository at this point in the history
…y of CompOversizedWeapon that's loaded before ours: have CompActivatableEffect not reference new code in our version of CompOversizedWeapon
  • Loading branch information
lbmaian committed Jul 30, 2021
1 parent 33fad45 commit 2cc7087
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Binary file modified 1.3/Assemblies/CompActivatableEffect.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static void DrawEquipmentAimingPostFix(Pawn ___pawn, Thing eq, Vector3 dr
var weaponComp = compActivatableEffect.GetOversizedWeapon;
if (weaponComp != null)
{
offset = weaponComp.Props.OffsetFromRotation(___pawn.Rotation);
offset = OffsetFromRotation(weaponComp.Props, ___pawn.Rotation);
}

if (compActivatableEffect.CompDeflectorIsAnimatingNow)
Expand All @@ -147,6 +147,20 @@ public static void DrawEquipmentAimingPostFix(Pawn ___pawn, Thing eq, Vector3 dr
Graphics.DrawMesh(flip ? MeshPool.plane10Flip : MeshPool.plane10, matrix, matSingle, 0);
}

// Workaround for mod lists that contain other mods with an outdated copy of CompOversizedWeapon that's loaded before ours:
// avoid calling new code that's in our version.
private static Vector3 OffsetFromRotation(CompOversizedWeapon.CompProperties_OversizedWeapon weaponComp, Rot4 rotation)
{
if (rotation == Rot4.North)
return weaponComp.northOffset;
else if (rotation == Rot4.East)
return weaponComp.eastOffset;
else if (rotation == Rot4.West)
return weaponComp.westOffset;
else
return weaponComp.southOffset;
}

public static void GetGizmosPostfix(Pawn_EquipmentTracker __instance, ref IEnumerable<Gizmo> __result)
{
if (__instance.Primary?.GetCompActivatableEffect() is CompActivatableEffect compActivatableEffect)
Expand Down

0 comments on commit 2cc7087

Please sign in to comment.