Exemple #1
0
        public RoomTypeLaboratoryData()
        {
            Id                   = RoomId;
            Name                 = STRINGS.ROOMS.TYPES.LABORATORY.NAME;
            Tooltip              = STRINGS.ROOMS.TYPES.LABORATORY.TOOLTIP;
            Effect               = STRINGS.ROOMS.TYPES.LABORATORY.EFFECT;
            Catergory            = Db.Get().RoomTypeCategories.Recreation;
            ConstraintPrimary    = RoomConstraints.RESEARCH_STATION;
            ConstrantsAdditional = new RoomConstraints.Constraint[4]
            {
                RoomConstraints.LIGHT,
                RoomConstraints.DECORATIVE_ITEM,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraintTags.GetMaxSizeConstraint(Settings.Instance.Laboratory.MaxSize)
            };

            RoomDetails = new RoomDetails.Detail[2]
            {
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.SIZE.NAME, (object)room.cavity.numCells))),
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.BUILDING_COUNT.NAME, (object)room.buildings.Count)))
            };

            Priority       = 0;
            Upgrades       = null;
            SingleAssignee = false;
            PriorityUse    = false;
            Effects        = null;
            SortKey        = SortingCounter.GetAndIncrement(0);
        }
        public RoomTypeIndustrialData(RoomType[] upgr = null)
        {
            Id                = RoomId;
            Name              = STRINGS.ROOMS.TYPES.INDUSTRIAL.NAME;
            Tooltip           = STRINGS.ROOMS.TYPES.INDUSTRIAL.TOOLTIP;
            Effect            = STRINGS.ROOMS.TYPES.INDUSTRIAL.EFFECT;
            Catergory         = Db.Get().RoomTypeCategories.Industrial;
            ConstraintPrimary = new RoomConstraints.Constraint((Func <KPrefabID, bool>)(bc => bc.HasTag(RoomConstraints.ConstraintTags.IndustrialMachinery)),
                                                               (Func <Room, bool>)null,
                                                               name: STRINGS.ROOMS.CRITERIA.INDUSTRIAL.NAME,
                                                               description: STRINGS.ROOMS.CRITERIA.INDUSTRIAL.DESCRIPTION);
            ConstrantsAdditional = new RoomConstraints.Constraint[2]
            {
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraintTags.GetMaxSizeConstraint(Settings.Instance.Industrial.MaxSize)
            };

            RoomDetails = new RoomDetails.Detail[2]
            {
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.SIZE.NAME, (object)room.cavity.numCells))),
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.BUILDING_COUNT.NAME, (object)room.buildings.Count)))
            };

            Priority = -1;

            Upgrades       = upgr;
            SingleAssignee = true;
            PriorityUse    = true;
            Effects        = null;
            SortKey        = SortingCounter.GetAndIncrement();
        }
Exemple #3
0
        public RoomTypeGraveyardData()
        {
            Id                = RoomId;
            Name              = STRINGS.ROOMS.TYPES.GRAVEYARD.NAME;
            Tooltip           = STRINGS.ROOMS.TYPES.GRAVEYARD.TOOLTIP;
            Effect            = STRINGS.ROOMS.TYPES.GRAVEYARD.EFFECT;
            Catergory         = Db.Get().RoomTypeCategories.Park;
            ConstraintPrimary = new RoomConstraints.Constraint((Func <KPrefabID, bool>)(bc => bc.HasTag(RoomConstraintTags.GravestoneTag)),
                                                               (Func <Room, bool>)null,
                                                               name: STRINGS.ROOMS.CRITERIA.GRAVE.NAME,
                                                               description: STRINGS.ROOMS.CRITERIA.GRAVE.DESCRIPTION);
            ConstrantsAdditional = new RoomConstraints.Constraint[4]
            {
                RoomConstraints.WILDPLANT,
                RoomConstraints.NO_INDUSTRIAL_MACHINERY,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraintTags.GetMaxSizeConstraint(Settings.Instance.Graveyard.MaxSize)
            };

            RoomDetails = new RoomDetails.Detail[2]
            {
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.SIZE.NAME, (object)room.cavity.numCells))),
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.BUILDING_COUNT.NAME, (object)room.buildings.Count)))
            };

            Priority       = 0;
            Upgrades       = null;
            SingleAssignee = false;
            PriorityUse    = false;
            Effects        = null;
            SortKey        = SortingCounter.GetAndIncrement(SortingCounter.ParkSortKey);
        }
        public RoomTypeKitchenData()
        {
            Id                = RoomId;
            Name              = STRINGS.ROOMS.TYPES.KITCHEN.NAME;
            Tooltip           = STRINGS.ROOMS.TYPES.KITCHEN.TOOLTIP;
            Effect            = STRINGS.ROOMS.TYPES.KITCHEN.EFFECT;
            Catergory         = Db.Get().RoomTypeCategories.Agricultural;
            ConstraintPrimary = new RoomConstraints.Constraint((Func <KPrefabID, bool>)(bc => bc.HasTag(RoomConstraintTags.KitchenBuildingTag)),
                                                               (Func <Room, bool>)null,
                                                               name: STRINGS.ROOMS.CRITERIA.COOKING.NAME,
                                                               description: STRINGS.ROOMS.CRITERIA.COOKING.DESCRIPTION);
            ConstrantsAdditional = new RoomConstraints.Constraint[4]
            {
                new RoomConstraints.Constraint((Func <KPrefabID, bool>)(bc => bc.GetComponent <Refrigerator>() != null),
                                               (Func <Room, bool>)null,
                                               name: STRINGS.ROOMS.CRITERIA.FRIDGE.NAME,
                                               description: STRINGS.ROOMS.CRITERIA.FRIDGE.DESCRIPTION),
                RoomConstraints.DECORATIVE_ITEM,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraintTags.GetMaxSizeConstraint(Settings.Instance.Kitchen.MaxSize)
            };

            RoomDetails = new RoomDetails.Detail[2]
            {
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.SIZE.NAME, (object)room.cavity.numCells))),
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.BUILDING_COUNT.NAME, (object)room.buildings.Count)))
            };

            Priority       = 1;
            Upgrades       = null;
            SingleAssignee = false;
            PriorityUse    = false;
            Effects        = null;
            SortKey        = SortingCounter.GetAndIncrement(SortingCounter.CreaturePenSortKey + 1);
        }
