Пример #1
0
    public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
    {
        GeneratedBuildings.MakeBuildingAlwaysOperational(go);
        BuildingConfigManager.Instance.IgnoreDefaultKComponent(typeof(RequiresFoundation), prefab_tag);
        SimCellOccupier simCellOccupier = go.AddOrGet <SimCellOccupier>();

        simCellOccupier.doReplaceElement = true;
        simCellOccupier.notifyOnMelt     = true;
        go.AddOrGet <TileTemperature>();
        go.AddOrGet <WildFarmTile>();
        Storage storage = BuildingTemplates.CreateDefaultStorage(go);

        storage.SetDefaultStoredItemModifiers(Storage.StandardSealedStorage);
        PlantablePlot plantablePlot = go.AddOrGet <PlantablePlot>();

        plantablePlot.occupyingObjectRelativePosition = new Vector3(0f, 1f, 0f);
        plantablePlot.AddDepositTag(GameTags.CropSeed);
        plantablePlot.AddDepositTag(GameTags.WaterSeed);
        plantablePlot.SetFertilizationFlags(fertilizer: false, liquid_piping: false);
        CopyBuildingSettings copyBuildingSettings = go.AddOrGet <CopyBuildingSettings>();

        copyBuildingSettings.copyGroupTag = GameTags.Farm;
        go.AddOrGet <AnimTileable>();
        Prioritizable.AddRef(go);

        // turn off irrigation
        FieldInfo fi = typeof(PlantablePlot).GetField("accepts_irrigation", BindingFlags.NonPublic | BindingFlags.Instance);

        fi.SetValue(plantablePlot, false);
    }
        public static void EnableCheats(GameObject go)
        {
            PlantablePlot plantablePlot = go.AddOrGet <PlantablePlot>();

            AccessTools.Field(typeof(PlantablePlot), "accepts_irrigation").SetValue(plantablePlot, false);
            AccessTools.Field(typeof(PlantablePlot), "accepts_fertilizer").SetValue(plantablePlot, false);
        }
    public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
    {
        SimCellOccupier simCellOccupier = go.AddOrGet <SimCellOccupier>();

        simCellOccupier.doReplaceElement = true;
        go.AddOrGet <TileTemperature>();
        ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>();

        conduitConsumer.conduitType        = ConduitType.Liquid;
        conduitConsumer.consumptionRate    = 1f;
        conduitConsumer.capacityKG         = 5f;
        conduitConsumer.capacityTag        = GameTags.Liquid;
        conduitConsumer.wrongElementResult = ConduitConsumer.WrongElementResult.Dump;
        go.AddOrGet <Storage>();
        PlantablePlot plantablePlot = go.AddOrGet <PlantablePlot>();

        plantablePlot.AddDepositTag(GameTags.CropSeed);
        plantablePlot.AddDepositTag(GameTags.WaterSeed);
        plantablePlot.occupyingObjectRelativePosition.y = 1f;
        plantablePlot.SetFertilizationFlags(true, true);
        CopyBuildingSettings copyBuildingSettings = go.AddOrGet <CopyBuildingSettings>();

        copyBuildingSettings.copyGroupTag = GameTags.Farm;
        Storage storage = BuildingTemplates.CreateDefaultStorage(go, false);

        storage.SetDefaultStoredItemModifiers(Storage.StandardSealedStorage);
        go.AddOrGet <PlanterBox>();
        go.AddOrGet <AnimTileable>();
        go.AddOrGet <DropAllWorkable>();
        Prioritizable.AddRef(go);
    }
Пример #4
0
    public static void SetUpFarmPlotTags(GameObject go)
    {
        KPrefabID component = go.GetComponent <KPrefabID>();

        component.prefabSpawnFn += delegate(GameObject inst)
        {
            Rotatable     component2 = inst.GetComponent <Rotatable>();
            PlantablePlot component3 = inst.GetComponent <PlantablePlot>();
            switch (component2.GetOrientation())
            {
            case Orientation.NumRotations:
                break;

            case Orientation.Neutral:
            case Orientation.FlipH:
                component3.SetReceptacleDirection(SingleEntityReceptacle.ReceptacleDirection.Top);
                break;

            case Orientation.R180:
            case Orientation.FlipV:
                component3.SetReceptacleDirection(SingleEntityReceptacle.ReceptacleDirection.Bottom);
                break;

            case Orientation.R90:
            case Orientation.R270:
                component3.SetReceptacleDirection(SingleEntityReceptacle.ReceptacleDirection.Side);
                break;
            }
        };
    }
