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

Misc fixes #27

Merged
merged 3 commits into from
Oct 21, 2022
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
11 changes: 10 additions & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,22 @@ Michael Fisher, Storm D Bain, Luke Salinas, WonkyWoo WeebHoo, Daniel Schott, Rai
========================
Changelog
========================
1.3.0.5 (10-09-2022)
========================
Updated assemblies for RimWorld 1.4 unstable support.
- JecsTools BackstoryDef now inherits new RimWorld BackstoryDef setup. Once again based on erdelf's work.

1.3.0.4 (08-08-2022)
========================
damageTypesToExclude was not working correctly and has been fixed. Grappling a pet will always succeed which should prevent some fustration. Credit for this update goes to Gefallener from our RoM Discord.

1.3.0.3b (07-31-2021)
====================
Workaround for mod lists that contain other mods with an outdated copy of CompOversizedWeapon that's loaded before ours

1.3.0.3 (07-30-2021)
========================
Due to comptability issues, the patch for Enable Oversized Weapons will require additional work. Reverting back to the previous version.
Due to compatibility issues, the patch for Enable Oversized Weapons will require additional work. Reverting back to the previous version.

1.3.0.2 (07-29-2021)
========================
Expand Down
6 changes: 5 additions & 1 deletion About/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ Updated assemblies for RimWorld 1.4 unstable support.
========================
damageTypesToExclude was not working correctly and has been fixed. Grappling a pet will always succeed which should prevent some fustration. Credit for this update goes to Gefallener from our RoM Discord.

1.3.0.3b (07-31-2021)
====================
Workaround for mod lists that contain other mods with an outdated copy of CompOversizedWeapon that's loaded before ours

1.3.0.3 (07-30-2021)
========================
Due to comptability issues, the patch for Enable Oversized Weapons will require additional work. Reverting back to the previous version.
Due to compatibility issues, the patch for Enable Oversized Weapons will require additional work. Reverting back to the previous version.

1.3.0.2 (07-29-2021)
========================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<!-- See also ..\Directory.Build.props, which contains common contents between all the csproj files -->
<PropertyGroup>
<AssemblyName>AbilityUserAI</AssemblyName>
<Configurations>RW1.3;RW1.3Unstable;RW1.4;RW1.4Unstable</Configurations>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\JecsTools\JecsTools.csproj" />
Expand Down
6 changes: 3 additions & 3 deletions Source/AllModdingComponents/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<Configuration Condition=" '$(Configuration)' == '' ">RW1.4Unstable</Configuration>
<TargetFramework>net472</TargetFramework>
<NoStdLib>true</NoStdLib>
<LangVersion>9.0</LangVersion>
<LangVersion>10.0</LangVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Version>1.3.0.2</Version>
<Version>$([System.IO.File]::ReadAllText("..\About\Version.txt"))</Version>
<!--
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.
Expand Down Expand Up @@ -40,6 +40,6 @@
</When>
</Choose>
<ItemGroup>
<PackageReference Include="Lib.Harmony" Version="2.1.*" ExcludeAssets="runtime" />
<PackageReference Include="Lib.Harmony" Version="2.2.*" ExcludeAssets="runtime" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public static Vector3 PushResult(Thing caster, Thing thingToPush, float distance
var targetLoc = originLoc + direction * distance;
var targetCell = targetLoc.ToIntVec3();
var prevCell = originCell;
var pathGrid = (thingToPush is Pawn pawnToPush ? map.pathing.For(pawnToPush) : map.pathing.Normal).pathGrid;
var state = PushSearchState.NoCollision;

// Using GenSight, which isn't ideal since it's IntVec3-based rather than Vector-based,
Expand All @@ -153,7 +154,7 @@ public static Vector3 PushResult(Thing caster, Thing thingToPush, float distance
{
state = PushSearchState.OutOfBounds;
}
else if (map.pathing.Normal.pathGrid.WalkableFast(cell) && !cell.Impassable(map))
else if (pathGrid.WalkableFast(cell) && !cell.Impassable(map))
{
if (cell.GetEdifice(map) is Building_Door door && !door.Open)
state = PushSearchState.ClosedDoor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color gho
drawFieldCells.Add(c);
GenDraw.DrawFieldEdges(drawFieldCells, Color.Lerp(ghostCol, transparentWhite, 0.5f));
}

}
}
14 changes: 14 additions & 0 deletions Source/AllModdingComponents/PawnShields/Utility/ShieldUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ public static bool HasCompShield(this ThingWithComps thing)
return false;
}

// Avoiding ThingDef.GetCompProperties<T> and implementing a specific non-generic version of it here.
// That method is slow because the `isinst` instruction with generic type arg operands is very slow,
// while `isinst` instruction against non-generic type operand like used below is fast.
public static CompProperties_Shield GetCompShieldProperties(this ThingDef def)
{
var allProps = def.comps;
for (int i = 0, count = allProps.Count; i < count; i++)
{
if (allProps[i] is CompProperties_Shield props)
return props;
}
return null;
}

// Avoiding Def.GetModExtension<T> and implementing a specific non-generic version of it here.
// That method is slow because the `isinst` instruction with generic type arg operands is very slow,
// while `isinst` instruction against non-generic type operand like used below is fast.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private bool IsDisabledForShield(StatRequest req)
{
if (req.Def is ThingDef def)
{
var shieldProps = def.GetCompProperties<CompProperties_Shield>();
var shieldProps = def.GetCompShieldProperties();
if (shieldProps != null && IsDisabledForShield(shieldProps))
return true;
}
Expand Down
Loading