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 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 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); }