Exemplo n.º 1
0
        public static void RemoveIrrigation(GameObject plant)
        {
            StateMachineController controller = plant.GetComponent <StateMachineController>();

            if (controller != null)
            {
                IrrigationMonitor.Def def = plant.GetDef <IrrigationMonitor.Def>();
                if (def != null)
                {
                    controller.cmpdef.defs.Remove(def);
                }

                FertilizationMonitor.Def def2 = plant.GetDef <FertilizationMonitor.Def>();
                if (def2 != null)
                {
                    controller.cmpdef.defs.Remove(def2);
                }
            }

            ManualDeliveryKG[] delivers = plant.GetComponents <ManualDeliveryKG>();
            foreach (ManualDeliveryKG deliver in delivers)
            {
                UnityEngine.Object.DestroyImmediate(deliver);
            }
        }
Exemplo n.º 2
0
    public static GameObject ExtendPlantToIrrigated(GameObject template, PlantElementAbsorber.ConsumeInfo[] consume_info)
    {
        HashedString idHash = Db.Get().ChoreTypes.FarmFetch.IdHash;

        for (int i = 0; i < consume_info.Length; i++)
        {
            PlantElementAbsorber.ConsumeInfo consumeInfo = consume_info[i];
            ManualDeliveryKG manualDeliveryKG            = template.AddComponent <ManualDeliveryKG>();
            manualDeliveryKG.RequestedItemTag       = consumeInfo.tag;
            manualDeliveryKG.capacity               = consumeInfo.massConsumptionRate * 600f * 3f;
            manualDeliveryKG.refillMass             = consumeInfo.massConsumptionRate * 600f * 0.5f;
            manualDeliveryKG.minimumMass            = consumeInfo.massConsumptionRate * 600f * 0.5f;
            manualDeliveryKG.operationalRequirement = FetchOrder2.OperationalRequirement.Functional;
            manualDeliveryKG.choreTypeIDHash        = idHash;
        }
        IrrigationMonitor.Def def = template.AddOrGetDef <IrrigationMonitor.Def>();
        def.wrongIrrigationTestTag = GameTags.Liquid;
        def.consumedElements       = consume_info;
        return(template);
    }