示例#1
0
            static bool Prefix(ref DieAbility __instance)
            {
                if (__instance.DieAbilityDef.DestroyItems)
                {
                    __instance.DieAbilityDef.DestroyItems = false;
                }

                return(true); // doing this to catch instances where an alien's death may auto destroy items
            }
示例#2
0
            static bool Prefix(DieAbility __instance, ref bool __result, ref TacticalItem item)
            {
                if (__instance.TacticalActor.IsControlledByPlayer)
                {
                    return(true); // game will let it live...anyway
                }

                __result = false; // never destroy items via RNG;

                return(false);    // returning false here lets us skip the original method used here
            }
示例#3
0
        private static void AfterDropItems_DropArmour(DieAbility __instance)
        {
            try {
                var actor = __instance.TacticalActor;
                var items = actor?.BodyState?.GetArmourItems();
                if (items?.Any() != true)
                {
                    return;
                }

                var        shared = SharedData.GetSharedDataFromGame();
                var        gameTags = shared.SharedGameTags;
                GameTagDef armour = gameTags.ArmorTag, manu = gameTags.ManufacturableTag, mount = gameTags.MountedTag;

                int count = 0;
                foreach (var item in items)
                {
                    var def  = item.ItemDef as TacticalItemDef;
                    var tags = def?.Tags;
                    if (tags == null || tags.Count == 0 || !tags.Contains(manu) || def.IsPermanentAugment)
                    {
                        continue;
                    }
                    if (tags.Contains(armour) || tags.Contains(mount))
                    {
                        Verbo("Force dropping {0}", def.ViewElementDef.Name);
                        item.Drop(shared.FallDownItemContainerDef, actor);
                        count++;
                    }
                }
                if (count > 0)
                {
                    Info("Force dropped {0} pieces from {1} of {2}", count, actor.ViewElementDef?.Name, actor.TacticalFaction?.Faction?.FactionDef?.GetName());
                }
            } catch (Exception ex) { Error(ex); }
        }