/// <summary> /// Adds the additional Moo chores required for growth. Growing up and giving birth /// chores are required. /// </summary> /// <param name="prefab">The prefab to add chores.</param> internal static void UpdateMooChores(GameObject prefab) { var cc = prefab.GetComponent <ChoreConsumer>(); var newChoreTable = new ChoreTable.Builder(). Add(new DeathStates.Def()). Add(new AnimInterruptStates.Def()). Add(new BaggedStates.Def()). Add(new StunnedStates.Def()). Add(new DebugGoToStates.Def()). Add(new DrowningStates.Def()). Add(new MooGrowUpStates.Def()). PushInterruptGroup(). Add(new CreatureSleepStates.Def()). Add(new FixedCaptureStates.Def()). Add(new RanchedStates.Def()). Add(new GiveBirthStates.Def()). Add(new EatStates.Def()). Add(new PlayAnimsStates.Def(GameTags.Creatures.Poop, false, "poop", STRINGS.CREATURES.STATUSITEMS.EXPELLING_GAS.NAME, STRINGS.CREATURES.STATUSITEMS.EXPELLING_GAS.TOOLTIP)). Add(new MoveToLureStates.Def()). PopInterruptGroup(). Add(new IdleStates.Def { customIdleAnim = MOO_IDLE_ANIM }); if (cc != null) { cc.choreTable = newChoreTable.CreateTable(); } }
public static GameObject BaseRollerSnake(string id, string name, string desc, string anim_file, string traitId, bool is_baby, string symbolOverridePrefix = null) { GameObject placedEntity = EntityTemplates.CreatePlacedEntity(id, name, desc, Mass, Assets.GetAnim(anim_file), "idle_loop", Grid.SceneLayer.Creatures, width: 1, height: 1, TUNING.DECOR.BONUS.TIER1, new EffectorValues(), SimHashes.Creature, null, DefaultTemperature); string NavGridName = NavGridId; if (is_baby) { NavGridName = NavGridBabyId; } EntityTemplates.ExtendEntityToBasicCreature(placedEntity, FactionManager.FactionID.Pest, traitId, NavGridName, NavType.Floor, 32, moveSpeed: MoveSpeed, onDeathDropID: OnDeathDropId, onDeathDropCount: OnDeathDropCount, false, false, lethalLowTemperature: TemperatureLethalLow, warningLowTemperature: TemperatureWarningLow, warningHighTemperature: TemperatureWarningHigh, lethalHighTemperature: TemperatureLethalHigh); if (symbolOverridePrefix != null) { placedEntity.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim(anim_file), symbolOverridePrefix, null, 0); } placedEntity.AddOrGet <Trappable>(); placedEntity.AddOrGetDef <CreatureFallMonitor.Def>(); placedEntity.AddOrGetDef <ThreatMonitor.Def>().fleethresholdState = Health.HealthState.Dead; placedEntity.AddWeapon(1f, 1f, AttackProperties.DamageType.Standard, AttackProperties.TargetType.Single, 1, 0.0f); EntityTemplates.CreateAndRegisterBaggedCreature(placedEntity, true, true, false); KPrefabID component = placedEntity.GetComponent <KPrefabID>(); component.AddTag(GameTags.Creatures.Walker, false); component.prefabInitFn += (inst => inst.GetAttributes().Add(Db.Get().Attributes.MaxUnderwaterTravelCost)); bool condition = !is_baby; ChoreTable.Builder chore_table = new ChoreTable.Builder() .Add(new DeathStates.Def(), true) .Add(new AnimInterruptStates.Def(), true) .Add(new GrowUpStates.Def(), true) .Add(new TrappedStates.Def(), true) .Add(new IncubatingStates.Def(), true) .Add(new BaggedStates.Def(), true) .Add(new FallStates.Def(), true) .Add(new StunnedStates.Def(), true) .Add(new DebugGoToStates.Def(), true) .Add(new FleeStates.Def(), true) .Add(new AttackStates.Def(), condition).PushInterruptGroup() .Add(new CreatureSleepStates.Def(), true) .Add(new FixedCaptureStates.Def(), true) .Add(new RanchedStates.Def(), true) .Add(new LayEggStates.Def(), true) .Add(new EatStates.Def(), true) .Add(new PlayAnimsStates.Def(GameTags.Creatures.Poop, false, "poop", STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.NAME, STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.TOOLTIP), true) .Add(new CallAdultStates.Def(), true).PopInterruptGroup() .Add(new IdleStates.Def(), true); EntityTemplates.AddCreatureBrain(placedEntity, chore_table, SpeciesId, symbolOverridePrefix); placedEntity.AddTag(GameTags.Amphibious); return(placedEntity); }
public GameObject CreatePrefab() { string text = STRINGS.CREATURES.SPECIES.GLOM.NAME; string id = "Glom"; string name = text; string desc = STRINGS.CREATURES.SPECIES.GLOM.DESC; float mass = 25f; KAnimFile anim = Assets.GetAnim("glom_kanim"); string initialAnim = "idle_loop"; EffectorValues tIER = DECOR.BONUS.TIER0; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.Creatures, 1, 1, tIER, default(EffectorValues), SimHashes.Creature, null, 293f); Trait trait = Db.Get().CreateTrait("GlomBaseTrait", text, text, null, false, null, true, true); trait.Add(new AttributeModifier(Db.Get().Amounts.HitPoints.maxAttribute.Id, 25f, text, false, false, true)); KPrefabID component = gameObject.GetComponent <KPrefabID>(); component.AddTag(GameTags.Creatures.Walker, false); component.prefabInitFn += delegate(GameObject inst) { inst.GetAttributes().Add(Db.Get().Attributes.MaxUnderwaterTravelCost); }; EntityTemplates.ExtendEntityToBasicCreature(gameObject, FactionManager.FactionID.Pest, "GlomBaseTrait", "WalkerNavGrid1x1", NavType.Floor, 32, 2f, string.Empty, 0, true, true, 293.15f, 393.15f, 273.15f, 423.15f); gameObject.AddWeapon(1f, 1f, AttackProperties.DamageType.Standard, AttackProperties.TargetType.Single, 1, 0f); gameObject.AddOrGet <Trappable>(); gameObject.AddOrGetDef <ThreatMonitor.Def>(); gameObject.AddOrGetDef <CreatureFallMonitor.Def>(); ElementDropperMonitor.Def def = gameObject.AddOrGetDef <ElementDropperMonitor.Def>(); def.dirtyEmitElement = SimHashes.ContaminatedOxygen; def.dirtyProbabilityPercent = 25f; def.dirtyCellToTargetMass = 1f; def.dirtyMassPerDirty = 0.2f; def.dirtyMassReleaseOnDeath = 3f; def.emitDiseaseIdx = Db.Get().Diseases.GetIndex("SlimeLung"); def.emitDiseasePerKg = 1000f; OvercrowdingMonitor.Def def2 = gameObject.AddOrGetDef <OvercrowdingMonitor.Def>(); def2.spaceRequiredPerCreature = 0; gameObject.AddOrGet <LoopingSounds>(); LoopingSounds component2 = gameObject.GetComponent <LoopingSounds>(); component2.updatePosition = true; DiseaseSourceVisualizer diseaseSourceVisualizer = gameObject.AddOrGet <DiseaseSourceVisualizer>(); diseaseSourceVisualizer.alwaysShowDisease = "SlimeLung"; SoundEventVolumeCache.instance.AddVolume("glom_kanim", "Morb_movement_short", NOISE_POLLUTION.CREATURES.TIER2); SoundEventVolumeCache.instance.AddVolume("glom_kanim", "Morb_jump", NOISE_POLLUTION.CREATURES.TIER3); SoundEventVolumeCache.instance.AddVolume("glom_kanim", "Morb_land", NOISE_POLLUTION.CREATURES.TIER3); SoundEventVolumeCache.instance.AddVolume("glom_kanim", "Morb_expel", NOISE_POLLUTION.CREATURES.TIER4); EntityTemplates.CreateAndRegisterBaggedCreature(gameObject, true, false, false); ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new TrappedStates.Def(), true).Add(new BaggedStates.Def(), true) .Add(new FallStates.Def(), true) .Add(new StunnedStates.Def(), true) .Add(new DrowningStates.Def(), true) .Add(new DebugGoToStates.Def(), true) .Add(new FleeStates.Def(), true) .Add(new DropElementStates.Def(), true) .Add(new IdleStates.Def(), true); EntityTemplates.AddCreatureBrain(gameObject, chore_table, GameTags.Creatures.Species.GlomSpecies, null); return(gameObject); }
public static GameObject AquaticOilFloater(string id, string name, string desc, string anim_file, string traitId, float warnLowTemp, float warnHighTemp, bool is_baby, string symbolOverridePrefix = null) { float mass = 50f; EffectorValues tier = TUNING.DECOR.BONUS.TIER1; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, Assets.GetAnim(anim_file), "swim_idle_loop", Grid.SceneLayer.Creatures, 1, 1, tier, default(EffectorValues), SimHashes.Creature, null, (warnLowTemp + warnHighTemp) / 2f); gameObject.GetComponent <KPrefabID>().AddTag(GameTags.Creatures.Swimmer); gameObject.GetComponent <KPrefabID>().AddTag(GameTags.SwimmingCreature); EntityTemplates.ExtendEntityToBasicCreature(gameObject, FactionManager.FactionID.Pest, traitId, "SwimmerNavGrid", NavType.Swim, 32, 3f, TUNING.FOOD.FOOD_TYPES.FISH_MEAT.Id, 2, false, false, warnLowTemp, warnHighTemp, warnLowTemp - 15f, warnHighTemp + 20f); if (!string.IsNullOrEmpty(symbolOverridePrefix)) { gameObject.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim(anim_file), symbolOverridePrefix, null, 0); } gameObject.AddOrGet <ElementVulnerable>(); gameObject.AddOrGet <LoopingSounds>(); gameObject.AddOrGetDef <ThreatMonitor.Def>(); gameObject.AddOrGet <GasDrowningMonitor>(); gameObject.AddOrGetDef <CreatureAquaticGroomingMonitor.Def>(); gameObject.AddOrGetDef <CreatureFallMonitor.Def>().canSwim = true; gameObject.AddWeapon(1f, 1f, AttackProperties.DamageType.Standard, AttackProperties.TargetType.Single, 1, 0f); EntityTemplates.CreateAndRegisterBaggedCreature(gameObject, false, true, false); string inhaleSound = "OilFloater_intake_air"; if (is_baby) { inhaleSound = "OilFloaterBaby_intake_air"; } IdleStates.Def state = new IdleStates.Def(); state.customIdleAnim = new IdleStates.Def.IdleAnimCallback(AquaOilfloaterConfig.CustomIdleAnim); ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def()).Add(new AnimInterruptStates.Def()) .Add(new GrowUpStates.Def()).Add(new TrappedStates.Def()).Add(new IncubatingStates.Def()) .Add(new BaggedStates.Def()).Add(new FallStates.Def()).Add(new StunnedStates.Def()) /*.Add(new DrowningStates.Def())*/.Add(new DebugGoToStates.Def()).PushInterruptGroup()//.Add(new GasDrowningStates.Def()) .Add(new CreatureSleepStates.Def()).Add(new FixedCaptureStates.Def()) .Add(new RanchedStates.Def()).Add(new LayEggStates.Def()).Add(new InhaleStates.Def { inhaleSound = inhaleSound }).Add(new SameSpotPoopStates.Def()).Add(new CallAdultStates.Def()).PopInterruptGroup() .Add(state); EntityTemplates.AddCreatureBrain(gameObject, chore_table, GameTags.Creatures.Species.OilFloaterSpecies, symbolOverridePrefix); //string sound = "OilFloater_move_LP"; //if (is_baby) //{ // sound = "OilFloaterBaby_move_LP"; //} //gameObject.AddOrGet<OilFloaterMovementSound>().sound = sound; return(gameObject); }
public static GameObject BaseMoo(string id, string name, string desc, string traitId, string anim_file, bool is_baby, string symbol_override_prefix) { float mass = 50f; KAnimFile anim = Assets.GetAnim(anim_file); string initialAnim = "idle_loop"; EffectorValues tIER = DECOR.BONUS.TIER0; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.Creatures, 2, 2, tIER, default(EffectorValues), SimHashes.Creature, null, 293f); EntityTemplates.ExtendEntityToBasicCreature(gameObject, FactionManager.FactionID.Prey, traitId, "FlyerNavGrid2x2", NavType.Hover, 32, 2f, "Meat", 10, true, true, 123.149994f, 423.15f, 73.1499939f, 473.15f); if (!string.IsNullOrEmpty(symbol_override_prefix)) { gameObject.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim(anim_file), symbol_override_prefix, null, 0); } KPrefabID component = gameObject.GetComponent <KPrefabID>(); component.AddTag(GameTags.Creatures.Flyer, false); component.prefabInitFn += delegate(GameObject inst) { inst.GetAttributes().Add(Db.Get().Attributes.MaxUnderwaterTravelCost); }; gameObject.AddOrGet <LoopingSounds>(); LureableMonitor.Def def = gameObject.AddOrGetDef <LureableMonitor.Def>(); def.lures = new Tag[1] { SimHashes.BleachStone.CreateTag() }; gameObject.AddOrGetDef <ThreatMonitor.Def>(); gameObject.AddOrGetDef <SubmergedMonitor.Def>(); EntityTemplates.CreateAndRegisterBaggedCreature(gameObject, true, false, false); gameObject.AddOrGetDef <RanchableMonitor.Def>(); gameObject.AddOrGetDef <FixedCapturableMonitor.Def>(); ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true).Add(new BaggedStates.Def(), true) .Add(new StunnedStates.Def(), true) .Add(new DebugGoToStates.Def(), true) .Add(new DrowningStates.Def(), true) .PushInterruptGroup() .Add(new CreatureSleepStates.Def(), true) .Add(new FixedCaptureStates.Def(), true) .Add(new RanchedStates.Def(), true) .Add(new EatStates.Def(), true) .Add(new PlayAnimsStates.Def(GameTags.Creatures.Poop, false, "poop", STRINGS.CREATURES.STATUSITEMS.EXPELLING_GAS.NAME, STRINGS.CREATURES.STATUSITEMS.EXPELLING_GAS.TOOLTIP), true) .Add(new MoveToLureStates.Def(), true) .PopInterruptGroup() .Add(new IdleStates.Def { customIdleAnim = new IdleStates.Def.IdleAnimCallback(BaseMooConfig.CustomIdleAnim) }, true); EntityTemplates.AddCreatureBrain(gameObject, chore_table, GameTags.Creatures.Species.MooSpecies, symbol_override_prefix); return(gameObject); }
public static void AddCreatureBrain(GameObject prefab, ChoreTable.Builder chore_table, Tag species, string symbol_prefix) { CreatureBrain creatureBrain = prefab.AddOrGet <CreatureBrain>(); creatureBrain.species = species; creatureBrain.symbolPrefix = symbol_prefix; ChoreConsumer chore_consumer = prefab.AddOrGet <ChoreConsumer>(); chore_consumer.choreTable = chore_table.CreateTable(); KPrefabID kPrefabID = prefab.AddOrGet <KPrefabID>(); kPrefabID.AddTag(GameTags.CreatureBrain, false); kPrefabID.instantiateFn += delegate(GameObject go) { go.GetComponent <ChoreConsumer>().choreTable = chore_consumer.choreTable; }; }
public static GameObject BaseMole(string id, string name, string desc, string traitId, string anim_file, bool is_baby) { float mass = 25f; KAnimFile anim = Assets.GetAnim(anim_file); string initialAnim = "idle_loop"; EffectorValues nONE = TUNING.BUILDINGS.DECOR.NONE; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.Creatures, 1, 1, nONE, default(EffectorValues), SimHashes.Creature, null, 293f); EntityTemplates.ExtendEntityToBasicCreature(gameObject, FactionManager.FactionID.Pest, traitId, "DiggerNavGrid", NavType.Floor, 32, 2f, "Meat", 10, true, false, 123.149994f, 673.15f, 73.1499939f, 773.15f); gameObject.AddOrGetDef <CreatureFallMonitor.Def>(); gameObject.AddOrGet <Trappable>(); DiggerMonitor.Def def = gameObject.AddOrGetDef <DiggerMonitor.Def>(); def.depthToDig = MoleTuning.DEPTH_TO_HIDE; EntityTemplates.CreateAndRegisterBaggedCreature(gameObject, true, true, false); KPrefabID component = gameObject.GetComponent <KPrefabID>(); component.AddTag(GameTags.Creatures.Walker, false); ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true).Add(new FallStates.Def(), true) .Add(new StunnedStates.Def(), true) .Add(new DrowningStates.Def(), true) .Add(new DiggerStates.Def(), true) .Add(new GrowUpStates.Def(), true) .Add(new TrappedStates.Def(), true) .Add(new IncubatingStates.Def(), true) .Add(new BaggedStates.Def(), true) .Add(new DebugGoToStates.Def(), true) .Add(new FleeStates.Def(), true) .Add(new AttackStates.Def(), !is_baby) .PushInterruptGroup() .Add(new FixedCaptureStates.Def(), true) .Add(new RanchedStates.Def(), true) .Add(new LayEggStates.Def(), true) .Add(new CreatureSleepStates.Def(), true) .Add(new EatStates.Def(), true) .Add(new NestingPoopState.Def((!is_baby) ? SimHashes.Regolith.CreateTag() : Tag.Invalid), true) .Add(new PlayAnimsStates.Def(GameTags.Creatures.Poop, false, "poop", STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.NAME, STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.TOOLTIP), true) .PopInterruptGroup() .Add(new IdleStates.Def { customIdleAnim = new IdleStates.Def.IdleAnimCallback(BaseMoleConfig.CustomIdleAnim) }, true); EntityTemplates.AddCreatureBrain(gameObject, chore_table, GameTags.Creatures.Species.MoleSpecies, null); return(gameObject); }
public ChoreTable.Builder Get(GameObject go) { if (go == null || chore_table == null) { return(null); } if (automatically_populate) { PopulateDefs(go); } var result = new ChoreTable.Builder(); foreach (var def in chore_table) { result.Add(def); } return(result); }
public static GameObject CreatePrefab(string id, string base_trait_id, string name, string description, string anim_file, bool is_baby, string symbol_prefix, float warnLowTemp, float warnHighTemp) { float mass = 200f; KAnimFile anim = Assets.GetAnim(anim_file); string initialAnim = "idle_loop"; EffectorValues tIER = DECOR.BONUS.TIER0; float defaultTemperature = (warnLowTemp + warnHighTemp) / 2f; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, description, mass, anim, initialAnim, Grid.SceneLayer.Creatures, 1, 1, tIER, default(EffectorValues), SimHashes.Creature, null, defaultTemperature); KPrefabID component = gameObject.GetComponent <KPrefabID>(); component.AddTag(GameTags.SwimmingCreature, false); component.AddTag(GameTags.Creatures.Swimmer, false); Trait trait = Db.Get().CreateTrait(base_trait_id, name, name, null, false, null, true, true); trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.maxAttribute.Id, PacuTuning.STANDARD_STOMACH_SIZE, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, (0f - PacuTuning.STANDARD_CALORIES_PER_CYCLE) / 600f, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.HitPoints.maxAttribute.Id, 25f, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.Age.maxAttribute.Id, 25f, name, false, false, true)); EntityTemplates.CreateAndRegisterBaggedCreature(gameObject, false, false, true); EntityTemplates.ExtendEntityToBasicCreature(gameObject, FactionManager.FactionID.Prey, base_trait_id, "SwimmerNavGrid", NavType.Swim, 32, 2f, "FishMeat", 1, false, false, warnLowTemp, warnHighTemp, warnLowTemp - 20f, warnHighTemp + 20f); if (is_baby) { KBatchedAnimController component2 = gameObject.GetComponent <KBatchedAnimController>(); component2.animWidth = 0.5f; component2.animHeight = 0.5f; } ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true).Add(new GrowUpStates.Def(), true) .Add(new TrappedStates.Def(), true) .Add(new IncubatingStates.Def(), true) .Add(new BaggedStates.Def(), true) .Add(new FallStates.Def { getLandAnim = new Func <FallStates.Instance, string>(GetLandAnim) }, true) .Add(new DebugGoToStates.Def(), true) .Add(new FlopStates.Def(), true) .PushInterruptGroup() .Add(new FixedCaptureStates.Def(), true) .Add(new LayEggStates.Def(), true) .Add(new EatStates.Def(), true) .Add(new PlayAnimsStates.Def(GameTags.Creatures.Poop, false, "lay_egg_pre", STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.NAME, STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.TOOLTIP), true) .Add(new MoveToLureStates.Def(), true) .PopInterruptGroup() .Add(new IdleStates.Def(), true); CreatureFallMonitor.Def def = gameObject.AddOrGetDef <CreatureFallMonitor.Def>(); def.canSwim = true; gameObject.AddOrGetDef <FlopMonitor.Def>(); gameObject.AddOrGetDef <FishOvercrowdingMonitor.Def>(); gameObject.AddOrGet <Trappable>(); gameObject.AddOrGet <LoopingSounds>(); EntityTemplates.AddCreatureBrain(gameObject, chore_table, GameTags.Creatures.Species.PacuSpecies, symbol_prefix); HashSet <Tag> hashSet = new HashSet <Tag>(); hashSet.Add(SimHashes.Algae.CreateTag()); Diet.Info[] infos = new Diet.Info[1] { new Diet.Info(hashSet, SimHashes.ToxicSand.CreateTag(), CALORIES_PER_KG_OF_ORE, TUNING.CREATURES.CONVERSION_EFFICIENCY.NORMAL, null, 0f, false, false) }; Diet diet = new Diet(infos); CreatureCalorieMonitor.Def def2 = gameObject.AddOrGetDef <CreatureCalorieMonitor.Def>(); def2.diet = diet; def2.minPoopSizeInCalories = CALORIES_PER_KG_OF_ORE * MIN_POOP_SIZE_IN_KG; SolidConsumerMonitor.Def def3 = gameObject.AddOrGetDef <SolidConsumerMonitor.Def>(); def3.diet = diet; LureableMonitor.Def def4 = gameObject.AddOrGetDef <LureableMonitor.Def>(); def4.lures = new Tag[1] { GameTags.Creatures.FishTrapLure }; if (!string.IsNullOrEmpty(symbol_prefix)) { gameObject.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim("pacu_kanim"), symbol_prefix, null, 0); } return(gameObject); }
public static GameObject BaseDrecko(string id, string name, string desc, string anim_file, string trait_id, bool is_baby, string symbol_override_prefix, float warnLowTemp, float warnHighTemp) { float mass = 200f; KAnimFile anim = Assets.GetAnim(anim_file); string initialAnim = "idle_loop"; EffectorValues tIER = DECOR.BONUS.TIER0; float defaultTemperature = (warnLowTemp + warnHighTemp) / 2f; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.Creatures, 1, 1, tIER, default(EffectorValues), SimHashes.Creature, null, defaultTemperature); KPrefabID component = gameObject.GetComponent <KPrefabID>(); component.AddTag(GameTags.Creatures.Walker, false); component.prefabInitFn += delegate(GameObject inst) { inst.GetAttributes().Add(Db.Get().Attributes.MaxUnderwaterTravelCost); }; string text = "DreckoNavGrid"; if (is_baby) { text = "DreckoBabyNavGrid"; } GameObject template = gameObject; FactionManager.FactionID faction = FactionManager.FactionID.Pest; string navGridName = text; defaultTemperature = 1f; string onDeathDropID = "Meat"; int onDeathDropCount = 2; EntityTemplates.ExtendEntityToBasicCreature(template, faction, trait_id, navGridName, NavType.Floor, 32, defaultTemperature, onDeathDropID, onDeathDropCount, true, false, warnLowTemp, warnHighTemp, warnLowTemp - 20f, warnHighTemp + 20f); if (!string.IsNullOrEmpty(symbol_override_prefix)) { gameObject.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim(anim_file), symbol_override_prefix, null, 0); } gameObject.AddOrGet <Trappable>(); gameObject.AddOrGetDef <CreatureFallMonitor.Def>(); gameObject.AddOrGet <LoopingSounds>(); ThreatMonitor.Def def = gameObject.AddOrGetDef <ThreatMonitor.Def>(); def.fleethresholdState = Health.HealthState.Dead; gameObject.AddWeapon(1f, 1f, AttackProperties.DamageType.Standard, AttackProperties.TargetType.Single, 1, 0f); EntityTemplates.CreateAndRegisterBaggedCreature(gameObject, true, true, false); ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true).Add(new GrowUpStates.Def(), true) .Add(new TrappedStates.Def(), true) .Add(new IncubatingStates.Def(), true) .Add(new BaggedStates.Def(), true) .Add(new FallStates.Def(), true) .Add(new StunnedStates.Def(), true) .Add(new DrowningStates.Def(), true) .Add(new DebugGoToStates.Def(), true) .Add(new FleeStates.Def(), true) .Add(new AttackStates.Def(), !is_baby) .PushInterruptGroup() .Add(new FixedCaptureStates.Def(), true) .Add(new RanchedStates.Def(), true) .Add(new LayEggStates.Def(), true) .Add(new EatStates.Def(), true) .Add(new PlayAnimsStates.Def(GameTags.Creatures.Poop, false, "poop", STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.NAME, STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.TOOLTIP), true) .Add(new CallAdultStates.Def(), true) .PopInterruptGroup() .Add(new IdleStates.Def { customIdleAnim = new IdleStates.Def.IdleAnimCallback(BaseDreckoConfig.CustomIdleAnim) }, true); EntityTemplates.AddCreatureBrain(gameObject, chore_table, GameTags.Creatures.Species.DreckoSpecies, symbol_override_prefix); return(gameObject); }
public static GameObject BaseOilFloater(string id, string name, string desc, string anim_file, string traitId, float warnLowTemp, float warnHighTemp, bool is_baby, string symbolOverridePrefix = null) { float mass = 50f; KAnimFile anim = Assets.GetAnim(anim_file); string initialAnim = "idle_loop"; EffectorValues tIER = DECOR.BONUS.TIER1; float defaultTemperature = (warnLowTemp + warnHighTemp) / 2f; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.Creatures, 1, 1, tIER, default(EffectorValues), SimHashes.Creature, null, defaultTemperature); gameObject.GetComponent <KPrefabID>().AddTag(GameTags.Creatures.Hoverer, false); GameObject template = gameObject; FactionManager.FactionID faction = FactionManager.FactionID.Pest; string navGridName = "FloaterNavGrid"; NavType navType = NavType.Hover; string onDeathDropID = "Meat"; int onDeathDropCount = 2; EntityTemplates.ExtendEntityToBasicCreature(template, faction, traitId, navGridName, navType, 32, 2f, onDeathDropID, onDeathDropCount, true, false, warnLowTemp, warnHighTemp, warnLowTemp - 15f, warnHighTemp + 20f); if (!string.IsNullOrEmpty(symbolOverridePrefix)) { gameObject.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim(anim_file), symbolOverridePrefix, null, 0); } gameObject.AddOrGet <Trappable>(); gameObject.AddOrGet <LoopingSounds>(); gameObject.AddOrGetDef <ThreatMonitor.Def>(); gameObject.AddOrGetDef <SubmergedMonitor.Def>(); CreatureFallMonitor.Def def = gameObject.AddOrGetDef <CreatureFallMonitor.Def>(); def.canSwim = true; gameObject.AddWeapon(1f, 1f, AttackProperties.DamageType.Standard, AttackProperties.TargetType.Single, 1, 0f); EntityTemplates.CreateAndRegisterBaggedCreature(gameObject, true, false, false); string inhaleSound = "OilFloater_intake_air"; if (is_baby) { inhaleSound = "OilFloaterBaby_intake_air"; } ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true).Add(new GrowUpStates.Def(), true) .Add(new TrappedStates.Def(), true) .Add(new IncubatingStates.Def(), true) .Add(new BaggedStates.Def(), true) .Add(new FallStates.Def(), true) .Add(new StunnedStates.Def(), true) .Add(new DrowningStates.Def(), true) .Add(new DebugGoToStates.Def(), true) .PushInterruptGroup() .Add(new CreatureSleepStates.Def(), true) .Add(new FixedCaptureStates.Def(), true) .Add(new RanchedStates.Def(), true) .Add(new LayEggStates.Def(), true) .Add(new InhaleStates.Def { inhaleSound = inhaleSound }, true) .Add(new SameSpotPoopStates.Def(), true) .Add(new CallAdultStates.Def(), true) .PopInterruptGroup() .Add(new IdleStates.Def(), true); EntityTemplates.AddCreatureBrain(gameObject, chore_table, GameTags.Creatures.Species.OilFloaterSpecies, symbolOverridePrefix); string sound = "OilFloater_move_LP"; if (is_baby) { sound = "OilFloaterBaby_move_LP"; } gameObject.AddOrGet <OilFloaterMovementSound>().sound = sound; return(gameObject); }
/// Creates new critters which were not already loaded by EntityLoad ... public static void CreateNewCritters() { foreach (var setting in CustomizeCritterState.StateManager.State.critter_settings) { if (setting?.id == null) { continue; } if (Assets.Prefabs.Find(a => a.gameObject?.name == setting.id) == null) { // configurations string id = setting.id; string name = setting.name ?? "Stone Hatch"; string desc = setting.desc ?? "Stone Hatches excrete solid Coal as waste and enjoy burrowing into the ground."; string anim_file = setting.anim_file ?? "hatch_kanim"; bool is_baby = setting.is_baby ?? false; string traitId = setting.traitId ?? "HatchHardBaseTrait"; string override_prefix = setting.override_prefix; int space_requirement = setting.space_requirement ?? HatchTuning.PEN_SIZE_PER_CREATURE; float lifespan = setting.lifespan ?? 100f; float mass = setting.mass ?? 100f; float width = setting.width ?? 1f; float height = setting.height ?? 1f; EffectorValues decor = setting.decor ?? TUNING.DECOR.BONUS.TIER0; string navGridName = setting.navGridName ?? (!is_baby ? "WalkerNavGrid1x1" : "WalkerBabyNavGrid"); NavType navi; Enum.TryParse(setting.navi, out navi);// ?? NavType.Floor; float moveSpeed = setting.moveSpeed ?? 2f; string[] dropOnDeath = setting.dropOnDeath ?? new string[] { "Meat", "Meat" }; bool canDrown = setting.canDrown ?? true; bool canCrushed = setting.canCrushed ?? false; float tempLowDeath = setting.tempLowDeath ?? 243.15f; float tempLowWarning = setting.tempLowWarning ?? 283.15f; float tempBorn = setting.tempBorn ?? 293f; float tempHighWarning = setting.tempHighWarning ?? 293.15f; float tempHighDeath = setting.tempHighDeath ?? 343.15f; bool pickup_only_from_top = setting.pickup_only_from_top ?? true; bool pickup_allow_mark = setting.pickup_allow_mark ?? true; bool pickup_use_gun = setting.pickup_use_gun ?? false; string[] tags = setting.tags ?? new string[] { GameTags.Creatures.Walker.ToString() }; Tag species = setting.species ?? GameTags.Creatures.Species.HatchSpecies; float attackValue = setting.attackValue ?? 1f; ChoreTable.Builder chore_table = setting.chore_table ?? new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true).Add(new ExitBurrowStates.Def(), !is_baby).Add(new PlayAnimsStates.Def(GameTags.Creatures.Burrowed, true, "idle_mound", STRINGS.CREATURES.STATUSITEMS.BURROWED.NAME, STRINGS.CREATURES.STATUSITEMS.BURROWED.TOOLTIP), !is_baby).Add(new GrowUpStates.Def(), true).Add(new TrappedStates.Def(), true).Add(new IncubatingStates.Def(), true).Add(new BaggedStates.Def(), true).Add(new FallStates.Def(), true).Add(new StunnedStates.Def(), true).Add(new DrowningStates.Def(), true).Add(new DebugGoToStates.Def(), true).Add(new FleeStates.Def(), true).Add(new AttackStates.Def(), !is_baby).PushInterruptGroup().Add(new CreatureSleepStates.Def(), true).Add(new FixedCaptureStates.Def(), true).Add(new RanchedStates.Def(), true).Add(new PlayAnimsStates.Def(GameTags.Creatures.WantsToEnterBurrow, false, "hide", STRINGS.CREATURES.STATUSITEMS.BURROWING.NAME, STRINGS.CREATURES.STATUSITEMS.BURROWING.TOOLTIP), !is_baby).Add(new LayEggStates.Def(), true).Add(new EatStates.Def(), true).Add(new PlayAnimsStates.Def(GameTags.Creatures.Poop, false, "poop", STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.NAME, STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.TOOLTIP), true).Add(new CallAdultStates.Def(), true).PopInterruptGroup().Add(new IdleStates.Def(), true); string adultId = setting.adultId ?? "HatchHard"; string eggId = setting.eggId ?? "HatchHardEgg"; string babyId = setting.babyId ?? "HatchHardBaby"; string dropOnMature = setting.dropOnMature ?? null; float fertility_cycles = setting.fertility_cycles ?? 60f; List <FertilityMonitor.BreedingChance> egg_chances = new List <FertilityMonitor.BreedingChance>(); egg_chances.Add(BreedingChance("HatchHardEgg", 1f)); bool is_ranchable = setting.is_ranchable ?? true; float calories_per_KG = setting.calories_per_KG ?? (700000f / 140f); float min_poop_KG = setting.min_poop_KG ?? 25f; List <Diet.Info> diet_list = setting.diet_list ?? BaseHatchConfig.HardRockDiet(SimHashes.Carbon.CreateTag(), calories_per_KG, TUNING.CREATURES.CONVERSION_EFFICIENCY.NORMAL, null, 0f); // end of configurations GameObject critter; critter = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, Assets.GetAnim(anim_file), "idle_loop", Grid.SceneLayer.Creatures, (int)width, (int)height, decor, default(EffectorValues), SimHashes.Creature, null, tempBorn); EntityTemplates.ExtendEntityToBasicCreature(critter, FactionManager.FactionID.Pest, traitId, navGridName, navi, 32, moveSpeed, "Meat", 2, canDrown, canCrushed, tempLowWarning, tempHighWarning, tempLowDeath, tempHighDeath); critter.AddOrGet <Butcherable>().SetDrops(dropOnDeath); if (override_prefix != null) { critter.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim(anim_file), override_prefix, null, 0); } critter.AddOrGet <Trappable>(); critter.AddOrGetDef <CreatureFallMonitor.Def>(); critter.AddOrGetDef <BurrowMonitor.Def>(); critter.AddOrGetDef <WorldSpawnableMonitor.Def>().adjustSpawnLocationCb = (int cell) => { return(cell); };//new Func<int, int>(BaseHatchConfig.AdjustSpawnLocationCB); critter.AddOrGetDef <ThreatMonitor.Def>().fleethresholdState = Health.HealthState.Dead; if (attackValue > 0f) { critter.AddWeapon(attackValue, attackValue, AttackProperties.DamageType.Standard, AttackProperties.TargetType.Single, 1, 0f); } EntityTemplates.CreateAndRegisterBaggedCreature(critter, pickup_only_from_top, pickup_allow_mark, pickup_use_gun); KPrefabID prefabID = critter.GetComponent <KPrefabID>(); prefabID.ProcessTags(tags); prefabID.prefabInitFn += delegate(GameObject inst) { inst.GetAttributes().Add(Db.Get().Attributes.MaxUnderwaterTravelCost); }; EntityTemplates.AddCreatureBrain(critter, chore_table, species, override_prefix); EntityTemplates.ExtendEntityToWildCreature(critter, space_requirement, lifespan); Diet diet = new Diet(diet_list.ToArray()); CreatureCalorieMonitor.Def calorieMonitor = critter.AddOrGetDef <CreatureCalorieMonitor.Def>(); calorieMonitor.diet = diet; calorieMonitor.minPoopSizeInCalories = calories_per_KG * min_poop_KG; critter.AddOrGetDef <SolidConsumerMonitor.Def>().diet = diet; if (is_baby) { EntityTemplates.ExtendEntityToBeingABaby(critter, adultId, dropOnMature); } else { FertilityMonitor.Def def = critter.AddOrGetDef <FertilityMonitor.Def>(); def.baseFertileCycles = fertility_cycles; def.eggPrefab = new Tag(eggId); def.initialBreedingWeights = egg_chances; KPrefabID creature_prefab_id = critter.GetComponent <KPrefabID>(); creature_prefab_id.prefabSpawnFn += delegate(GameObject inst) { WorldInventory.Instance.Discover(eggId.ToTag(), WorldInventory.GetCategoryForTags(egg_tags)); WorldInventory.Instance.Discover(babyId.ToTag(), WorldInventory.GetCategoryForTags(creature_prefab_id.Tags)); }; if (is_ranchable) { critter.AddOrGetDef <RanchableMonitor.Def>(); } critter.AddOrGetDef <FixedCapturableMonitor.Def>(); } if (setting.scales != null) { ScaleGrowthMonitor.Def def_scale = critter.AddOrGetDef <ScaleGrowthMonitor.Def>(); def_scale.defaultGrowthRate = setting.scales.growthRate ?? (setting.scales.growthRate ?? (1f / DreckoConfig.SCALE_GROWTH_TIME_IN_CYCLES / 600f)); def_scale.dropMass = setting.scales.mass ?? (DreckoConfig.FIBER_PER_CYCLE * DreckoConfig.SCALE_GROWTH_TIME_IN_CYCLES); def_scale.itemDroppedOnShear = setting.scales.drop ?? "Dirt"; def_scale.levelCount = setting.scales.levelCount ?? 6; def_scale.targetAtmosphere = (setting.scales.atmosphere ?? "Void").ToSimHash(); } if (setting.expulsion != null) { ElementDropperMonitor.Def def_morb = critter.AddOrGetDef <ElementDropperMonitor.Def>(); def_morb.dirtyEmitElement = (setting.expulsion.element ?? "Dirt").ToSimHash(); def_morb.dirtyProbabilityPercent = setting.expulsion.probability ?? 25f; def_morb.dirtyCellToTargetMass = setting.expulsion.cellTargetMass ?? 1f; def_morb.dirtyMassPerDirty = setting.expulsion.massPerDirt ?? 0.2f; def_morb.dirtyMassReleaseOnDeath = setting.expulsion.onDeath ?? 3f; def_morb.emitDiseaseIdx = Db.Get().Diseases.GetIndex(setting.expulsion.diseaseId ?? ""); def_morb.emitDiseasePerKg = setting.expulsion.diseaseAmount ?? 0f; } if (setting.light != null) { if (setting.light.color != Color.black) { Light2D light2D = critter.AddOrGet <Light2D>(); light2D.Color = setting.light.color ?? Color.white; light2D.overlayColour = TUNING.LIGHT2D.LIGHTBUG_OVERLAYCOLOR; light2D.Range = setting.light.range ?? 5f; light2D.Angle = 0f; light2D.Direction = TUNING.LIGHT2D.LIGHTBUG_DIRECTION; light2D.Offset = TUNING.LIGHT2D.LIGHTBUG_OFFSET; light2D.shape = LightShape.Circle; light2D.drawOverlay = true; light2D.Lux = setting.light.lux ?? 1800; critter.AddOrGet <LightSymbolTracker>().targetSymbol = "snapTo_light_locator"; critter.AddOrGetDef <CreatureLightToggleController.Def>(); } } } } }
public void test() { // configurations string id = "HatchHard"; string name = "Stone Hatch"; string desc = "Stone Hatches excrete solid Coal as waste and enjoy burrowing into the ground."; string anim_file = "hatch_kanim"; bool is_baby = false; string traitId = "HatchHardBaseTrait"; string override_prefix = "hvy_"; int space_requirement = HatchTuning.PEN_SIZE_PER_CREATURE; float lifespan = 100f; float mass = 100f; int width = 1; int height = 1; EffectorValues decor = TUNING.DECOR.BONUS.TIER0; string navGridName = !is_baby ? "WalkerNavGrid1x1" : "WalkerBabyNavGrid"; NavType navi = NavType.Floor; float moveSpeed = 2f; string dropOnDeath = "Meat"; int dropCount = 2; bool canDrown = true; bool canCrushed = false; float tempLowDeath = 243.15f; float tempLowWarning = 283.15f; float tempBorn = 293f; float tempHighWarning = 293.15f; float tempHighDeath = 343.15f; bool pickup_only_from_top = true; bool pickup_allow_mark = true; bool pickup_use_gun = false; Tag tag = GameTags.Creatures.Walker; Tag species = GameTags.Creatures.Species.HatchSpecies; float attackValue = 1f; ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true).Add(new ExitBurrowStates.Def(), !is_baby).Add(new PlayAnimsStates.Def(GameTags.Creatures.Burrowed, true, "idle_mound", STRINGS.CREATURES.STATUSITEMS.BURROWED.NAME, STRINGS.CREATURES.STATUSITEMS.BURROWED.TOOLTIP), !is_baby).Add(new GrowUpStates.Def(), true).Add(new TrappedStates.Def(), true).Add(new IncubatingStates.Def(), true).Add(new BaggedStates.Def(), true).Add(new FallStates.Def(), true).Add(new StunnedStates.Def(), true).Add(new DrowningStates.Def(), true).Add(new DebugGoToStates.Def(), true).Add(new FleeStates.Def(), true).Add(new AttackStates.Def(), !is_baby).PushInterruptGroup().Add(new CreatureSleepStates.Def(), true).Add(new FixedCaptureStates.Def(), true).Add(new RanchedStates.Def(), true).Add(new PlayAnimsStates.Def(GameTags.Creatures.WantsToEnterBurrow, false, "hide", STRINGS.CREATURES.STATUSITEMS.BURROWING.NAME, STRINGS.CREATURES.STATUSITEMS.BURROWING.TOOLTIP), !is_baby).Add(new LayEggStates.Def(), true).Add(new EatStates.Def(), true).Add(new PlayAnimsStates.Def(GameTags.Creatures.Poop, false, "poop", STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.NAME, STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.TOOLTIP), true).Add(new CallAdultStates.Def(), true).PopInterruptGroup().Add(new IdleStates.Def(), true); string adultId = "HatchHard"; string eggId = "HatchHardBaby"; string eggName = "Stone Hatchling Egg"; string anim_egg = "egg_hatch_kanim"; float egg_mass = 2f; string dropOnMature = null; float fertility_cycles = 60f; float incubation_cycles = 20f; int egg_sortorder = 2; List <FertilityMonitor.BreedingChance> egg_chances = new List <FertilityMonitor.BreedingChance>(); egg_chances.Add(BreedingChance("HatchHardEgg", 1f)); bool is_ranchable = true; bool is_fish = false; float egg_scale = 1f; float calories_per_KG = 700000f / 140f; float min_poop_KG = 25; List <Diet.Info> diet_list = BaseHatchConfig.HardRockDiet(SimHashes.Carbon.CreateTag(), calories_per_KG, TUNING.CREATURES.CONVERSION_EFFICIENCY.NORMAL, null, 0f); // end of configurations // basic generation object obj = Activator.CreateInstance(typeof(HatchHardConfig)); KPrefabID obj_kPrefabID = (obj as HatchHardConfig).CreatePrefab().GetComponent <KPrefabID>(); obj_kPrefabID.prefabInitFn += (obj as HatchHardConfig).OnPrefabInit; obj_kPrefabID.prefabSpawnFn += (obj as HatchHardConfig).OnSpawn; Assets.AddPrefab(obj_kPrefabID); // advanced generation // critter = BaseHatchConfig.BaseHatch(id, name, desc, anim_file, traitId, is_baby, override_prefix); GameObject critter; critter = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, Assets.GetAnim(anim_file), "idle_loop", Grid.SceneLayer.Creatures, width, height, decor, default(EffectorValues), SimHashes.Creature, null, tempBorn); EntityTemplates.ExtendEntityToBasicCreature(critter, FactionManager.FactionID.Pest, traitId, navGridName, navi, 32, moveSpeed, dropOnDeath, dropCount, canDrown, canCrushed, tempLowWarning, tempHighWarning, tempLowDeath, tempHighDeath); if (override_prefix != null) { critter.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim(anim_file), override_prefix, null, 0); } critter.AddOrGet <Trappable>(); critter.AddOrGetDef <CreatureFallMonitor.Def>(); critter.AddOrGetDef <BurrowMonitor.Def>(); critter.AddOrGetDef <WorldSpawnableMonitor.Def>().adjustSpawnLocationCb = (int cell) => { return(cell); };//new Func<int, int>(BaseHatchConfig.AdjustSpawnLocationCB); critter.AddOrGetDef <ThreatMonitor.Def>().fleethresholdState = Health.HealthState.Dead; critter.AddWeapon(attackValue, attackValue, AttackProperties.DamageType.Standard, AttackProperties.TargetType.Single, 1, 0f); EntityTemplates.CreateAndRegisterBaggedCreature(critter, pickup_only_from_top, pickup_allow_mark, pickup_use_gun); KPrefabID prefabID = critter.GetComponent <KPrefabID>(); prefabID.AddTag(tag, false); prefabID.prefabInitFn += delegate(GameObject inst) { inst.GetAttributes().Add(Db.Get().Attributes.MaxUnderwaterTravelCost); }; EntityTemplates.AddCreatureBrain(critter, chore_table, species, override_prefix); EntityTemplates.ExtendEntityToWildCreature(critter, space_requirement, lifespan); Diet diet = new Diet(diet_list.ToArray()); CreatureCalorieMonitor.Def calorieMonitor = critter.AddOrGetDef <CreatureCalorieMonitor.Def>(); calorieMonitor.diet = diet; calorieMonitor.minPoopSizeInCalories = calories_per_KG * min_poop_KG; critter.AddOrGetDef <SolidConsumerMonitor.Def>().diet = diet; if (is_baby) { EntityTemplates.ExtendEntityToBeingABaby(critter, adultId, dropOnMature); } else { EntityTemplates.ExtendEntityToFertileCreature(critter, eggId, eggName, desc, anim_egg, egg_mass, eggId, fertility_cycles, incubation_cycles, egg_chances, egg_sortorder, is_ranchable, is_fish, true, egg_scale); } }
private static ChoreTable.Builder Inject(ChoreTable.Builder builder) { return(builder.Add(new RanchedStates.Def())); }
public GameObject CreatePrefab() { string name = (string)MurderBotConfig.NAME; string desc = (string)MurderBotConfig.DESCRIPTION; string id = (string)MurderBotConfig.ID; double mass = (double)SweepBotConfig.MASS; EffectorValues none = TUNING.BUILDINGS.DECOR.NONE; KAnimFile anim = Assets.GetAnim((HashedString)"sweep_bot_kanim"); EffectorValues decor = none; EffectorValues noise = new EffectorValues(); GameObject placedEntity = EntityTemplates.CreatePlacedEntity(id, name, desc, (float)mass, anim, "idle", Grid.SceneLayer.Creatures, 1, 1, decor, noise, SimHashes.Creature, (List <Tag>)null, 293f); placedEntity.AddOrGet <LoopingSounds>(); placedEntity.GetComponent <KBatchedAnimController>().isMovable = true; KPrefabID kprefabId = placedEntity.AddOrGet <KPrefabID>(); kprefabId.AddTag(GameTags.Creature, false); placedEntity.AddComponent <Pickupable>(); placedEntity.AddOrGet <Clearable>().isClearable = false; Trait trait = Db.Get().CreateTrait("MurderBotBaseTrait", name, name, (string)null, false, (ChoreGroup[])null, true, true); trait.Add(new AttributeModifier(Db.Get().Amounts.InternalBattery.maxAttribute.Id, 21000f, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.InternalBattery.deltaAttribute.Id, -40f, name, false, false, true)); Modifiers modifiers = placedEntity.AddOrGet <Modifiers>(); modifiers.initialTraits = new string[1] { "MurderBotBaseTrait" }; modifiers.initialAmounts.Add(Db.Get().Amounts.HitPoints.Id); modifiers.initialAmounts.Add(Db.Get().Amounts.InternalBattery.Id); placedEntity.AddOrGet <KBatchedAnimController>().SetSymbolVisiblity((KAnimHashedString)"snapto_pivot", false); placedEntity.AddOrGet <Traits>(); placedEntity.AddOrGet <CharacterOverlay>(); placedEntity.AddOrGet <Effects>(); placedEntity.AddOrGetDef <AnimInterruptMonitor.Def>(); placedEntity.AddOrGetDef <StorageUnloadMonitor.Def>(); placedEntity.AddOrGetDef <RobotBatteryMonitor.Def>(); placedEntity.AddOrGetDef <SweetBotReactMonitor.Def>(); placedEntity.AddOrGetDef <CreatureFallMonitor.Def>(); placedEntity.AddOrGetDef <SweepBotTrappedMonitor.Def>(); placedEntity.AddOrGet <AnimEventHandler>(); SymbolOverrideControllerUtil.AddToPrefab(placedEntity); placedEntity.AddOrGet <OrnamentReceptacle>().AddDepositTag(GameTags.PedestalDisplayable); placedEntity.AddOrGet <DecorProvider>(); placedEntity.AddOrGet <UserNameable>(); placedEntity.AddOrGet <CharacterOverlay>(); placedEntity.AddOrGet <ItemPedestal>(); Navigator navigator = placedEntity.AddOrGet <Navigator>(); navigator.NavGridName = "WalkerBabyNavGrid"; navigator.CurrentNavType = NavType.Floor; navigator.defaultSpeed = 1f; navigator.updateProber = true; navigator.maxProbingRadius = 32; navigator.sceneLayer = Grid.SceneLayer.Creatures; kprefabId.AddTag(GameTags.Creatures.Walker, false); ChoreTable.Builder chore_table = new ChoreTable.Builder().Add((StateMachine.BaseDef) new FallStates.Def(), true).Add((StateMachine.BaseDef) new AnimInterruptStates.Def(), true).Add((StateMachine.BaseDef) new SweepBotTrappedStates.Def(), true).Add((StateMachine.BaseDef) new ReturnToChargeStationStates.Def(), true).Add((StateMachine.BaseDef) new IdleStates.Def(), true); placedEntity.AddOrGet <LoopingSounds>(); EntityTemplates.AddCreatureBrain(placedEntity, chore_table, GameTags.Robots.Models.SweepBot, (string)null); return(placedEntity); }
/* * ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true) * <блаблабла> * .Add(new CallAdultStates.Def(), true) +++ .PushInterruptGroup() +++ .Add(new WheelRunningStates.Def(), true) +++ .PopInterruptGroup() +++.Add(new SeedPlantingStates.Def(), true) +++.PopInterruptGroup() +++.Add(new IdleStates.Def(), true); */ private static ChoreTable.Builder Inject(ChoreTable.Builder builder) { return(builder.PushInterruptGroup().Add(new WheelRunningStates.Def()).PopInterruptGroup()); }
public static GameObject BaseCrab(string id, string name, string desc, string anim_file, string traitId, bool is_baby, string symbolOverridePrefix = null, string onDeathDropID = "CrabShell") { float mass = 100f; KAnimFile anim = Assets.GetAnim(anim_file); int height = is_baby ? 1 : 2; EffectorValues tIER = DECOR.BONUS.TIER0; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, "idle_loop", Grid.SceneLayer.Creatures, 1, height, tIER, default(EffectorValues), SimHashes.Creature, null, 293f); string text = "WalkerNavGrid1x2"; if (is_baby) { text = "WalkerBabyNavGrid"; } GameObject template = gameObject; FactionManager.FactionID faction = FactionManager.FactionID.Pest; string navGridName = text; EntityTemplates.ExtendEntityToBasicCreature(template, faction, traitId, navGridName, NavType.Floor, 32, 2f, onDeathDropID, 1, false, false, 288.15f, 343.15f, 243.15f, 373.15f); if (symbolOverridePrefix != null) { gameObject.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim(anim_file), symbolOverridePrefix, null, 0); } gameObject.AddOrGet <Trappable>(); gameObject.AddOrGet <LoopingSounds>(); gameObject.AddOrGetDef <CreatureFallMonitor.Def>(); ThreatMonitor.Def def = gameObject.AddOrGetDef <ThreatMonitor.Def>(); def.fleethresholdState = Health.HealthState.Dead; gameObject.AddWeapon(2f, 3f, AttackProperties.DamageType.Standard, AttackProperties.TargetType.Single, 1, 0f); SoundEventVolumeCache.instance.AddVolume("hatch_kanim", "Hatch_voice_idle", NOISE_POLLUTION.CREATURES.TIER2); SoundEventVolumeCache.instance.AddVolume("FloorSoundEvent", "Hatch_footstep", NOISE_POLLUTION.CREATURES.TIER1); SoundEventVolumeCache.instance.AddVolume("hatch_kanim", "Hatch_land", NOISE_POLLUTION.CREATURES.TIER3); SoundEventVolumeCache.instance.AddVolume("hatch_kanim", "Hatch_chew", NOISE_POLLUTION.CREATURES.TIER3); SoundEventVolumeCache.instance.AddVolume("hatch_kanim", "Hatch_voice_hurt", NOISE_POLLUTION.CREATURES.TIER5); SoundEventVolumeCache.instance.AddVolume("hatch_kanim", "Hatch_voice_die", NOISE_POLLUTION.CREATURES.TIER5); SoundEventVolumeCache.instance.AddVolume("hatch_kanim", "Hatch_drill_emerge", NOISE_POLLUTION.CREATURES.TIER6); SoundEventVolumeCache.instance.AddVolume("hatch_kanim", "Hatch_drill_hide", NOISE_POLLUTION.CREATURES.TIER6); EntityTemplates.CreateAndRegisterBaggedCreature(gameObject, true, true, false); KPrefabID component = gameObject.GetComponent <KPrefabID>(); component.AddTag(GameTags.Creatures.Walker, false); component.AddTag(GameTags.Creatures.CrabFriend, false); ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true).Add(new GrowUpStates.Def(), true) .Add(new TrappedStates.Def(), true) .Add(new IncubatingStates.Def(), true) .Add(new BaggedStates.Def(), true) .Add(new FallStates.Def(), true) .Add(new StunnedStates.Def(), true) .Add(new DebugGoToStates.Def(), true) .Add(new FleeStates.Def(), true) .Add(new DefendStates.Def(), true) .Add(new AttackStates.Def(), true) .PushInterruptGroup() .Add(new CreatureSleepStates.Def(), true) .Add(new FixedCaptureStates.Def(), true) .Add(new RanchedStates.Def(), true) .Add(new LayEggStates.Def(), true) .Add(new EatStates.Def(), true) .Add(new PlayAnimsStates.Def(GameTags.Creatures.Poop, false, "poop", STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.NAME, STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.TOOLTIP), true) .Add(new CallAdultStates.Def(), true) .PopInterruptGroup() .Add(new IdleStates.Def(), true); EntityTemplates.AddCreatureBrain(gameObject, chore_table, GameTags.Creatures.Species.CrabSpecies, symbolOverridePrefix); gameObject.AddTag(GameTags.Amphibious); return(gameObject); }
private static GameObject GeneratePlacedEntity() { GameObject placedEntity = EntityTemplates.CreatePlacedEntity( id: Id, name: Name, desc: Description, mass: Mass, anim: Assets.GetAnim("living_crystal"), initialAnim: "idle_loop", sceneLayer: Grid.SceneLayer.Creatures, width: 1, height: 2, decor: TUNING.DECOR.BONUS.TIER3, noise: new EffectorValues(), element: SimHashes.Creature, additionalTags: null, defaultTemperature: DefaultTemperature); EntityTemplates.ExtendEntityToBasicCreature( template: placedEntity, faction: FactionManager.FactionID.Prey, initialTraitID: BaseTraitId, NavGridName: NavGridId, navType: NavType.Floor, max_probing_radius: 32, moveSpeed: 2f, onDeathDropID: Elements.AluminumSaltElement.Id, onDeathDropCount: 300, drownVulnerable: false, entombVulnerable: true, warningLowTemperature: WarningLowTemperature, warningHighTemperature: WarningHighTemperature, lethalLowTemperature: LethalLowTemperature, lethalHighTemperature: LethalHighTemperature); placedEntity.AddOrGet <Trappable>(); placedEntity.AddOrGetDef <CreatureFallMonitor.Def>(); WorldSpawnableMonitor.Def def = placedEntity.AddOrGetDef <WorldSpawnableMonitor.Def>(); placedEntity.AddOrGetDef <ThreatMonitor.Def>().fleethresholdState = Health.HealthState.Scuffed; placedEntity.AddOrGetDef <RanchableMonitor.Def>(); EntityTemplates.CreateAndRegisterBaggedCreature(placedEntity, true, true, false); KPrefabID component = placedEntity.GetComponent <KPrefabID>(); component.AddTag(GameTags.Creatures.Walker, false); ChoreTable.Builder chore_table = new ChoreTable.Builder() .Add(new DeathStates.Def(), true) .Add(new AnimInterruptStates.Def(), true) .Add(new TrappedStates.Def(), true) .Add(new BaggedStates.Def(), true) .Add(new FallStates.Def(), true) .Add(new StunnedStates.Def(), true) .Add(new DebugGoToStates.Def(), true) .Add(new FleeStates.Def(), true) .Add(new CreatureSleepStates.Def(), true).PushInterruptGroup() .Add(new FixedCaptureStates.Def(), true) .Add(new RanchedStates.Def(), true) .Add(new LayEggStates.Def(), true) .Add(new InhaleStates.Def(), true) .Add(new SameSpotPoopStates.Def(), true) .Add(new CallAdultStates.Def(), true).PopInterruptGroup() .Add(new IdleStates.Def(), true); EntityTemplates.AddCreatureBrain(placedEntity, chore_table, Id.ToTag(), null); return(placedEntity); }
public static GameObject BaseLightBug(string id, string name, string desc, string anim_file, string traitId, Color lightColor, EffectorValues decor, bool is_baby, string symbolOverridePrefix = null) { float mass = 5f; KAnimFile anim = Assets.GetAnim(anim_file); string initialAnim = "idle_loop"; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.Creatures, 1, 1, decor, default(EffectorValues), SimHashes.Creature, null, 293f); GameObject template = gameObject; FactionManager.FactionID faction = FactionManager.FactionID.Prey; string navGridName = "FlyerNavGrid1x1"; NavType navType = NavType.Hover; mass = 2f; string onDeathDropID = "Meat"; int onDeathDropCount = 0; float fREEZING_ = CREATURES.TEMPERATURE.FREEZING_1; float hOT_ = CREATURES.TEMPERATURE.HOT_1; EntityTemplates.ExtendEntityToBasicCreature(template, faction, traitId, navGridName, navType, 32, mass, onDeathDropID, onDeathDropCount, true, true, fREEZING_, hOT_, CREATURES.TEMPERATURE.FREEZING_2, CREATURES.TEMPERATURE.HOT_2); if (symbolOverridePrefix != null) { gameObject.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim(anim_file), symbolOverridePrefix, null, 0); } KPrefabID component = gameObject.GetComponent <KPrefabID>(); component.AddTag(GameTags.Creatures.Flyer, false); component.prefabInitFn += delegate(GameObject inst) { inst.GetAttributes().Add(Db.Get().Attributes.MaxUnderwaterTravelCost); }; gameObject.AddOrGet <LoopingSounds>(); LureableMonitor.Def def = gameObject.AddOrGetDef <LureableMonitor.Def>(); def.lures = new Tag[1] { GameTags.Phosphorite }; gameObject.AddOrGetDef <ThreatMonitor.Def>(); gameObject.AddOrGetDef <SubmergedMonitor.Def>(); EntityTemplates.CreateAndRegisterBaggedCreature(gameObject, true, false, false); if (is_baby) { KBatchedAnimController component2 = gameObject.GetComponent <KBatchedAnimController>(); component2.animWidth = 0.5f; component2.animHeight = 0.5f; } if (lightColor != Color.black) { Light2D light2D = gameObject.AddOrGet <Light2D>(); light2D.Color = lightColor; light2D.overlayColour = LIGHT2D.LIGHTBUG_OVERLAYCOLOR; light2D.Range = 5f; light2D.Angle = 0f; light2D.Direction = LIGHT2D.LIGHTBUG_DIRECTION; light2D.Offset = LIGHT2D.LIGHTBUG_OFFSET; light2D.shape = LightShape.Circle; light2D.drawOverlay = true; light2D.Lux = 1800; gameObject.AddOrGet <LightSymbolTracker>().targetSymbol = "snapTo_light_locator"; gameObject.AddOrGetDef <CreatureLightToggleController.Def>(); } ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true).Add(new GrowUpStates.Def(), true) .Add(new IncubatingStates.Def(), true) .Add(new BaggedStates.Def(), true) .Add(new StunnedStates.Def(), true) .Add(new DebugGoToStates.Def(), true) .Add(new DrowningStates.Def(), true) .PushInterruptGroup() .Add(new CreatureSleepStates.Def(), true) .Add(new FixedCaptureStates.Def(), true) .Add(new RanchedStates.Def(), true) .Add(new LayEggStates.Def(), true) .Add(new EatStates.Def(), true) .Add(new MoveToLureStates.Def(), true) .Add(new CallAdultStates.Def(), true) .PopInterruptGroup() .Add(new IdleStates.Def(), true); EntityTemplates.AddCreatureBrain(gameObject, chore_table, GameTags.Creatures.Species.LightBugSpecies, symbolOverridePrefix); return(gameObject); }
public static GameObject BaseHatch(string id, string name, string desc, string anim_file, string traitId, bool is_baby, string symbolOverridePrefix = null) { float mass = 100f; KAnimFile anim = Assets.GetAnim(anim_file); string initialAnim = "idle_loop"; EffectorValues tIER = DECOR.BONUS.TIER0; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.Creatures, 1, 1, tIER, default(EffectorValues), SimHashes.Creature, null, 293f); string navGridName = "WalkerNavGrid1x1"; if (is_baby) { navGridName = "WalkerBabyNavGrid"; } EntityTemplates.ExtendEntityToBasicCreature(gameObject, FactionManager.FactionID.Pest, traitId, navGridName, NavType.Floor, 32, 2f, "Meat", 2, true, false, 283.15f, 293.15f, 243.15f, 343.15f); if (symbolOverridePrefix != null) { gameObject.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim(anim_file), symbolOverridePrefix, null, 0); } gameObject.AddOrGet <Trappable>(); gameObject.AddOrGetDef <CreatureFallMonitor.Def>(); gameObject.AddOrGetDef <BurrowMonitor.Def>(); WorldSpawnableMonitor.Def def = gameObject.AddOrGetDef <WorldSpawnableMonitor.Def>(); def.adjustSpawnLocationCb = AdjustSpawnLocationCB; ThreatMonitor.Def def2 = gameObject.AddOrGetDef <ThreatMonitor.Def>(); def2.fleethresholdState = Health.HealthState.Dead; gameObject.AddWeapon(1f, 1f, AttackProperties.DamageType.Standard, AttackProperties.TargetType.Single, 1, 0f); SoundEventVolumeCache.instance.AddVolume("hatch_kanim", "Hatch_voice_idle", NOISE_POLLUTION.CREATURES.TIER2); SoundEventVolumeCache.instance.AddVolume("FloorSoundEvent", "Hatch_footstep", NOISE_POLLUTION.CREATURES.TIER1); SoundEventVolumeCache.instance.AddVolume("hatch_kanim", "Hatch_land", NOISE_POLLUTION.CREATURES.TIER3); SoundEventVolumeCache.instance.AddVolume("hatch_kanim", "Hatch_chew", NOISE_POLLUTION.CREATURES.TIER3); SoundEventVolumeCache.instance.AddVolume("hatch_kanim", "Hatch_voice_hurt", NOISE_POLLUTION.CREATURES.TIER5); SoundEventVolumeCache.instance.AddVolume("hatch_kanim", "Hatch_voice_die", NOISE_POLLUTION.CREATURES.TIER5); SoundEventVolumeCache.instance.AddVolume("hatch_kanim", "Hatch_drill_emerge", NOISE_POLLUTION.CREATURES.TIER6); SoundEventVolumeCache.instance.AddVolume("hatch_kanim", "Hatch_drill_hide", NOISE_POLLUTION.CREATURES.TIER6); EntityTemplates.CreateAndRegisterBaggedCreature(gameObject, true, true, false); KPrefabID component = gameObject.GetComponent <KPrefabID>(); component.AddTag(GameTags.Creatures.Walker, false); component.prefabInitFn += delegate(GameObject inst) { inst.GetAttributes().Add(Db.Get().Attributes.MaxUnderwaterTravelCost); }; bool condition = !is_baby; ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true).Add(new ExitBurrowStates.Def(), condition) .Add(new PlayAnimsStates.Def(GameTags.Creatures.Burrowed, true, "idle_mound", STRINGS.CREATURES.STATUSITEMS.BURROWED.NAME, STRINGS.CREATURES.STATUSITEMS.BURROWED.TOOLTIP), condition) .Add(new GrowUpStates.Def(), true) .Add(new TrappedStates.Def(), true) .Add(new IncubatingStates.Def(), true) .Add(new BaggedStates.Def(), true) .Add(new FallStates.Def(), true) .Add(new StunnedStates.Def(), true) .Add(new DrowningStates.Def(), true) .Add(new DebugGoToStates.Def(), true) .Add(new FleeStates.Def(), true) .Add(new AttackStates.Def(), condition) .PushInterruptGroup() .Add(new CreatureSleepStates.Def(), true) .Add(new FixedCaptureStates.Def(), true) .Add(new RanchedStates.Def(), true) .Add(new PlayAnimsStates.Def(GameTags.Creatures.WantsToEnterBurrow, false, "hide", STRINGS.CREATURES.STATUSITEMS.BURROWING.NAME, STRINGS.CREATURES.STATUSITEMS.BURROWING.TOOLTIP), condition) .Add(new LayEggStates.Def(), true) .Add(new EatStates.Def(), true) .Add(new PlayAnimsStates.Def(GameTags.Creatures.Poop, false, "poop", STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.NAME, STRINGS.CREATURES.STATUSITEMS.EXPELLING_SOLID.TOOLTIP), true) .Add(new CallAdultStates.Def(), true) .PopInterruptGroup() .Add(new IdleStates.Def(), true); EntityTemplates.AddCreatureBrain(gameObject, chore_table, GameTags.Creatures.Species.HatchSpecies, symbolOverridePrefix); return(gameObject); }
public static GameObject BasePuft(string id, string name, string desc, string traitId, string anim_file, bool is_baby, string symbol_override_prefix, float warningLowTemperature, float warningHighTemperature) { float mass = 50f; KAnimFile anim = Assets.GetAnim(anim_file); string initialAnim = "idle_loop"; EffectorValues tIER = DECOR.BONUS.TIER0; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.Creatures, 1, 1, tIER, default(EffectorValues), SimHashes.Creature, null, 293f); GameObject template = gameObject; FactionManager.FactionID faction = FactionManager.FactionID.Prey; string navGridName = "FlyerNavGrid1x1"; NavType navType = NavType.Hover; string onDeathDropID = "Meat"; int onDeathDropCount = 1; mass = warningLowTemperature - 45f; float lethalHighTemperature = warningHighTemperature + 50f; EntityTemplates.ExtendEntityToBasicCreature(template, faction, traitId, navGridName, navType, 32, 2f, onDeathDropID, onDeathDropCount, true, true, warningLowTemperature, warningHighTemperature, mass, lethalHighTemperature); if (!string.IsNullOrEmpty(symbol_override_prefix)) { gameObject.AddOrGet <SymbolOverrideController>().ApplySymbolOverridesByAffix(Assets.GetAnim(anim_file), symbol_override_prefix, null, 0); } KPrefabID component = gameObject.GetComponent <KPrefabID>(); component.AddTag(GameTags.Creatures.Flyer, false); component.prefabInitFn += delegate(GameObject inst) { inst.GetAttributes().Add(Db.Get().Attributes.MaxUnderwaterTravelCost); }; gameObject.AddOrGet <LoopingSounds>(); LureableMonitor.Def def = gameObject.AddOrGetDef <LureableMonitor.Def>(); def.lures = new Tag[1] { GameTags.SlimeMold }; gameObject.AddOrGetDef <ThreatMonitor.Def>(); gameObject.AddOrGetDef <SubmergedMonitor.Def>(); SoundEventVolumeCache.instance.AddVolume("puft_kanim", "Puft_voice_idle", NOISE_POLLUTION.CREATURES.TIER2); SoundEventVolumeCache.instance.AddVolume("puft_kanim", "Puft_air_intake", NOISE_POLLUTION.CREATURES.TIER4); SoundEventVolumeCache.instance.AddVolume("puft_kanim", "Puft_toot", NOISE_POLLUTION.CREATURES.TIER5); SoundEventVolumeCache.instance.AddVolume("puft_kanim", "Puft_air_inflated", NOISE_POLLUTION.CREATURES.TIER5); SoundEventVolumeCache.instance.AddVolume("puft_kanim", "Puft_voice_die", NOISE_POLLUTION.CREATURES.TIER5); SoundEventVolumeCache.instance.AddVolume("puft_kanim", "Puft_voice_hurt", NOISE_POLLUTION.CREATURES.TIER5); EntityTemplates.CreateAndRegisterBaggedCreature(gameObject, true, false, false); string inhaleSound = "Puft_air_intake"; if (is_baby) { inhaleSound = "PuftBaby_air_intake"; } ChoreTable.Builder chore_table = new ChoreTable.Builder().Add(new DeathStates.Def(), true).Add(new AnimInterruptStates.Def(), true).Add(new GrowUpStates.Def(), true) .Add(new IncubatingStates.Def(), true) .Add(new BaggedStates.Def(), true) .Add(new StunnedStates.Def(), true) .Add(new DebugGoToStates.Def(), true) .Add(new DrowningStates.Def(), true) .PushInterruptGroup() .Add(new CreatureSleepStates.Def(), true) .Add(new FixedCaptureStates.Def(), true) .Add(new RanchedStates.Def(), true) .Add(new UpTopPoopStates.Def(), true) .Add(new LayEggStates.Def(), true) .Add(new InhaleStates.Def { inhaleSound = inhaleSound }, true) .Add(new MoveToLureStates.Def(), true) .Add(new CallAdultStates.Def(), true) .PopInterruptGroup() .Add(new IdleStates.Def { customIdleAnim = new IdleStates.Def.IdleAnimCallback(BasePuftConfig.CustomIdleAnim) }, true); EntityTemplates.AddCreatureBrain(gameObject, chore_table, GameTags.Creatures.Species.PuftSpecies, symbol_override_prefix); return(gameObject); }