public static void Postfix(SeedProducer __instance) { if (!Settings.Instance.Nursery.IncludeRoom) { return; } if (!RoomTypes_AllModded.IsInTheRoom(__instance, RoomTypeNurseryData.RoomId)) { return; } if (__instance.seedInfo.productionType != SeedProducer.ProductionType.Harvest || !Settings.Instance.Nursery.Bonus.HasValue) { return; } double chance = Settings.Instance.Nursery.Bonus.Value; if ((double)UnityEngine.Random.Range(0.0f, 1f) <= chance) { if (ModInfo.Instance.ExecutedWithDLC()) { Traverse.Create(__instance).Method("ProduceSeed", new object[] { __instance.seedInfo.seedId, 1, true }).GetValue <GameObject>(); } else { Traverse.Create(__instance).Method("ProduceSeed", new object[] { __instance.seedInfo.seedId, 1 }).GetValue <GameObject>(); } //__instance.ProduceSeed(__instance.seedInfo.seedId, 1); } }
public static void Prefix(Bed __instance) { if (!Settings.Instance.PrivateBedroom.IncludeRoom) { return; } if (!RoomTypes_AllModded.IsInTheRoom(__instance, RoomTypePrivateRoomData.RoomId)) { return; } Sleepable sleepable = Traverse.Create(__instance).Field("sleepable").GetValue <Sleepable>(); if (sleepable == null) { return; } if (__instance.gameObject.name == "BedComplete") { sleepable.worker.GetComponent <Effects>().Add(RoomTypePrivateRoomData.BasicEffectId, true); } else if (__instance.gameObject.name == "LuxuryBedComplete") { sleepable.worker.GetComponent <Effects>().Add(RoomTypePrivateRoomData.LuxuryEffectId, true); } else { Debug.Log($"RoomsExpanded: invalid bed name in Private Bedroom: {__instance.gameObject.name}"); } }
public void Sim1000ms(float dt) { InitalizeEffectors(); if (RoomTypes_AllModded.IsInTheRoom(this, RoomTypeAquariumData.RoomId)) { provider.SetValues(bonusEffector); } else { provider.SetValues(initialEffector); } }
private void TriggerRoomEffects(object data) { if (!RoomTypes_AllModded.IsInTheRoom(this, RoomTypeMuseumData.RoomId)) { return; } if (!Settings.Instance.Museum.Bonus.HasValue) { return; } GameObject gameObject = (GameObject)data; MinionModifiers modifiers = gameObject.GetComponent <MinionModifiers>(); if (modifiers == null) { return; } AttributeInstance attributeInstance = modifiers.attributes.AttributeTable.Where(p => p.Name == "Creativity").FirstOrDefault(); if (attributeInstance == null) { return; } float creativity = attributeInstance.GetTotalValue(); int moraleBonus = (int)Math.Ceiling(creativity * Settings.Instance.Museum.Bonus.Value); if (moraleBonus < 1) { moraleBonus = 1; } if (moraleBonus > 10) { moraleBonus = 10; } Effect effect = new Effect(RoomTypeMuseumData.EffectId, STRINGS.ROOMS.EFFECTS.MUSEUM.NAME, STRINGS.ROOMS.EFFECTS.MUSEUM.DESCRIPTION, 240, false, true, false); effect.SelfModifiers = new System.Collections.Generic.List <AttributeModifier>(); effect.SelfModifiers.Add(new AttributeModifier("QualityOfLife", moraleBonus, description: STRINGS.ROOMS.EFFECTS.MUSEUM.NAME)); Effects effects = gameObject.GetComponent <Effects>(); if (effects != null && !effects.HasEffect(RoomTypeMuseumData.EffectId)) { effects.Add(effect, true); } }
private static void ModifyKitchenResultUnits(ref List <GameObject> __result, ref CookingStation __instance) { if (!Settings.Instance.Kitchen.IncludeRoom) { return; } if (RoomTypes_AllModded.IsInTheRoom(__instance, RoomTypeKitchenData.RoomId) && Settings.Instance.Kitchen.Bonus.HasValue) { foreach (GameObject go in __result) { go.GetComponent <PrimaryElement>().Units *= (1 + Settings.Instance.Kitchen.Bonus.Value); } } }
public static void Prefix(ref float mass_consumed, ref ResearchCenter __instance) { if (!Settings.Instance.Laboratory.IncludeRoom) { return; } if (__instance == null) { return; } if (RoomTypes_AllModded.IsInTheRoom(__instance, RoomTypeLaboratoryData.RoomId) && Settings.Instance.Laboratory.Bonus.HasValue) { mass_consumed *= (1 + Settings.Instance.Laboratory.Bonus.Value); } }
public static void Postfix(ref Shower __instance, float dt) { if (!Settings.Instance.Bathroom.IncludeRoom) { return; } if (string.IsNullOrEmpty(PlumbedBathroomId)) { PlumbedBathroomId = Db.Get().RoomTypes.PlumbedBathroom.Id; } if ((RoomTypes_AllModded.IsInTheRoom(__instance, RoomTypeBathroomData.RoomId) || RoomTypes_AllModded.IsInTheRoom(__instance, PlumbedBathroomId)) && Settings.Instance.Bathroom.Bonus.HasValue) { __instance.WorkTimeRemaining -= dt * Settings.Instance.Bathroom.Bonus.Value; } }
public static void Postfix(SeedProducer __instance) { if (!Settings.Instance.Nursery.IncludeRoom) { return; } if (!RoomTypes_AllModded.IsInTheRoom(__instance, RoomTypeNurseryData.RoomId)) { return; } if (__instance.seedInfo.productionType != SeedProducer.ProductionType.Harvest || !Settings.Instance.Nursery.Bonus.HasValue) { return; } double chance = (double)Settings.Instance.Nursery.Bonus.Value; __instance.ProduceSeed(__instance.seedInfo.seedId, (double)UnityEngine.Random.Range(0.0f, 1f) <= chance ? 1 : 0); }
public static void Postfix(ref Worker worker, float dt, ref ManualGenerator __instance) { if (!Settings.Instance.Gym.IncludeRoom) { return; } if (RoomTypes_AllModded.IsInTheRoom(__instance, RoomTypeGymData.RoomId)) { if (string.IsNullOrEmpty(AthleticsId)) { AthleticsId = Db.Get().Attributes.Athletics.Id; } AttributeLevels component = worker.GetComponent <AttributeLevels>(); if (component != null && Settings.Instance.Gym.Bonus.HasValue) { component.AddExperience(AthleticsId, dt * Settings.Instance.Gym.Bonus.Value, DUPLICANTSTATS.ATTRIBUTE_LEVELING.ALL_DAY_EXPERIENCE); } } }
private void TriggerRoomEffects(object data) { if (!RoomTypes_AllModded.IsInTheRoom(this, RoomTypeGraveyardData.RoomId)) { return; } if (!Settings.Instance.Graveyard.Bonus.HasValue) { return; } GameObject gameObject = (GameObject)data; float duration = 600 * Settings.Instance.Graveyard.Bonus.Value; bool positive = false; if (!GameClock.Instance.IsNighttime()) { positive = new System.Random().Next() % 2 == 0; } float value = -0.016666667f * (positive ? 1 : -1); string name = positive ? STRINGS.ROOMS.EFFECTS.GRAVE_GOOD.NAME : STRINGS.ROOMS.EFFECTS.GRAVE_BAD.NAME; string description = positive ? STRINGS.ROOMS.EFFECTS.GRAVE_GOOD.DESCRIPTION : STRINGS.ROOMS.EFFECTS.GRAVE_BAD.DESCRIPTION; Effects effects = gameObject.GetComponent <Effects>(); if (effects == null || effects.HasEffect(RoomTypeGraveyardData.EffectId)) { return; } // Works for DLC /**/ Effect effect = new Effect(RoomTypeGraveyardData.EffectId, name, description, duration, true, true, false); effect.SelfModifiers = new System.Collections.Generic.List <AttributeModifier>(); effect.SelfModifiers.Add(new AttributeModifier("StressDelta", value, description: name)); effects.Add(effect, true); }
public static void AddRoom(ref RoomTypes __instance) { if (Settings.Instance.Industrial.IncludeRoom) { List <RoomType> upgrades = new List <RoomType>(); upgrades.Add(__instance.PowerPlant); upgrades.Add(__instance.Farm); upgrades.Add(__instance.CreaturePen); if (Settings.Instance.Laboratory.IncludeRoom) { upgrades.Add(RoomTypes_AllModded.LaboratoryRoom); } if (Settings.Instance.Kitchen.IncludeRoom) { upgrades.Add(RoomTypes_AllModded.KitchenRoom); } if (Settings.Instance.Gym.IncludeRoom) { upgrades.Add(RoomTypes_AllModded.GymRoom); } __instance.Add(RoomTypes_AllModded.IndustrialRoom(upgrades.ToArray())); } }