public static void Patch_Pawn_EquipmentTracker_MakeRoomFor(Pawn_EquipmentTracker __instance, ref ThingWithComps eq) { CompShield shieldComp = eq.TryGetComp <CompShield>(); if (shieldComp != null) { //Unequip any existing shield. ThingWithComps shield = __instance.GetShield(); if (shield != null) { Pawn pawn = EquipmentTracker_GetPawn(__instance); ThingWithComps thingWithComps; if (__instance.TryDropEquipment(shield, out thingWithComps, pawn.Position, true)) { if (thingWithComps != null) { thingWithComps.SetForbidden(false, true); } } else { Log.Error(pawn + " couldn't make room for shield " + eq); } } } }
private static void StatWorkerInjection_BuildShieldString(StringBuilder stringBuilder, Pawn_EquipmentTracker equipment, StatDef stat) { var shield = equipment.GetShield(); if (shield != null && GearAffectsStats(shield.def, stat)) { stringBuilder.AppendLine(InfoTextLineFromGear(shield, stat)); } }
private static void StatWorkerInjection_AddShieldValue(ref float result, Pawn_EquipmentTracker equipment, StatDef stat) { var shield = equipment.GetShield(); if (shield != null) { result += shield.def.equippedStatOffsets.GetStatOffsetFromList(stat); } }
public static void Patch_Pawn_EquipmentTracker_MakeRoomFor(Pawn_EquipmentTracker __instance, Pawn ___pawn, ThingWithComps eq) { var shieldComp = eq.GetCompShield(); if (shieldComp != null) { //Unequip any existing shield. var shield = __instance.GetShield(); if (shield != null) { if (__instance.TryDropEquipment(shield, out var thingWithComps, ___pawn.Position, true)) { thingWithComps?.SetForbidden(false, true); } else { Log.Error(___pawn + " couldn't make room for shield " + eq); } } }