Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix facial animation invisibility bug, fix portrait rendering. #56

Merged
merged 1 commit into from
Jun 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/1.5/AMRetextureSupport/AMRetextureSupport.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4085" />
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4104" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Source/1.5/AlienRacesPatch/AlienRacesPatch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4085" />
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4104" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Source/1.5/AnimationMod/AnimationMod.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4085" />
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4104" />
<PackageReference Include="Portable.Meta.Numerics" Version="3.1.0.73149" />
<ProjectReference Include="..\AMRetextureSupport\AMRetextureSupport.csproj" />
<ProjectReference Include="..\ModRequestAPI\ModRequestAPI.csproj" />
Expand Down
7 changes: 7 additions & 0 deletions Source/1.5/AnimationMod/Idle/IdleControllerComp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,13 @@ public virtual void NotifyPawnDidMeleeAttack(Thing target, Verb_MeleeAttack verb
// Check valid state.
var pawn = parent as Pawn;
var weapon = GetMeleeWeapon();

// If there is no weapon, and Fists of Fury is not active, then don't play an attack animation.
if (weapon == null && !Core.IsFistsOfFuryActive)
{
return;
}

var rot = pawn.Rotation;
var anims = GetAttackAnimationsFor(pawn, weapon, out bool allowPauseEver);
if (anims == null || anims.Count == 0)
Expand Down
2 changes: 1 addition & 1 deletion Source/1.5/AnimationMod/Outcome/OutcomeUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ private static bool Failure(Pawn attacker, Pawn target, in AdditionalArgs _)

private static bool IsDeathless(Pawn pawn)
{
return pawn.genes?.HasGene(GeneDefOf.Deathless) ?? false;
return pawn.genes?.HasActiveGene(GeneDefOf.Deathless) ?? false;
}

private static bool Kill(Pawn killer, Pawn pawn, in AdditionalArgs args)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using HarmonyLib;
using Verse;

namespace AM.Patches;

/// <summary>
/// This patch is only used to prevent pawns from rendering as invisible when they are in the portrait.
/// </summary>
[HarmonyPatch(typeof(PawnRenderTree), nameof(PawnRenderTree.ParallelPreDraw))]
public class Patch_PawnRenderTree_ParallelPreDraw
{
[HarmonyPriority(Priority.First)]
public static void Prefix(PawnDrawParms parms, ref State __state)
{
if (!parms.flags.HasFlag(PawnRenderFlags.Portrait))
{
__state = default;
return;
}

if (!Patch_InvisibilityUtility_IsPsychologicallyInvisible.IsRendering)
{
__state.DidChangeIsRenderingToTrue = true;
Patch_InvisibilityUtility_IsPsychologicallyInvisible.IsRendering = true;
}
}

[HarmonyPriority(Priority.First)]
public static void Postfix(ref State __state)
{
if (__state.DidChangeIsRenderingToTrue)
{
Patch_InvisibilityUtility_IsPsychologicallyInvisible.IsRendering = false;
}
}

public struct State
{
public bool DidChangeIsRenderingToTrue;
}
}
2 changes: 1 addition & 1 deletion Source/1.5/CAI5000Patch/CAI5000Patch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4085" />
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4104" />
<Publicize Include="CombatAI" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Source/1.5/CombatExtendedPatch/CombatExtendedPatch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<Private>False</Private>
<ExcludeAssets>all</ExcludeAssets>
</ProjectReference>
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4085" />
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4104" />
<Publicize Include="CombatExtended" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4085" />
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4104" />
<PackageReference Include="Lib.Harmony" Version="2.3.3">
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
Expand Down
5 changes: 5 additions & 0 deletions Source/1.5/FacialAnimationPatch/PatchCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

namespace AM.FacialAnimationPatch;

/// <summary>
/// Note to future maintainers: This patch assembly currently does nothing, it
/// used to have some Harmony patches, now they are no longer required.
/// Removing the patch csproj, and doing the build pipeline changes required would be annoying, so I'm keeping it.
/// </summary>
[UsedImplicitly]
[HotSwapAll]
public sealed class PatchCore : Mod
Expand Down

This file was deleted.

Binary file modified Source/1.5/FacialAnimationPatch/refs/FacialAnimation.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Source/1.5/LightsaberPatch/LightsaberPatch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<Private>False</Private>
<ExcludeAssets>all</ExcludeAssets>
</ProjectReference>
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4085" />
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4104" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Source/1.5/ModRequestAPI/ModRequestAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4085" />
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4104" />
<PackageReference Include="Unity.Newtonsoft.Json" Version="7.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<ExcludeAssets>all</ExcludeAssets>
</ProjectReference>
<Publicize Include="PerformanceOptimizer" />
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4085" />
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4104" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Source/1.5/TacticowlPatch/TacticowlPatch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<Private>False</Private>
<ExcludeAssets>all</ExcludeAssets>
</ProjectReference>
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4085" />
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.5.4104" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading