Пример #1
0
 public static void Postfix(ref GameObject __result, string onDeathDropID, int onDeathDropCount)
 {
     if (onDeathDropCount > 0 && (onDeathDropID == "Meat" || onDeathDropID == "FishMeat"))
     {
         ExtraMeatSpawner extraMeatSpawner = __result.AddOrGet <ExtraMeatSpawner>();
         extraMeatSpawner.onDeathDropID    = onDeathDropID;
         extraMeatSpawner.onDeathDropCount = onDeathDropCount;
     }
     __result.GetComponent <KPrefabID>().prefabSpawnFn += delegate(GameObject inst)
     {
         if (inst.GetDef <RanchableMonitor.Def>() != null)
         {
             Tag       creatureEligibleTag;
             KPrefabID creature_prefab_id = inst.GetComponent <KPrefabID>();
             if (creature_prefab_id.HasTag(GameTags.SwimmingCreature))
             {
                 creatureEligibleTag = ButcherStation.FisherableCreature;
             }
             else
             {
                 creatureEligibleTag = ButcherStation.ButcherableCreature;
             }
             creature_prefab_id.AddTag(creatureEligibleTag, false);
             WorldInventory.Instance.Discover(creature_prefab_id.PrefabTag, creatureEligibleTag);
         }
     };
 }
Пример #2
0
        public static void ButchCreature(GameObject creature_go, bool moveCreatureToButcherStation = false)
        {
            RanchStation.Instance targetRanchStation = creature_go.GetSMI <RanchableMonitor.Instance>()?.targetRanchStation;
            if (targetRanchStation != null)
            {
                if (moveCreatureToButcherStation)
                {
                    creature_go.transform.SetPosition(targetRanchStation.transform.GetPosition());
                }

                ExtraMeatSpawner extraMeatSpawner = creature_go.GetComponent <ExtraMeatSpawner>();
                if (extraMeatSpawner != null)
                {
                    RancherChore.RancherChoreStates.Instance smi = targetRanchStation.GetSMI <RancherChore.RancherChoreStates.Instance>();
                    GameObject rancher = smi.sm.rancher.Get(smi);
                    extraMeatSpawner.onDeathDropMultiplier = rancher.GetAttributes().Get(Db.Get().Attributes.Ranching.Id).GetTotalValue() * Config.Get().EXTRAMEATPERRANCHINGATTRIBUTE;
                }
            }
            creature_go.GetSMI <DeathMonitor.Instance>()?.Kill(Db.Get().Deaths.Generic);
        }