Пример #5
0
        public override void DoPostConfigureComplete(GameObject go)
        {
            BuildingTemplates.DoPostConfigure(go);
            PlantablePlot plantablePlot = go.GetComponent <PlantablePlot>();

            plantablePlot.SetReceptacleDirection(SingleEntityReceptacle.ReceptacleDirection.Top);
        }
Пример #6
0
    public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
    {
        go.AddOrGet <Storage>();
        Prioritizable.AddRef(go);
        PlantablePlot plantablePlot = go.AddOrGet <PlantablePlot>();

        plantablePlot.AddDepositTag(GameTags.DecorSeed);
        go.AddOrGet <FlowerVase>();
        go.GetComponent <KPrefabID>().AddTag(GameTags.Decoration, false);
    }
        public static void SetPlantablePlotAllTags(GameObject go, bool hasLiquidPiping = false)
        {
            PlantablePlot plantablePlot = go.AddOrGet <PlantablePlot>();

            (AccessTools.Field(typeof(PlantablePlot), "possibleDepositTagsList").GetValue(plantablePlot) as List <Tag>)?.Clear();
            plantablePlot.AddDepositTag(GameTags.CropSeed);
            plantablePlot.AddDepositTag(GameTags.WaterSeed);
            plantablePlot.AddDepositTag(GameTags.DecorSeed);
            plantablePlot.SetFertilizationFlags(true, hasLiquidPiping);
        }
        public virtual bool AcceptsFertilizer()
        {
            PlantablePlot component = base.sm.fertilizerStorage.Get(this).GetComponent <PlantablePlot>();

            if ((Object)component != (Object)null)
            {
                return(component.AcceptsFertilizer);
            }
            return(false);
        }
        public virtual bool AcceptsLiquid()
        {
            PlantablePlot component = base.sm.resourceStorage.Get(this).GetComponent <PlantablePlot>();

            if ((Object)component != (Object)null)
            {
                return(component.AcceptsIrrigation);
            }
            return(false);
        }
        public static bool Prefix(PlantablePlot __instance)
        {
            if (__instance.gameObject.name == FlowerVaseConfig.ID)
            {
                Debug.Log("TEST_3 prevented FlowerVase link.");
                return(false);
            }

            return(true);
        }
    public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
    {
        go.AddOrGet <Storage>();
        Prioritizable.AddRef(go);
        PlantablePlot plantablePlot = go.AddOrGet <PlantablePlot>();

        plantablePlot.AddDepositTag(GameTags.DecorSeed);
        plantablePlot.occupyingObjectVisualOffset = new Vector3(0f, -0.25f, 0f);
        go.GetComponent <KPrefabID>().AddTag(GameTags.Decoration, false);
    }
    private bool CheckValidPlotCell(PlantableSeed seed, int plant_cell)
    {
        if (!Grid.IsValidCell(plant_cell))
        {
            return(false);
        }
        int num = (seed.Direction != SingleEntityReceptacle.ReceptacleDirection.Bottom) ? Grid.CellBelow(plant_cell) : Grid.CellAbove(plant_cell);

        if (!Grid.IsValidCell(num))
        {
            return(false);
        }
        if (!Grid.Solid[num])
        {
            return(false);
        }
        if ((bool)Grid.Objects[plant_cell, 5])
        {
            return(false);
        }
        if ((bool)Grid.Objects[plant_cell, 1])
        {
            return(false);
        }
        GameObject gameObject = Grid.Objects[num, 1];

        if ((bool)gameObject)
        {
            PlantablePlot component = gameObject.GetComponent <PlantablePlot>();
            if ((Object)component == (Object)null)
            {
                return(false);
            }
            if (component.Direction != seed.Direction)
            {
                return(false);
            }
            if ((Object)component.Occupant != (Object)null)
            {
                return(false);
            }
        }
        else
        {
            if (!seed.TestSuitableGround(plant_cell))
            {
                return(false);
            }
            if (CountNearbyPlants(num, plantDetectionRadius) > maxPlantsInRadius)
            {
                return(false);
            }
        }
        return(true);
    }
Пример #13
0
 public void SetReceptacle(PlantablePlot plot = null)
 {
     if ((Object)plot == (Object)null)
     {
         base.smi.sm.receptacle.Set(null, base.smi);
         replanted = false;
     }
     else
     {
         base.smi.sm.receptacle.Set(plot, base.smi);
         replanted = true;
     }
 }