Exemple #5
0
        public RoomTypeAquariumData()
        {
            Id                = RoomId;
            Name              = STRINGS.ROOMS.TYPES.AQUARIUM.NAME;
            Tooltip           = STRINGS.ROOMS.TYPES.AQUARIUM.TOOLTIP;
            Effect            = STRINGS.ROOMS.TYPES.AQUARIUM.EFFECT;
            Catergory         = Db.Get().RoomTypeCategories.Bathroom;
            ConstraintPrimary = new RoomConstraints.Constraint((Func <KPrefabID, bool>)(bc => bc.HasTag(RoomConstraintTags.AquariumFeederTag)),
                                                               (Func <Room, bool>)null,
                                                               name: STRINGS.ROOMS.CRITERIA.FISHFEEDER.NAME,
                                                               description: STRINGS.ROOMS.CRITERIA.FISHFEEDER.DESCRIPTION);
            ConstrantsAdditional = new RoomConstraints.Constraint[4]
            {
                new RoomConstraints.Constraint((Func <KPrefabID, bool>)(bc => bc.HasTag(RoomConstraintTags.AquariumReleaseTag)),
                                               (Func <Room, bool>)null,
                                               name: STRINGS.ROOMS.CRITERIA.FISHRELEASE.NAME,
                                               description: STRINGS.ROOMS.CRITERIA.FISHRELEASE.DESCRIPTION),
                RoomConstraints.DECORATIVE_ITEM,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraintTags.GetMaxSizeConstraint(Settings.Instance.Aquarium.MaxSize)
            };

            RoomDetails = new RoomDetails.Detail[2]
            {
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.SIZE.NAME, (object)room.cavity.numCells))),
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.CREATURE_COUNT.NAME, (object)(room.cavity.creatures.Count + room.cavity.eggs.Count))))
            };

            Priority       = 0;
            Upgrades       = null;
            SingleAssignee = false;
            PriorityUse    = false;
            Effects        = null;
            SortKey        = SortingCounter.GetAndIncrement(SortingCounter.RecreationRoom);
        }
 public static void AddStompInConflict(RoomConstraints.Constraint stomping, RoomConstraints.Constraint stomped)
 {
     if (stomping.stomp_in_conflict == null)
     {
         stomping.stomp_in_conflict = new List <RoomConstraints.Constraint>();
     }
     stomping.stomp_in_conflict.Add(stomped);
 }
Exemple #7
0
        public RoomTypePrivateRoomData()
        {
            Id                = RoomId;
            Name              = STRINGS.ROOMS.TYPES.PRIVATEROOM.NAME;
            Tooltip           = STRINGS.ROOMS.TYPES.PRIVATEROOM.TOOLTIP;
            Effect            = STRINGS.ROOMS.TYPES.PRIVATEROOM.EFFECT;
            Catergory         = Db.Get().RoomTypeCategories.Sleep;
            ConstraintPrimary = new RoomConstraints.Constraint((Func <KPrefabID, bool>)(bc => bc.HasTag(RoomConstraints.ConstraintTags.Bed) ||
                                                                                        bc.HasTag(RoomConstraints.ConstraintTags.LuxuryBed)),
                                                               (Func <Room, bool>)null,
                                                               name: STRINGS.ROOMS.CRITERIA.ANYBED.NAME,
                                                               description: STRINGS.ROOMS.CRITERIA.ANYBED.DESCRIPTION);
            ConstrantsAdditional = new RoomConstraints.Constraint[6]
            {
                new RoomConstraints.Constraint(
                    (Func <KPrefabID, bool>)null,
                    (Func <Room, bool>)(room =>
                {
                    int count = 0;
                    if (room != null)
                    {
                        foreach (KPrefabID building in room.buildings)
                        {
                            if (building != null)
                            {
                                Bed bed = building.GetComponent <Bed>();
                                if (bed != null)
                                {
                                    count++;
                                }
                            }
                        }
                    }
                    return(count == 1);
                }),
                    name: STRINGS.ROOMS.CRITERIA.ONLYONEBED.NAME,
                    description: STRINGS.ROOMS.CRITERIA.ONLYONEBED.DESCRIPTION),

                RoomConstraints.DECORATIVE_ITEM_20,
                RoomConstraints.NO_INDUSTRIAL_MACHINERY,
                RoomConstraints.CEILING_HEIGHT_4,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraintTags.GetMaxSizeConstraint(Settings.Instance.PrivateBedroom.MaxSize)
            };

            RoomDetails = new RoomDetails.Detail[2]
            {
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.SIZE.NAME, (object)room.cavity.numCells))),
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.BUILDING_COUNT.NAME, (object)room.buildings.Count)))
            };

            Priority       = 2;
            Upgrades       = null;
            SingleAssignee = false;
            PriorityUse    = false;
            Effects        = null;
            SortKey        = SortingCounter.GetAndIncrement(SortingCounter.BedroomSortKey + 1);
        }
Exemple #8
0
        public RoomTypeNurseryData()
        {
            Id                = RoomId;
            Name              = STRINGS.ROOMS.TYPES.NURSERY.NAME;
            Tooltip           = STRINGS.ROOMS.TYPES.NURSERY.TOOLTIP;
            Effect            = STRINGS.ROOMS.TYPES.NURSERY.EFFECT;
            Catergory         = Db.Get().RoomTypeCategories.Agricultural;
            ConstraintPrimary = new RoomConstraints.Constraint((Func <KPrefabID, bool>)(bc => bc.HasTag(RoomConstraintTags.NurseryPlanterBoxTag)),
                                                               (Func <Room, bool>)null,
                                                               name: STRINGS.ROOMS.CRITERIA.PLANTERBOX.NAME,
                                                               description: STRINGS.ROOMS.CRITERIA.PLANTERBOX.DESCRIPTION);

            ConstrantsAdditional = new RoomConstraints.Constraint[4] {
                new RoomConstraints.Constraint((Func <KPrefabID, bool>)null,
                                               (Func <Room, bool>)(room =>
                {
                    List <string> seedIds = new List <string>();
                    foreach (var plant in room.cavity.plants)
                    {
                        if (plant == null)
                        {
                            continue;
                        }
                        SeedProducer seedProd = plant.GetComponent <SeedProducer>();
                        WiltCondition wiltCon = plant.GetComponent <WiltCondition>();
                        if (seedProd == null)
                        {
                            continue;
                        }
                        if (!seedIds.Contains(seedProd.seedInfo.seedId) &&
                            seedProd.seedInfo.productionType == SeedProducer.ProductionType.Harvest)
                        {
                            seedIds.Add(seedProd.seedInfo.seedId);
                        }
                    }
                    return(seedIds.Count >= requiredNumberOfPlants);
                }),
                                               name: string.Format(STRINGS.ROOMS.CRITERIA.SEEDPLANTS.NAME, requiredNumberOfPlants),
                                               description: string.Format(STRINGS.ROOMS.CRITERIA.SEEDPLANTS.DESCRIPTION, requiredNumberOfPlants)),
                RoomConstraints.LIGHT,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraintTags.GetMaxSizeConstraint(Settings.Instance.Nursery.MaxSize)
            };

            RoomDetails = new RoomDetails.Detail[2]
            {
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.SIZE.NAME, (object)room.cavity.numCells))),
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.PLANT_COUNT.NAME, (object)room.plants.Count)))
            };

            Priority       = 0;
            Upgrades       = null;
            SingleAssignee = false;
            PriorityUse    = false;
            Effects        = null;
            SortKey        = SortingCounter.GetAndIncrement(SortingCounter.FarmSortKey - 1);
        }
