Skip to content

Commit

Permalink
Merge pull request #19 from lbmaian/master
Browse files Browse the repository at this point in the history
Workaround for mod lists that contain other mods with an outdated copy of CompOversizedWeapon that's loaded before ours
  • Loading branch information
jecrell authored Jul 31, 2021
2 parents 90bfe24 + 2cc7087 commit 61f737c
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 8 deletions.
Binary file modified 1.3/Assemblies/0JecsTools.dll
Binary file not shown.
Binary file modified 1.3/Assemblies/AbilityUser.dll
Binary file not shown.
Binary file modified 1.3/Assemblies/CompActivatableEffect.dll
Binary file not shown.
Binary file modified 1.3/Assemblies/CompBigBox.dll
Binary file not shown.
Binary file modified 1.3/Assemblies/CompDeflector.dll
Binary file not shown.
Binary file modified 1.3/Assemblies/CompExtraSounds.dll
Binary file not shown.
Binary file modified 1.3/Assemblies/CompInstalledPart.dll
Binary file not shown.
Binary file modified 1.3/Assemblies/CompOversizedWeapon.dll
Binary file not shown.
Binary file modified 1.3/Assemblies/CompSlotLoadable.dll
Binary file not shown.
Binary file modified 1.3/Assemblies/CompToggleDef.dll
Binary file not shown.
Binary file modified 1.3/Assemblies/PawnShields.dll
Binary file not shown.
3 changes: 2 additions & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Improvements by lbmaian

Thank you to my Patrons for supporting me in my efforts. Without you, none of this would be possible.

These are the most excellent rim dwellers who support me:
These are the most excellent rim dwellers who support me:
Michael Cailler, Jigsawjohn , Daniel Schott, Penelope Charli Whitman, Jerome Gonschorek, Genaeve , RainerWingel , Lea Stannard, David Silberstein, 수현 남, Matt Harris, Kiya Nicoll, Paul Fenwick, Matthew Isom, Elodie , Михаил Юрченко, Charlie Garnham, Populous25 , Landon Cash, Marcus Sireanu, Maaxar , logan sheppard-organ, TinyATuin, Don Homer, Sharp Spook, roxxploxx , Dan Jones, Kaz, Justin Andres, Alex Mederer, Justin , iknowdude00, E_T , Alexander , Ken Birdwell, Michael Cailler, Jigsawjohn , Daniel Schott, Penelope Charli Whitman, Jerome Gonschorek, Genaeve , RainerWingel , Lea Stannard, David Silberstein, 수현 남, Matt Harris, Kiya Nicoll, Paul Fenwick, Matthew Isom, Elodie , Михаил Юрченко, Charlie Garnham, Populous25 , Landon Cash, Marcus Sireanu, Maaxar , logan sheppard-organ, TinyATuin, Don Homer, Sharp Spook, roxxploxx , Dan Jones, Kaz, Justin Andres, Alex Mederer, Justin , iknowdude00, E_T , Alexander , Ken Birdwell

========================
Expand Down Expand Up @@ -131,6 +131,7 @@ New features and fixes:
- knockDistance now accepts floating points
- add knockDistanceAbsorbedPercentCurve and knockDistanceMassCurve that controls how damage soak and mass affect knock distance
- improve push angle algorithm so that it's no longer always a diagonal
- prevent multiple knockbacks occurring due to multiple damage infos (e.g. extra damage) for same instigator+target
- FlyingObject: configurable props (ProjectileProperties) and accuracyRadius
- FlyingObject_Equipable allows equipping apparel along (not just weapons)
- PawnShields: support generating biocoded shields when generating pawns
Expand Down
1 change: 1 addition & 0 deletions About/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ New features and fixes:
- knockDistance now accepts floating points
- add knockDistanceAbsorbedPercentCurve and knockDistanceMassCurve that controls how damage soak and mass affect knock distance
- improve push angle algorithm so that it's no longer always a diagonal
- prevent multiple knockbacks occurring due to multiple damage infos (e.g. extra damage) for same instigator+target
- FlyingObject: configurable props (ProjectileProperties) and accuracyRadius
- FlyingObject_Equipable allows equipping apparel along (not just weapons)
- PawnShields: support generating biocoded shields when generating pawns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ protected override void Impact(Thing hitThing)
if (flyingThing != null)
{
GenSpawn.Spawn(flyingThing, Position, Map);
if (launcher is Pawn equipper && equipper.equipment != null && flyingThing is ThingWithComps flyingThingWithComps)
if (launcher is Pawn {equipment: not null} equipper && flyingThing is ThingWithComps flyingThingWithComps)
Equip(equipper, flyingThingWithComps);
}
Destroy();
Expand All @@ -21,7 +21,7 @@ public void Equip(Pawn equipper, ThingWithComps thingWithComps)
{
if (thingWithComps.def.IsApparel)
{
Apparel apparel = (Apparel)thingWithComps;
var apparel = (Apparel)thingWithComps;
equipper.apparel.Wear(apparel);
equipper.outfits?.forcedHandler.SetForced(apparel, true);
}
Expand Down
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using UnityEngine;
using UnityEngine;
using Verse;

namespace CompOversizedWeapon
Expand Down
4 changes: 2 additions & 2 deletions Source/AllModdingComponents/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>1.3.0.2</Version>
<!--
For some reason, although SDK projects should default Deterministic to true, when importing this props build,
For some reason, although SDK projects should default Deterministic to true, when importing this props file,
builds become non-deterministic unless Deterministic is explicitly set to true here.
-->
<Deterministic>true</Deterministic>
Expand Down Expand Up @@ -40,6 +40,6 @@
</When>
</Choose>
<ItemGroup>
<PackageReference Include="Lib.Harmony" Version="2.1.0" ExcludeAssets="runtime" />
<PackageReference Include="Lib.Harmony" Version="2.1.*" ExcludeAssets="runtime" />
</ItemGroup>
</Project>

0 comments on commit 61f737c

Please sign in to comment.