Skip to content

Commit

Permalink
Update CE_Utility.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
CMDR-Bill-Doors committed Jan 23, 2024
1 parent 6253b9d commit f46965a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Source/CombatExtended/CombatExtended/CE_Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,25 @@ public static Texture2D BlitCrop(this Texture2D texture, Rect blitRect)
#endregion

#region Misc
/// <summary>
/// Generates a random Vector2 in a circle with given radius
/// </summary>

public static T GetLastModExtension<T>(this Def def) where T : DefModExtension
{
if (def.modExtensions == null)
{
return null;
}
for (int i = def.modExtensions.Count - 1; i >= 0; i--)
{
if (def.modExtensions[i] is T)
{
return def.modExtensions[i] as T;
}
}
return null;
}

/// <summary>
/// Gets the true rating of armor with partial stats taken into account
Expand Down

0 comments on commit f46965a

Please sign in to comment.