Example #1
0
        private static bool CanRanchableBeRanchedAtRanchStation(RanchableMonitor.Instance ranchable, Instance ranch_station, CavityInfo ranch_cavity_info, int ranch_cell)
        {
            if (!ranchable.IsRunning())
            {
                return(false);
            }
            if (ranchable.targetRanchStation != ranch_station && ranchable.targetRanchStation != null && ranchable.targetRanchStation.IsRunning())
            {
                return(false);
            }
            if (!ranch_station.def.isCreatureEligibleToBeRanchedCb(ranchable.gameObject, ranch_station))
            {
                return(false);
            }
            if (!ranchable.GetComponent <ChoreConsumer>().IsChoreEqualOrAboveCurrentChorePriority <RanchedStates>())
            {
                return(false);
            }
            int        cell          = Grid.PosToCell(ranchable.transform.GetPosition());
            CavityInfo cavityForCell = Game.Instance.roomProber.GetCavityForCell(cell);

            if (cavityForCell == null || cavityForCell != ranch_cavity_info)
            {
                return(false);
            }
            int navigationCost = ranchable.GetComponent <Navigator>().GetNavigationCost(ranch_cell);

            if (navigationCost == -1)
            {
                return(false);
            }
            return(true);
        }
Example #2
0
 private static void RanchCreature(Instance smi)
 {
     Debug.Assert(smi.ranchStation != null, "smi.ranchStation was null");
     RanchableMonitor.Instance targetRanchable = smi.ranchStation.targetRanchable;
     if (!targetRanchable.IsNullOrStopped())
     {
         KPrefabID component = targetRanchable.GetComponent <KPrefabID>();
         smi.sm.rancher.Get(smi).Trigger(937885943, component.PrefabTag.Name);
         smi.ranchStation.RanchCreature();
     }
 }