public static GameObject ExtendEntityToWildCreature(GameObject prefab, int space_required_per_creature, float lifespan) { prefab.AddOrGetDef <AgeMonitor.Def>(); prefab.AddOrGetDef <HappinessMonitor.Def>(); Tag prefabTag = prefab.GetComponent <KPrefabID>().PrefabTag; WildnessMonitor.Def def = prefab.AddOrGetDef <WildnessMonitor.Def>(); def.wildEffect = new Effect("Wild" + prefabTag.Name, STRINGS.CREATURES.MODIFIERS.WILD.NAME, STRINGS.CREATURES.MODIFIERS.WILD.TOOLTIP, 0f, true, true, false, null, 0f, null); def.wildEffect.Add(new AttributeModifier(Db.Get().Amounts.Wildness.deltaAttribute.Id, 0.008333334f, STRINGS.CREATURES.MODIFIERS.WILD.NAME, false, false, true)); def.wildEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Metabolism.Id, 25f, STRINGS.CREATURES.MODIFIERS.WILD.NAME, false, false, true)); def.wildEffect.Add(new AttributeModifier(Db.Get().Amounts.ScaleGrowth.deltaAttribute.Id, -0.75f, STRINGS.CREATURES.MODIFIERS.WILD.NAME, true, false, true)); def.tameEffect = new Effect("Tame" + prefabTag.Name, STRINGS.CREATURES.MODIFIERS.TAME.NAME, STRINGS.CREATURES.MODIFIERS.TAME.TOOLTIP, 0f, true, true, false, null, 0f, null); def.tameEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Happiness.Id, -1f, STRINGS.CREATURES.MODIFIERS.TAME.NAME, false, false, true)); def.tameEffect.Add(new AttributeModifier(Db.Get().CritterAttributes.Metabolism.Id, 100f, STRINGS.CREATURES.MODIFIERS.TAME.NAME, false, false, true)); OvercrowdingMonitor.Def def2 = prefab.AddOrGetDef <OvercrowdingMonitor.Def>(); def2.spaceRequiredPerCreature = space_required_per_creature; prefab.AddTag(GameTags.Plant); return(prefab); }
protected override void OnPrefabInit() { base.OnPrefabInit(); Subscribe((int)GameHashes.RefreshUserMenu, ON_REFRESH_MENU); wildMonitor = gameObject.GetDef <WildnessMonitor.Def>(); }