Skip to content

Commit

Permalink
Merge pull request #3110 from Rhinous/Development
Browse files Browse the repository at this point in the history
Fix pawns not generating ammo for primary weapon
  • Loading branch information
N7Huntsman authored May 1, 2024
2 parents 27425c3 + 80e539c commit f7ea88e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
25 changes: 0 additions & 25 deletions Source/CombatExtended/Harmony/Harmony_PawnInventoryGenerator.cs

This file was deleted.

25 changes: 25 additions & 0 deletions Source/CombatExtended/Harmony/Harmony_PawnWeaponGenerator.cs
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);
}
}
}
}

0 comments on commit f7ea88e

Please sign in to comment.