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);
                    }
                }
            }
        }
예제 #2
0
        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));
            }
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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);
                    }
                }
            }