Skip to content

Commit

Permalink
fixed performance problems + version up
Browse files Browse the repository at this point in the history
  • Loading branch information
rheirman committed May 1, 2020
1 parent b1c9c63 commit ecb29e0
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion About/Version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
but no minimum version will be required -->

<!-- Optional. This specifies the version of your mod for the library. Otherwise, the version of your mod's assembly will be used. -->
<overrideVersion>2.0.0</overrideVersion>
<overrideVersion>2.0.3</overrideVersion>
<!-- Optional. Use this to specify the version of HugsLib you are targeting.
See https://github.com/UnlimitedHugs/RimworldHugsLib/releases for the current version of the library.-->
<requiredLibraryVersion>6.0.0</requiredLibraryVersion>
Expand Down
Binary file added v1.1/Assemblies/0MultiplayerAPI.dll
Binary file not shown.
Binary file modified v1.1/Assemblies/GiddyUpCore.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ namespace GiddyUpCore.Harmony
static class Pawn_DrawTracker_get_DrawPos
{

static void Postfix(Pawn_DrawTracker __instance, ref Vector3 __result)
static void Postfix(Pawn_DrawTracker __instance, ref Vector3 __result, ref Pawn ___pawn)
{
Vector3 drawLoc = __result;
Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue<Pawn>();
ExtendedDataStorage store = Base.Instance.GetExtendedDataStorage();

if (store == null)
{
return;
}
ExtendedPawnData pawnData = store.GetExtendedDataFor(pawn);
ExtendedPawnData pawnData = store.GetExtendedDataFor(___pawn);

if (pawnData != null && pawnData.mount != null)
{
Expand All @@ -38,9 +37,9 @@ static void Postfix(Pawn_DrawTracker __instance, ref Vector3 __result)
}
if (pawnData.mount.def.HasModExtension<DrawingOffsetPatch>())
{
drawLoc += AddCustomOffsets(pawn, pawnData);
drawLoc += AddCustomOffsets(___pawn, pawnData);
}
if (pawn.Rotation == Rot4.South )
if (___pawn.Rotation == Rot4.South )
{
AnimalRecord value;
bool found = Base.drawSelecter.Value.InnerList.TryGetValue(pawnData.mount.def.defName, out value);
Expand Down
7 changes: 3 additions & 4 deletions v1.1/Source/Giddy-up-Core/Harmony/Pawn_HealthTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,16 @@ static void Postfix(Pawn_HealthTracker __instance)
[HarmonyPatch(typeof(Pawn_HealthTracker), "SetDead")]
static class Pawn_HealthTracker_SetDead
{
static void Postfix(Pawn_HealthTracker __instance)
static void Postfix(Pawn_HealthTracker __instance, ref Pawn ___pawn)
{
Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue<Pawn>();

//If the owner of an NPC mount is downed, let the animal flee
if (pawn.RaceProps.Humanlike && pawn.Faction != null && !pawn.Faction.IsPlayer)
if (___pawn.RaceProps.Humanlike && ___pawn.Faction != null && !___pawn.Faction.IsPlayer)
{
ExtendedDataStorage dataStorage = Base.Instance.GetExtendedDataStorage();
if (dataStorage != null)
{
ExtendedPawnData pawnData = dataStorage.GetExtendedDataFor(pawn);
ExtendedPawnData pawnData = dataStorage.GetExtendedDataFor(___pawn);
if (pawnData != null && pawnData.owning != null && !pawnData.owning.Dead && pawnData.owning.Spawned)
{
pawnData.owning.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.PanicFlee);
Expand Down
7 changes: 3 additions & 4 deletions v1.1/Source/Giddy-up-Core/Harmony/Pawn_RotationTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ namespace GiddyUpCore.Harmony
[HarmonyPatch(typeof(Pawn_RotationTracker), "UpdateRotation")]
class Pawn_RotationTracker_UpdateRotation
{
static bool Prefix(ref Pawn_RotationTracker __instance)
static bool Prefix(ref Pawn_RotationTracker __instance, ref Pawn ___pawn)
{
Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue<Pawn>();
if(!pawn.Destroyed && pawn.jobs.curDriver is JobDriver_Mounted jobDriver)
if(!___pawn.Destroyed && ___pawn.jobs.curDriver is JobDriver_Mounted jobDriver)
{
pawn.Rotation = jobDriver.Rider.Rotation;
___pawn.Rotation = jobDriver.Rider.Rotation;
return false;
//Log.Message("changing rotation for mech");
//__instance.Face(jobDriver.Rider.Rotation.FacingCell.ToVector3());
Expand Down

0 comments on commit ecb29e0

Please sign in to comment.