예제 #1
0
        static void Postfix(Pawn __instance, ref State __state)
        {
            if (__instance.Dead && __instance.IsColonist && __instance.apparel?.LockedApparel?.Count == 0 && __state.Weapon != null)
            {
                if (WorldComp.Add(__state.Weapon))
                {
                    __instance.equipment?.Remove(__state.Weapon);
                }

                if (WorldComp.TryGetAssignedWeapons(__instance, out AssignedWeaponContainer c))
                {
                    WorldComp.RemoveAssignedWeapons(__instance);

                    foreach (ThingWithComps w in c.Weapons)
                    {
                        if (!WorldComp.Add(w))
                        {
                            BuildingUtil.DropSingleThing(w, __instance.Position, __state.Map);
                        }
                    }
                }
            }
        }