Exemple #9
0
        public RoomTypeMuseumData()
        {
            Id                = RoomId;
            Name              = STRINGS.ROOMS.TYPES.MUSEUM.NAME;
            Tooltip           = STRINGS.ROOMS.TYPES.MUSEUM.TOOLTIP;
            Effect            = STRINGS.ROOMS.TYPES.MUSEUM.EFFECT;
            Catergory         = Db.Get().RoomTypeCategories.Hospital;
            ConstraintPrimary = new RoomConstraints.Constraint((Func <KPrefabID, bool>)(bc => bc.HasTag(RoomConstraintTags.ItemPedestalTag)),
                                                               (Func <Room, bool>)null,
                                                               name: STRINGS.ROOMS.CRITERIA.PEDESTAL.NAME,
                                                               description: STRINGS.ROOMS.CRITERIA.PEDESTAL.DESCRIPTION);
            ConstrantsAdditional = new RoomConstraints.Constraint[5]
            {
                new RoomConstraints.Constraint((Func <KPrefabID, bool>)null,
                                               (Func <Room, bool>)(room =>
                {
                    int count = 0;
                    foreach (KPrefabID building in room.buildings)
                    {
                        Artable art = building.GetComponent <Artable>();
                        if (art == null)
                        {
                            continue;
                        }
                        if (art.CurrentStatus == Artable.Status.Great)
                        {
                            count++;
                        }
                    }
                    return(count >= requiredMasterpieces);
                }),
                                               name: string.Format(STRINGS.ROOMS.CRITERIA.MASTERPIECES.NAME, requiredMasterpieces),
                                               description: string.Format(STRINGS.ROOMS.CRITERIA.MASTERPIECES.DESCRIPTION, requiredMasterpieces)),
                RoomConstraints.LIGHT,
                RoomConstraints.NO_INDUSTRIAL_MACHINERY,
                RoomConstraints.MINIMUM_SIZE_32,
                RoomConstraintTags.GetMaxSizeConstraint(Settings.Instance.Museum.MaxSize)
            };

            RoomDetails = new RoomDetails.Detail[2]
            {
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.SIZE.NAME, (object)room.cavity.numCells))),
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.BUILDING_COUNT.NAME, (object)room.buildings.Count)))
            };

            Priority       = 1;
            Upgrades       = null;
            SingleAssignee = false;
            PriorityUse    = false;
            Effects        = null;
            SortKey        = SortingCounter.GetAndIncrement(SortingCounter.CreaturePenSortKey + 1);
        }
        private static void InitDb()
        {
            var db = Db.Get();

            // тюнингуем и актифируем комнату
            // подхватывать максимальный размер комнаты из тюнинга
            int maxRoomSize = TuningData <RoomProber.Tuning> .Get().maxRoomSize;

            RoomConstraints.Constraint MAXIMUM_SIZE_MAX = new RoomConstraints.Constraint(
                building_criteria: null,
                room_criteria: (Room room) => room.cavity.numCells <= maxRoomSize,
                times_required: 1,
                name: string.Format(ROOMS.CRITERIA.MAXIMUM_SIZE.NAME, maxRoomSize),
                description: string.Format(ROOMS.CRITERIA.MAXIMUM_SIZE.DESCRIPTION, maxRoomSize),
                stomp_in_conflict: null);

            var additional_constraints = db.RoomTypes.MachineShop.additional_constraints;

            for (int i = 0; i < additional_constraints.Length; i++)
            {
                if (additional_constraints[i] == RoomConstraints.MAXIMUM_SIZE_96)
                {
                    additional_constraints[i] = MAXIMUM_SIZE_MAX;
                    break;
                }
            }

            db.RoomTypes.Add(db.RoomTypes.MachineShop);

            // добавляем перк для работы на станции
            CanMachineTinker = db.SkillPerks.Add(new SimpleSkillPerk(REQUIRED_ROLE_PERK, STRINGS.PERK_CAN_MACHINE_TINKER.DESCRIPTION));
            db.Skills.Technicals1.perks.Add(CanMachineTinker);

            // добавляем модификаторы и эффекты
            string text        = DUPLICANTS.MODIFIERS.MACHINETINKER.NAME;
            string description = STRINGS.DUPLICANTS.MODIFIERS.MACHINETINKER.TOOLTIP;

            CraftingSpeed = db.Attributes.Add(new Attribute(CRAFTING_SPEED_MODIFIER_NAME, false, Attribute.Display.General, false, BASE_SPEED_VALUE));
            CraftingSpeed.SetFormatter(new PercentAttributeFormatter());

            MachinerySpeedModifier = new AttributeModifier(MACHINERY_SPEED_MODIFIER_NAME, MACHINERY_SPEED_MODIFIER, text);
            CraftingSpeedModifier  = new AttributeModifier(CRAFTING_SPEED_MODIFIER_NAME, CRAFTING_SPEED_MODIFIER, text);

            MachineTinkerEffect = db.effects.Add(new Effect(MACHINE_TINKER_EFFECT_NAME, text, description, MACHINE_TINKER_EFFECT_DURATION * Constants.SECONDS_PER_CYCLE, true, true, false));
            MachineTinkerEffect.Add(MachinerySpeedModifier);
            MachineTinkerEffect.Add(CraftingSpeedModifier);
        }
        public RoomTypeGymData()
        {
            Id                = RoomId;
            Name              = STRINGS.ROOMS.TYPES.GYMROOM.NAME;
            Tooltip           = STRINGS.ROOMS.TYPES.GYMROOM.TOOLTIP;
            Effect            = STRINGS.ROOMS.TYPES.GYMROOM.EFFECT;
            Catergory         = Db.Get().RoomTypeCategories.Recreation;
            ConstraintPrimary = new RoomConstraints.Constraint((Func <KPrefabID, bool>)(bc => bc.HasTag(RoomConstraintTags.RunningWheelGeneratorTag)),
                                                               (Func <Room, bool>)null,
                                                               name: STRINGS.ROOMS.CRITERIA.MANUALGENERATOR.NAME,
                                                               description: STRINGS.ROOMS.CRITERIA.MANUALGENERATOR.DESCRIPTION,
                                                               stomp_in_conflict: new List <RoomConstraints.Constraint>()
            {
                RoomConstraints.REC_BUILDING
            });
            ConstrantsAdditional = new RoomConstraints.Constraint[4]
            {
                new RoomConstraints.Constraint((Func <KPrefabID, bool>)(bc => bc.HasTag(RoomConstraintTags.WaterCoolerTag)),
                                               (Func <Room, bool>)null,
                                               name: STRINGS.ROOMS.CRITERIA.WATERCOOLER.NAME,
                                               description: STRINGS.ROOMS.CRITERIA.WATERCOOLER.DESCRIPTION),
                RoomConstraints.DECORATIVE_ITEM,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraintTags.GetMaxSizeConstraint(Settings.Instance.Gym.MaxSize)
            };

            RoomDetails = new RoomDetails.Detail[2]
            {
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.SIZE.NAME, (object)room.cavity.numCells))),
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.BUILDING_COUNT.NAME, (object)room.buildings.Count)))
            };

            Priority       = 0;
            Upgrades       = null;
            SingleAssignee = false;
            PriorityUse    = false;
            Effects        = null;
            SortKey        = SortingCounter.GetAndIncrement(SortingCounter.RecreationRoom);
        }
        public RoomTypeBotanicalData()
        {
            Id                = RoomId;
            Name              = STRINGS.ROOMS.TYPES.BOTANICAL.NAME;
            Tooltip           = STRINGS.ROOMS.TYPES.BOTANICAL.TOOLTIP;
            Effect            = STRINGS.ROOMS.TYPES.BOTANICAL.EFFECT;
            Catergory         = Db.Get().RoomTypeCategories.Park;
            ConstraintPrimary = RoomConstraints.PARK_BUILDING;

            ConstrantsAdditional = new RoomConstraints.Constraint[5]
            {
                new RoomConstraints.Constraint((Func <KPrefabID, bool>)null,
                                               (Func <Room, bool>)(room =>
                {
                    List <string> names = new List <string>();
                    foreach (var plant in room.cavity.plants)
                    {
                        if (plant == null)
                        {
                            continue;
                        }
                        if (!DecorativeNames.Contains(plant.name))
                        {
                            continue;
                        }
                        if (!names.Contains(plant.name))
                        {
                            names.Add(plant.name);
                        }
                    }
                    return(names.Count >= requiredDecorative);
                }),
                                               name: string.Format(STRINGS.ROOMS.CRITERIA.DECORPLANTS.NAME, requiredDecorative),
                                               description: string.Format(STRINGS.ROOMS.CRITERIA.DECORPLANTS.DESCRIPTION, requiredDecorative)),
                new RoomConstraints.Constraint((Func <KPrefabID, bool>)null,
                                               (Func <Room, bool>)(room => room.cavity.plants.Count >= requiredPlants),
                                               name: string.Format(STRINGS.ROOMS.CRITERIA.PLANTCOUNT.NAME, requiredPlants),
                                               description: string.Format(STRINGS.ROOMS.CRITERIA.PLANTCOUNT.DESCRIPTION, requiredPlants)),
                new RoomConstraints.Constraint((Func <KPrefabID, bool>)null,
                                               (Func <Room, bool>)(room =>
                {
                    foreach (KPrefabID plant in room.cavity.plants)
                    {
                        if ((UnityEngine.Object)plant != (UnityEngine.Object)null)
                        {
                            BasicForagePlantPlanted component1 = plant.GetComponent <BasicForagePlantPlanted>();
                            ReceptacleMonitor component2       = plant.GetComponent <ReceptacleMonitor>();
                            if ((UnityEngine.Object)component2 != (UnityEngine.Object)null && !component2.Replanted)
                            {
                                return(false);
                            }
                            else if ((UnityEngine.Object)component1 != (UnityEngine.Object)null)
                            {
                                return(false);
                            }
                        }
                    }
                    return(true);
                }),
                                               name: STRINGS.ROOMS.CRITERIA.NOWILDPLANTS.NAME,
                                               description: STRINGS.ROOMS.CRITERIA.NOWILDPLANTS.DESCRIPTION),
                RoomConstraints.MINIMUM_SIZE_32,
                RoomConstraintTags.GetMaxSizeConstraint(Settings.Instance.Botanical.MaxSize)
            };

            RoomDetails = new RoomDetails.Detail[2]
            {
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.SIZE.NAME, (object)room.cavity.numCells))),
                new RoomDetails.Detail((Func <Room, string>)(room => string.Format((string)ROOMS.DETAILS.BUILDING_COUNT.NAME, (object)room.buildings.Count)))
            };

            Priority       = 1;
            Upgrades       = null;
            SingleAssignee = false;
            PriorityUse    = false;
            Effects        = new string[1] {
                "RoomNatureReserve"
            };
            SortKey = SortingCounter.GetAndIncrement(SortingCounter.ParkSortKey + 1);
        }
