-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3110 from Rhinous/Development
Fix pawns not generating ammo for primary weapon
- Loading branch information
Showing
2 changed files
with
25 additions
and
25 deletions.
There are no files selected for viewing
25 changes: 0 additions & 25 deletions
25
Source/CombatExtended/Harmony/Harmony_PawnInventoryGenerator.cs
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
Source/CombatExtended/Harmony/Harmony_PawnWeaponGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using RimWorld; | ||
using Verse; | ||
using UnityEngine; | ||
using HarmonyLib; | ||
|
||
namespace CombatExtended.HarmonyCE | ||
{ | ||
[HarmonyPatch(typeof(PawnWeaponGenerator), "TryGenerateWeaponFor")] | ||
static class Harmony_PawnWeaponGenerator_TryGenerateWeaponFor | ||
{ | ||
public static void Postfix(Pawn pawn, PawnGenerationRequest request) | ||
{ | ||
var loadoutProps = pawn.kindDef.GetModExtension<LoadoutPropertiesExtension>(); | ||
if (loadoutProps != null) | ||
{ | ||
float biocodeChance = (request.BiocodeWeaponChance > 0f) ? request.BiocodeWeaponChance : pawn.kindDef.biocodeWeaponChance; //pass biocode weapon chance to generate loadout | ||
loadoutProps.GenerateLoadoutFor(pawn, biocodeChance); | ||
} | ||
} | ||
} | ||
} |