public GameObject CreatePrefab() { string id = "ShockWorm"; string name = STRINGS.CREATURES.SPECIES.SHOCKWORM.NAME; string desc = STRINGS.CREATURES.SPECIES.SHOCKWORM.DESC; float mass = 50f; KAnimFile anim = Assets.GetAnim("shockworm_kanim"); string initialAnim = "idle"; EffectorValues tIER = DECOR.BONUS.TIER0; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.Creatures, 1, 2, tIER, default(EffectorValues), SimHashes.Creature, null, 293f); GameObject template = gameObject; FactionManager.FactionID faction = FactionManager.FactionID.Hostile; initialAnim = null; desc = "FlyerNavGrid1x2"; NavType navType = NavType.Hover; mass = 2f; name = "Meat"; int onDeathDropCount = 3; float fREEZING_ = TUNING.CREATURES.TEMPERATURE.FREEZING_1; float hOT_ = TUNING.CREATURES.TEMPERATURE.HOT_1; EntityTemplates.ExtendEntityToBasicCreature(template, faction, initialAnim, desc, navType, 32, mass, name, onDeathDropCount, true, true, fREEZING_, hOT_, TUNING.CREATURES.TEMPERATURE.FREEZING_2, TUNING.CREATURES.TEMPERATURE.HOT_2); gameObject.AddOrGet <LoopingSounds>(); Weapon weapon = gameObject.AddWeapon(3f, 6f, AttackProperties.DamageType.Standard, AttackProperties.TargetType.AreaOfEffect, 10, 4f); weapon.AddEffect("WasAttacked", 1f); SoundEventVolumeCache.instance.AddVolume("shockworm_kanim", "Shockworm_attack_arc", NOISE_POLLUTION.CREATURES.TIER6); return(gameObject); }
private void ConfigureAlignments(FactionManager.FactionID faction) { switch (faction) { case FactionManager.FactionID.Duplicant: Dispositions.Add(FactionManager.FactionID.Duplicant, FactionManager.Disposition.Assist); Dispositions.Add(FactionManager.FactionID.Friendly, FactionManager.Disposition.Assist); Dispositions.Add(FactionManager.FactionID.Hostile, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Predator, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Prey, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Pest, FactionManager.Disposition.Neutral); break; case FactionManager.FactionID.Friendly: Dispositions.Add(FactionManager.FactionID.Duplicant, FactionManager.Disposition.Assist); Dispositions.Add(FactionManager.FactionID.Friendly, FactionManager.Disposition.Assist); Dispositions.Add(FactionManager.FactionID.Hostile, FactionManager.Disposition.Attack); Dispositions.Add(FactionManager.FactionID.Predator, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Prey, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Pest, FactionManager.Disposition.Neutral); break; case FactionManager.FactionID.Hostile: Dispositions.Add(FactionManager.FactionID.Duplicant, FactionManager.Disposition.Attack); Dispositions.Add(FactionManager.FactionID.Friendly, FactionManager.Disposition.Attack); Dispositions.Add(FactionManager.FactionID.Hostile, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Predator, FactionManager.Disposition.Attack); Dispositions.Add(FactionManager.FactionID.Prey, FactionManager.Disposition.Attack); Dispositions.Add(FactionManager.FactionID.Pest, FactionManager.Disposition.Attack); break; case FactionManager.FactionID.Predator: Dispositions.Add(FactionManager.FactionID.Duplicant, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Friendly, FactionManager.Disposition.Attack); Dispositions.Add(FactionManager.FactionID.Hostile, FactionManager.Disposition.Attack); Dispositions.Add(FactionManager.FactionID.Predator, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Prey, FactionManager.Disposition.Attack); Dispositions.Add(FactionManager.FactionID.Pest, FactionManager.Disposition.Attack); break; case FactionManager.FactionID.Prey: Dispositions.Add(FactionManager.FactionID.Duplicant, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Friendly, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Hostile, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Predator, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Prey, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Pest, FactionManager.Disposition.Neutral); break; case FactionManager.FactionID.Pest: Dispositions.Add(FactionManager.FactionID.Duplicant, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Friendly, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Hostile, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Predator, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Prey, FactionManager.Disposition.Neutral); Dispositions.Add(FactionManager.FactionID.Pest, FactionManager.Disposition.Neutral); break; } }
public static GameObject ExtendEntityToBasicCreature(GameObject template, FactionManager.FactionID faction = FactionManager.FactionID.Prey, string initialTraitID = null, string NavGridName = "WalkerNavGrid1x1", NavType navType = NavType.Floor, int max_probing_radius = 32, float moveSpeed = 2f, string onDeathDropID = "Meat", int onDeathDropCount = 1, bool drownVulnerable = true, bool entombVulnerable = true, float warningLowTemperature = 283.15f, float warningHighTemperature = 293.15f, float lethalLowTemperature = 243.15f, float lethalHighTemperature = 343.15f) { template.GetComponent <KBatchedAnimController>().isMovable = true; KPrefabID kPrefabID = template.AddOrGet <KPrefabID>(); kPrefabID.AddTag(GameTags.Creature, false); Modifiers modifiers = template.AddOrGet <Modifiers>(); if (initialTraitID != null) { modifiers.initialTraits = new string[1] { initialTraitID }; } modifiers.initialAmounts.Add(Db.Get().Amounts.HitPoints.Id); template.AddOrGet <KBatchedAnimController>().SetSymbolVisiblity("snapto_pivot", false); template.AddOrGet <Pickupable>(); template.AddOrGet <Clearable>().isClearable = false; template.AddOrGet <Traits>(); template.AddOrGet <Health>(); template.AddOrGet <CharacterOverlay>(); template.AddOrGet <RangedAttackable>(); template.AddOrGet <FactionAlignment>().Alignment = faction; template.AddOrGet <Prioritizable>(); template.AddOrGet <Effects>(); template.AddOrGetDef <CreatureDebugGoToMonitor.Def>(); template.AddOrGetDef <DeathMonitor.Def>(); template.AddOrGetDef <AnimInterruptMonitor.Def>(); SymbolOverrideControllerUtil.AddToPrefab(template); template.AddOrGet <TemperatureVulnerable>().Configure(warningLowTemperature, lethalLowTemperature, warningHighTemperature, lethalHighTemperature); if (drownVulnerable) { template.AddOrGet <DrowningMonitor>(); } if (entombVulnerable) { template.AddOrGet <EntombVulnerable>(); } if (onDeathDropCount > 0 && onDeathDropID != string.Empty) { string[] array = new string[onDeathDropCount]; for (int i = 0; i < array.Length; i++) { array[i] = onDeathDropID; } template.AddOrGet <Butcherable>().SetDrops(array); } Navigator navigator = template.AddOrGet <Navigator>(); navigator.NavGridName = NavGridName; navigator.CurrentNavType = navType; navigator.defaultSpeed = moveSpeed; navigator.updateProber = true; navigator.maxProbingRadius = max_probing_radius; navigator.sceneLayer = Grid.SceneLayer.Creatures; return(template); }
static void Postfix(ref GameObject __result, GameObject template, FactionManager.FactionID faction, string initialTraitID, string NavGridName, NavType navType, int max_probing_radius, float moveSpeed, string onDeathDropID, int onDeathDropCount, bool drownVulnerable, bool entombVulnerable, float warningLowTemperature, float warningHighTemperature, float lethalLowTemperature, float lethalHighTemperature) { __result.AddOrGet <Components.CritterTraits>(); }
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); }
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); }
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); }
public void SwitchAlignment(FactionManager.FactionID newAlignment) { SetAlignmentActive(false); Alignment = newAlignment; SetAlignmentActive(true); }
public Faction(FactionManager.FactionID faction) { ID = faction; ConfigureAlignments(faction); }