Exemple #13
0
        internal static void Init()
        {
            var db = Db.Get();

            // тюнингуем и актифируем комнату
            // подхватывать максимальный размер комнаты из тюнинга
            int maxRoomSize = TuningData <RoomProber.Tuning> .Get().maxRoomSize;

            var MAXIMUM_SIZE_MAX = new RoomConstraints.Constraint(
                building_criteria: null,
                room_criteria: (Room room) => room.cavity.numCells <= maxRoomSize,
                times_required: 1,
                name: string.Format(ROOMS.CRITERIA.MAXIMUM_SIZE.NAME, maxRoomSize),
                description: string.Format(ROOMS.CRITERIA.MAXIMUM_SIZE.DESCRIPTION, maxRoomSize),
                stomp_in_conflict: null);

            var additional_constraints = db.RoomTypes.MachineShop.additional_constraints;

            for (int i = 0; i < additional_constraints.Length; i++)
            {
                if (additional_constraints[i] == RoomConstraints.MAXIMUM_SIZE_96)
                {
                    additional_constraints[i] = MAXIMUM_SIZE_MAX;
                    break;
                }
            }

            db.RoomTypes.Add(db.RoomTypes.MachineShop);

            // детектим "Rooms Expanded". модифицируем "мастерскую" чтобы она могла быть обгрейднутна до "кухни"
            var RoomsExpanded = PPatchTools.GetTypeSafe("RoomsExpanded.RoomTypes_AllModded", "RoomsExpandedMerged");

            if (RoomsExpanded != null)
            {
                PUtil.LogDebug("RoomsExpanded found. Attempt to add compatibility.");
                try
                {
                    KitchenRoom = (RoomType)RoomsExpanded.GetPropertySafe <RoomType>("KitchenRoom", true)?.GetValue(null, null);
                    if (KitchenRoom != null)
                    {
                        var upgrade_paths = db.RoomTypes.MachineShop.upgrade_paths.AddToArray(KitchenRoom);
                        Traverse.Create(db.RoomTypes.MachineShop).Property(nameof(RoomType.upgrade_paths)).SetValue(upgrade_paths);
                        Traverse.Create(db.RoomTypes.MachineShop).Property(nameof(RoomType.priority)).SetValue(KitchenRoom.priority);
                        KitchenBuildingTag = "KitchenBuildingTag".ToTag();
                        RoomsExpandedFound = true;
                    }
                }
                catch (System.Exception e)
                {
                    PUtil.LogExcWarn(e);
                }
            }

            // добавляем перк для работы на станции
            CanMachineTinker = db.SkillPerks.Add(new SimpleSkillPerk(
                                                     id: REQUIRED_ROLE_PERK,
                                                     description: STRINGS.PERK_CAN_MACHINE_TINKER.DESCRIPTION));
            db.Skills.Technicals1.perks.Add(CanMachineTinker);

            // добавляем модификаторы и эффекты
            string text        = DUPLICANTS.MODIFIERS.MACHINETINKER.NAME;
            string description = STRINGS.DUPLICANTS.MODIFIERS.MACHINETINKER.TOOLTIP;

            CraftingSpeed = db.Attributes.Add(new Attribute(
                                                  id: CRAFTING_SPEED_MODIFIER_NAME,
                                                  is_trainable: false,
                                                  show_in_ui: Attribute.Display.General,
                                                  is_profession: false,
                                                  base_value: BASE_SPEED_VALUE));
            CraftingSpeed.SetFormatter(new PercentAttributeFormatter());

            MachinerySpeedModifier = new AttributeModifier(
                attribute_id: MACHINERY_SPEED_MODIFIER_NAME,
                value: MACHINERY_SPEED_MODIFIER,
                description: text,
                is_readonly: false);
            CraftingSpeedModifier = new AttributeModifier(
                attribute_id: CRAFTING_SPEED_MODIFIER_NAME,
                value: CRAFTING_SPEED_MODIFIER,
                description: text,
                is_readonly: false);

            MachineTinkerEffect = db.effects.Add(new Effect(
                                                     id: MACHINE_TINKER_EFFECT_NAME,
                                                     name: text,
                                                     description: description,
                                                     duration: MACHINE_TINKER_EFFECT_DURATION * Constants.SECONDS_PER_CYCLE,
                                                     show_in_ui: true,
                                                     trigger_floating_text: true,
                                                     is_bad: false));
            MachineTinkerEffect.Add(MachinerySpeedModifier);
            MachineTinkerEffect.Add(CraftingSpeedModifier);

            MachineTinkerEffectDuration = db.AttributeConverters.Create(
                id: "MachineTinkerEffectDuration",
                name: "Engie's Jerry Rig Effect Duration",
                description: STRINGS.DUPLICANTS.ATTRIBUTES.MACHINERY.MACHINE_TINKER_EFFECT_MODIFIER,
                attribute: db.Attributes.Machinery,
                multiplier: MACHINE_TINKER_EFFECT_DURATION_PER_SKILL,
                base_value: 0,
                formatter: new ToPercentAttributeFormatter(1f, GameUtil.TimeSlice.None),
                available_dlcs: DlcManager.AVAILABLE_ALL_VERSIONS);
        }
