public static GameObject CreateLightBug(string id, string name, string desc, string anim_file, bool is_baby) { GameObject prefab = BaseLightBugConfig.BaseLightBug(id, name, desc, anim_file, "LightBugBlueBaseTrait", LIGHT2D.LIGHTBUG_COLOR_BLUE, DECOR.BONUS.TIER6, is_baby, "blu_"); EntityTemplates.ExtendEntityToWildCreature(prefab, LightBugTuning.PEN_SIZE_PER_CREATURE, 25f); Trait trait = Db.Get().CreateTrait("LightBugBlueBaseTrait", name, name, null, false, null, true, true); trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.maxAttribute.Id, LightBugTuning.STANDARD_STOMACH_SIZE, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, (0f - LightBugTuning.STANDARD_CALORIES_PER_CYCLE) / 600f, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.HitPoints.maxAttribute.Id, 5f, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.Age.maxAttribute.Id, 25f, name, false, false, true)); HashSet <Tag> hashSet = new HashSet <Tag>(); hashSet.Add(TagManager.Create("SpiceBread")); hashSet.Add(TagManager.Create("Salsa")); hashSet.Add(SimHashes.Phosphorite.CreateTag()); hashSet.Add(SimHashes.Phosphorus.CreateTag()); prefab = BaseLightBugConfig.SetupDiet(prefab, hashSet, Tag.Invalid, CALORIES_PER_KG_OF_ORE); LureableMonitor.Def def = prefab.AddOrGetDef <LureableMonitor.Def>(); def.lures = new Tag[2] { SimHashes.Phosphorite.CreateTag(), SimHashes.Phosphorus.CreateTag() }; return(prefab); }
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 GameObject CreatePuftBleachstone(string id, string name, string desc, string anim_file, bool is_baby) { GameObject prefab = BasePuftConfig.BasePuft(id, name, desc, "PuftBleachstoneBaseTrait", anim_file, is_baby, "anti_", 258.15f, 308.15f); prefab = EntityTemplates.ExtendEntityToWildCreature(prefab, PuftTuning.PEN_SIZE_PER_CREATURE, 75f); Trait trait = Db.Get().CreateTrait("PuftBleachstoneBaseTrait", name, name, null, false, null, true, true); trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.maxAttribute.Id, PuftTuning.STANDARD_STOMACH_SIZE, name, false, false, true)); trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, (0f - PuftTuning.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, 75f, name, false, false, true)); prefab = BasePuftConfig.SetupDiet(prefab, SimHashes.ChlorineGas.CreateTag(), SimHashes.BleachStone.CreateTag(), CALORIES_PER_KG_OF_ORE, TUNING.CREATURES.CONVERSION_EFFICIENCY.GOOD_2, null, 0f, MIN_POOP_SIZE_IN_KG); LureableMonitor.Def def = prefab.AddOrGetDef <LureableMonitor.Def>(); def.lures = new Tag[1] { SimHashes.BleachStone.CreateTag() }; return(prefab); }
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 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); }
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); }