Пример #14
0
        public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
        {
            go.AddOrGet <Storage>();
            PlantablePlot plantablePlot = go.AddOrGet <PlantablePlot>();

            plantablePlot.AddDepositTag(Utils.CropSeed2TileWide);
            plantablePlot.occupyingObjectRelativePosition.y = 0f;
            plantablePlot.SetFertilizationFlags(true, false);
            BuildingTemplates.CreateDefaultStorage(go, false).SetDefaultStoredItemModifiers(Storage.StandardSealedStorage);
            go.AddOrGet <AnimTileable>();
            go.AddOrGet <DropAllWorkable>();

            Prioritizable.AddRef(go);
        }
    public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
    {
        Storage       storage       = go.AddOrGet <Storage>();
        PlantablePlot plantablePlot = go.AddOrGet <PlantablePlot>();

        plantablePlot.AddDepositTag(GameTags.CropSeed);
        plantablePlot.SetFertilizationFlags(true, false);
        CopyBuildingSettings copyBuildingSettings = go.AddOrGet <CopyBuildingSettings>();

        copyBuildingSettings.copyGroupTag = GameTags.Farm;
        BuildingTemplates.CreateDefaultStorage(go, false);
        storage.SetDefaultStoredItemModifiers(Storage.StandardSealedStorage);
        go.AddOrGet <DropAllWorkable>();
        go.AddOrGet <PlanterBox>();
        go.AddOrGet <AnimTileable>();
        Prioritizable.AddRef(go);
    }
Пример #16
0
        public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
        {
            GeneratedBuildings.MakeBuildingAlwaysOperational(go);
            BuildingConfigManager.Instance.IgnoreDefaultKComponent(typeof(RequiresFoundation), prefab_tag);
            SimCellOccupier simCellOccupier = go.AddOrGet <SimCellOccupier>();

            simCellOccupier.doReplaceElement = true;
            simCellOccupier.notifyOnMelt     = true;
            go.AddOrGet <TileTemperature>();
            BuildingTemplates.CreateDefaultStorage(go, false).SetDefaultStoredItemModifiers(Storage.StandardSealedStorage);
            PlantablePlot plantablePlot = go.AddOrGet <PlantablePlot>();

            plantablePlot.occupyingObjectRelativePosition = new Vector3(0.0f, 1f, 0.0f);
            plantablePlot.AddDepositTag(GameTags.CropSeed);
            plantablePlot.AddDepositTag(GameTags.WaterSeed);
            plantablePlot.SetFertilizationFlags(true, false);
            go.AddOrGet <CopyBuildingSettings>().copyGroupTag = GameTags.Farm;
            go.AddOrGet <AnimTileable>();
            Prioritizable.AddRef(go);
        }
Пример #17
0
    public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
    {
        Storage       storage       = go.AddOrGet <Storage>();
        PlantablePlot plantablePlot = go.AddOrGet <PlantablePlot>();

        plantablePlot.AddDepositTag(GameTags.CropSeed);
        plantablePlot.SetFertilizationFlags(fertilizer: false, liquid_piping: false);
        CopyBuildingSettings copyBuildingSettings = go.AddOrGet <CopyBuildingSettings>();

        copyBuildingSettings.copyGroupTag = GameTags.Farm;
        BuildingTemplates.CreateDefaultStorage(go);
        storage.SetDefaultStoredItemModifiers(Storage.StandardSealedStorage);
        go.AddOrGet <DropAllWorkable>();
        go.AddOrGet <WildPlanterBox>();
        go.AddOrGet <AnimTileable>();
        Prioritizable.AddRef(go);

        // turn off irrigation
        FieldInfo fi = typeof(PlantablePlot).GetField("accepts_irrigation", BindingFlags.NonPublic | BindingFlags.Instance);

        fi.SetValue(plantablePlot, false);
    }
Пример #18
0
    private static bool CheckValidPlotCell(Instance smi, PlantableSeed seed, int cell, out PlantablePlot plot)
    {
        plot = null;
        if (!Grid.IsValidCell(cell))
        {
            return(false);
        }
        int num = (seed.Direction != SingleEntityReceptacle.ReceptacleDirection.Bottom) ? Grid.CellBelow(cell) : Grid.CellAbove(cell);

        if (!Grid.IsValidCell(num))
        {
            return(false);
        }
        if (!Grid.Solid[num])
        {
            return(false);
        }
        GameObject gameObject = Grid.Objects[num, 1];

        if ((bool)gameObject)
        {
            plot = gameObject.GetComponent <PlantablePlot>();
            return((UnityEngine.Object)plot != (UnityEngine.Object)null);
        }
        return(seed.TestSuitableGround(cell));
    }
    protected override bool AdditionalCanDepositTest()
    {
        PlantablePlot plantablePlot = targetReceptacle as PlantablePlot;

        return(plantablePlot.ValidPlant);
    }