Exemple #14
0
 public RoomType(string id, string name, string tooltip, string effect, RoomTypeCategory category, RoomConstraints.Constraint primary_constraint, RoomConstraints.Constraint[] additional_constraints, RoomDetails.Detail[] display_details, int priority = 0, RoomType[] upgrade_paths = null, bool single_assignee = false, bool priority_building_use = false, string[] effects = null, int sortKey = 0)
     : base(id, name)
 {
     this.tooltip                = tooltip;
     this.effect                 = effect;
     this.category               = category;
     this.primary_constraint     = primary_constraint;
     this.additional_constraints = additional_constraints;
     this.display_details        = display_details;
     this.priority               = priority;
     this.upgrade_paths          = upgrade_paths;
     this.single_assignee        = single_assignee;
     this.priority_building_use  = priority_building_use;
     this.effects                = effects;
     this.sortKey                = sortKey;
     if (this.upgrade_paths != null)
     {
         RoomType[] upgrade_paths2 = this.upgrade_paths;
         foreach (RoomType roomType in upgrade_paths2)
         {
             Debug.Assert(roomType != null, name + " has a null upgrade path. Maybe it wasn't initialized yet.");
         }
     }
 }
Exemple #15
0
        public RoomTypes(ResourceSet parent)
            : base("RoomTypes", parent)
        {
            Initialize();
            Neutral = Add(new RoomType("Neutral", ROOMS.TYPES.NEUTRAL.NAME, ROOMS.TYPES.NEUTRAL.TOOLTIP, ROOMS.TYPES.NEUTRAL.EFFECT, Db.Get().RoomTypeCategories.None, null, null, new RoomDetails.Detail[4]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT,
                RoomDetails.CREATURE_COUNT,
                RoomDetails.PLANT_COUNT
            }, 0, null, false, false, null, 0));
            string           id       = "PlumbedBathroom";
            string           name     = ROOMS.TYPES.PLUMBEDBATHROOM.NAME;
            string           tooltip  = ROOMS.TYPES.PLUMBEDBATHROOM.TOOLTIP;
            string           effect   = ROOMS.TYPES.PLUMBEDBATHROOM.EFFECT;
            RoomTypeCategory bathroom = Db.Get().RoomTypeCategories.Bathroom;

            RoomConstraints.Constraint   fLUSH_TOILET           = RoomConstraints.FLUSH_TOILET;
            RoomConstraints.Constraint[] additional_constraints = new RoomConstraints.Constraint[5]
            {
                RoomConstraints.ADVANCED_WASH_STATION,
                RoomConstraints.NO_OUTHOUSES,
                RoomConstraints.NO_INDUSTRIAL_MACHINERY,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraints.MAXIMUM_SIZE_64
            };
            RoomDetails.Detail[] display_details = new RoomDetails.Detail[2]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT
            };
            int priority = 1;

            string[] effects = new string[1]
            {
                "RoomBathroom"
            };
            PlumbedBathroom = Add(new RoomType(id, name, tooltip, effect, bathroom, fLUSH_TOILET, additional_constraints, display_details, priority, null, false, false, effects, 2));
            effect          = "Latrine";
            tooltip         = ROOMS.TYPES.LATRINE.NAME;
            name            = ROOMS.TYPES.LATRINE.TOOLTIP;
            id                     = ROOMS.TYPES.LATRINE.EFFECT;
            bathroom               = Db.Get().RoomTypeCategories.Bathroom;
            fLUSH_TOILET           = RoomConstraints.TOILET;
            additional_constraints = new RoomConstraints.Constraint[4]
            {
                RoomConstraints.WASH_STATION,
                RoomConstraints.NO_INDUSTRIAL_MACHINERY,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraints.MAXIMUM_SIZE_64
            };
            display_details = new RoomDetails.Detail[2]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT
            };
            priority = 1;
            RoomType[] upgrade_paths = new RoomType[1]
            {
                PlumbedBathroom
            };
            effects = new string[1]
            {
                "RoomLatrine"
            };
            Latrine                = Add(new RoomType(effect, tooltip, name, id, bathroom, fLUSH_TOILET, additional_constraints, display_details, priority, upgrade_paths, false, false, effects, 1));
            id                     = "Bedroom";
            name                   = ROOMS.TYPES.BEDROOM.NAME;
            tooltip                = ROOMS.TYPES.BEDROOM.TOOLTIP;
            effect                 = ROOMS.TYPES.BEDROOM.EFFECT;
            bathroom               = Db.Get().RoomTypeCategories.Sleep;
            fLUSH_TOILET           = RoomConstraints.LUXURY_BED_SINGLE;
            additional_constraints = new RoomConstraints.Constraint[6]
            {
                RoomConstraints.NO_COTS,
                RoomConstraints.NO_INDUSTRIAL_MACHINERY,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraints.MAXIMUM_SIZE_64,
                RoomConstraints.DECORATIVE_ITEM,
                RoomConstraints.CEILING_HEIGHT_4
            };
            display_details = new RoomDetails.Detail[2]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT
            };
            priority = 1;
            effects  = new string[1]
            {
                "RoomBedroom"
            };
            Bedroom                = Add(new RoomType(id, name, tooltip, effect, bathroom, fLUSH_TOILET, additional_constraints, display_details, priority, null, false, false, effects, 4));
            effect                 = "Barracks";
            tooltip                = ROOMS.TYPES.BARRACKS.NAME;
            name                   = ROOMS.TYPES.BARRACKS.TOOLTIP;
            id                     = ROOMS.TYPES.BARRACKS.EFFECT;
            bathroom               = Db.Get().RoomTypeCategories.Sleep;
            fLUSH_TOILET           = RoomConstraints.BED_SINGLE;
            additional_constraints = new RoomConstraints.Constraint[3]
            {
                RoomConstraints.NO_INDUSTRIAL_MACHINERY,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraints.MAXIMUM_SIZE_64
            };
            display_details = new RoomDetails.Detail[2]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT
            };
            priority      = 1;
            upgrade_paths = new RoomType[1]
            {
                Bedroom
            };
            effects = new string[1]
            {
                "RoomBarracks"
            };
            Barracks               = Add(new RoomType(effect, tooltip, name, id, bathroom, fLUSH_TOILET, additional_constraints, display_details, priority, upgrade_paths, false, false, effects, 3));
            id                     = "GreatHall";
            name                   = ROOMS.TYPES.GREATHALL.NAME;
            tooltip                = ROOMS.TYPES.GREATHALL.TOOLTIP;
            effect                 = ROOMS.TYPES.GREATHALL.EFFECT;
            bathroom               = Db.Get().RoomTypeCategories.Food;
            fLUSH_TOILET           = RoomConstraints.MESS_STATION_SINGLE;
            additional_constraints = new RoomConstraints.Constraint[5]
            {
                RoomConstraints.NO_INDUSTRIAL_MACHINERY,
                RoomConstraints.MINIMUM_SIZE_32,
                RoomConstraints.MAXIMUM_SIZE_120,
                RoomConstraints.DECORATIVE_ITEM_20,
                RoomConstraints.REC_BUILDING
            };
            display_details = new RoomDetails.Detail[2]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT
            };
            priority = 1;
            effects  = new string[1]
            {
                "RoomGreatHall"
            };
            GreatHall              = Add(new RoomType(id, name, tooltip, effect, bathroom, fLUSH_TOILET, additional_constraints, display_details, priority, null, false, false, effects, 6));
            effect                 = "MessHall";
            tooltip                = ROOMS.TYPES.MESSHALL.NAME;
            name                   = ROOMS.TYPES.MESSHALL.TOOLTIP;
            id                     = ROOMS.TYPES.MESSHALL.EFFECT;
            bathroom               = Db.Get().RoomTypeCategories.Food;
            fLUSH_TOILET           = RoomConstraints.MESS_STATION_SINGLE;
            additional_constraints = new RoomConstraints.Constraint[3]
            {
                RoomConstraints.NO_INDUSTRIAL_MACHINERY,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraints.MAXIMUM_SIZE_64
            };
            display_details = new RoomDetails.Detail[2]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT
            };
            priority      = 1;
            upgrade_paths = new RoomType[1]
            {
                GreatHall
            };
            effects = new string[1]
            {
                "RoomMessHall"
            };
            MessHall      = Add(new RoomType(effect, tooltip, name, id, bathroom, fLUSH_TOILET, additional_constraints, display_details, priority, upgrade_paths, false, false, effects, 5));
            MassageClinic = Add(new RoomType("MassageClinic", ROOMS.TYPES.MASSAGE_CLINIC.NAME, ROOMS.TYPES.MASSAGE_CLINIC.TOOLTIP, ROOMS.TYPES.MASSAGE_CLINIC.EFFECT, Db.Get().RoomTypeCategories.Hospital, RoomConstraints.MASSAGE_TABLE, new RoomConstraints.Constraint[4]
            {
                RoomConstraints.NO_INDUSTRIAL_MACHINERY,
                RoomConstraints.DECORATIVE_ITEM,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraints.MAXIMUM_SIZE_64
            }, new RoomDetails.Detail[2]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT
            }, 2, null, true, true, null, 7));
            Hospital = Add(new RoomType("Hospital", ROOMS.TYPES.HOSPITAL.NAME, ROOMS.TYPES.HOSPITAL.TOOLTIP, ROOMS.TYPES.HOSPITAL.EFFECT, Db.Get().RoomTypeCategories.Hospital, RoomConstraints.CLINIC, new RoomConstraints.Constraint[5]
            {
                RoomConstraints.TOILET,
                RoomConstraints.MESS_STATION_SINGLE,
                RoomConstraints.NO_INDUSTRIAL_MACHINERY,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraints.MAXIMUM_SIZE_96
            }, new RoomDetails.Detail[2]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT
            }, 2, null, true, true, null, 8));
            PowerPlant = Add(new RoomType("PowerPlant", ROOMS.TYPES.POWER_PLANT.NAME, ROOMS.TYPES.POWER_PLANT.TOOLTIP, ROOMS.TYPES.POWER_PLANT.EFFECT, Db.Get().RoomTypeCategories.Industrial, RoomConstraints.POWER_STATION, new RoomConstraints.Constraint[2]
            {
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraints.MAXIMUM_SIZE_96
            }, new RoomDetails.Detail[2]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT
            }, 2, null, true, true, null, 9));
            Farm = Add(new RoomType("Farm", ROOMS.TYPES.FARM.NAME, ROOMS.TYPES.FARM.TOOLTIP, ROOMS.TYPES.FARM.EFFECT, Db.Get().RoomTypeCategories.Agricultural, RoomConstraints.FARM_STATION, new RoomConstraints.Constraint[2]
            {
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraints.MAXIMUM_SIZE_96
            }, new RoomDetails.Detail[2]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT
            }, 2, null, true, true, null, 10));
            CreaturePen = Add(new RoomType("CreaturePen", ROOMS.TYPES.CREATUREPEN.NAME, ROOMS.TYPES.CREATUREPEN.TOOLTIP, ROOMS.TYPES.CREATUREPEN.EFFECT, Db.Get().RoomTypeCategories.Agricultural, RoomConstraints.RANCH_STATION, new RoomConstraints.Constraint[2]
            {
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraints.MAXIMUM_SIZE_96
            }, new RoomDetails.Detail[3]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT,
                RoomDetails.CREATURE_COUNT
            }, 2, null, true, true, null, 11));
            MachineShop = new RoomType("MachineShop", ROOMS.TYPES.MACHINE_SHOP.NAME, ROOMS.TYPES.MACHINE_SHOP.TOOLTIP, ROOMS.TYPES.MACHINE_SHOP.EFFECT, Db.Get().RoomTypeCategories.Industrial, RoomConstraints.MACHINE_SHOP, new RoomConstraints.Constraint[2]
            {
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraints.MAXIMUM_SIZE_96
            }, new RoomDetails.Detail[2]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT
            }, 2, null, true, true, null, 12);
            RecRoom = Add(new RoomType("RecRoom", ROOMS.TYPES.REC_ROOM.NAME, ROOMS.TYPES.REC_ROOM.TOOLTIP, ROOMS.TYPES.REC_ROOM.EFFECT, Db.Get().RoomTypeCategories.Recreation, RoomConstraints.REC_BUILDING, new RoomConstraints.Constraint[4]
            {
                RoomConstraints.NO_INDUSTRIAL_MACHINERY,
                RoomConstraints.DECORATIVE_ITEM,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraints.MAXIMUM_SIZE_64
            }, new RoomDetails.Detail[2]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT
            }, 0, null, true, true, null, 13));
            id                     = "NatureReserve";
            name                   = ROOMS.TYPES.NATURERESERVE.NAME;
            tooltip                = ROOMS.TYPES.NATURERESERVE.TOOLTIP;
            effect                 = ROOMS.TYPES.NATURERESERVE.EFFECT;
            bathroom               = Db.Get().RoomTypeCategories.Park;
            fLUSH_TOILET           = RoomConstraints.PARK_BUILDING;
            additional_constraints = new RoomConstraints.Constraint[4]
            {
                RoomConstraints.WILDPLANTS,
                RoomConstraints.NO_INDUSTRIAL_MACHINERY,
                RoomConstraints.MINIMUM_SIZE_32,
                RoomConstraints.MAXIMUM_SIZE_120
            };
            display_details = new RoomDetails.Detail[4]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT,
                RoomDetails.CREATURE_COUNT,
                RoomDetails.PLANT_COUNT
            };
            priority = 1;
            effects  = new string[1]
            {
                "RoomNatureReserve"
            };
            NatureReserve          = Add(new RoomType(id, name, tooltip, effect, bathroom, fLUSH_TOILET, additional_constraints, display_details, priority, null, false, false, effects, 15));
            effect                 = "Park";
            tooltip                = ROOMS.TYPES.PARK.NAME;
            name                   = ROOMS.TYPES.PARK.TOOLTIP;
            id                     = ROOMS.TYPES.PARK.EFFECT;
            bathroom               = Db.Get().RoomTypeCategories.Park;
            fLUSH_TOILET           = RoomConstraints.PARK_BUILDING;
            additional_constraints = new RoomConstraints.Constraint[4]
            {
                RoomConstraints.WILDPLANT,
                RoomConstraints.NO_INDUSTRIAL_MACHINERY,
                RoomConstraints.MINIMUM_SIZE_12,
                RoomConstraints.MAXIMUM_SIZE_64
            };
            display_details = new RoomDetails.Detail[4]
            {
                RoomDetails.SIZE,
                RoomDetails.BUILDING_COUNT,
                RoomDetails.CREATURE_COUNT,
                RoomDetails.PLANT_COUNT
            };
            priority      = 1;
            upgrade_paths = new RoomType[1]
            {
                NatureReserve
            };
            effects = new string[1]
            {
                "RoomPark"
            };
            Park = Add(new RoomType(effect, tooltip, name, id, bathroom, fLUSH_TOILET, additional_constraints, display_details, priority, upgrade_paths, false, false, effects, 14));
        }