-
Notifications
You must be signed in to change notification settings - Fork 37
Swallow Whole
Swallow Whole is a comp that allowws an animal to swallow any pawn in a single attack, "storing" it in its stomach. If the animal is killed, it will drop the pawns it has stored inside, albeit damaged. If it fills its stomach and a digestion time passes, everything inside it will die and the pawns will be dropped as skeletons.
To make this code work you'll need to add three things. First of all, the animal needs to have a thingClass tag:
<thingClass>AnimalBehaviours.Pawn_SwallowWhole</thingClass>
Secondly, you'll need a custom damage for the animal, and remember that you'll need a Maneuvers and a ToolCapacityDef too to link them to the creature's attacks. Alpha Animals example:
<DamageDef>
<defName>AA_SwallowWhole</defName>
<label>swallow whole</label>
<workerClass>AnimalBehaviours.DamageWorker_SwallowWhole</workerClass>
<externalViolence>true</externalViolence>
<deathMessage>{0} has been bitten to death.</deathMessage>
<hediff>Stab</hediff>
<hediffSolid>Crack</hediffSolid>
<harmAllLayersUntilOutside>true</harmAllLayersUntilOutside>
<impactSoundType>Slice</impactSoundType>
<armorCategory>Sharp</armorCategory>
</DamageDef>
Finally, you'll need to add the comp itself to the animal. A lot of configuration options:
//A comp class that provides parameters for Pawn_SwallowWhole and DamageWorker_SwallowWhole
//The total amount of prey it can hold inside
public int stomachCapacity = 5;
//Animals above this max body size won't be swallowed whole
public float maximumBodysize = 30;
//Amount of nutrition the animal will gain by swallowing prey (5 is basically all filled)
public int nutritionGained = 5;
//DefName of a Sound played when eating. If null, no sound will play
public string soundPlayedWhenEating = null;
//Send a letter when the animal devours a colony-owned pawn
public bool sendLetterWhenEating = false;
public string letterLabel = "";
public string letterText = "";
//Digestion time in rare ticks
public int digestionPeriod = 240; // 1 day
//Create filth around it if killed or otherwise destroyed
public bool createFilthWhenKilled = false;
public ThingDef filthToMake = ThingDefOf.Filth_AmnioticFluid;
//Play sound if killed or otherwise destroyed
public bool playSoundWhenKilled = false;
public string soundToPlay = "Hive_Spawn";
Besides from all the things mentioned above, to add the comp itself:
<comps>
<li Class="AnimalBehaviours.CompProperties_SwallowWhole">
Whatever configuration tags you want here
</li>
</comps>
- QuestNode_GetFaction
- Expandable projectiles
- Faction Def Extension
- Toggable patches
- Recipes Inheritance
- Adding new backstories
- Spawning things on new generated maps
- ThoughtExtensions
- WeatherLetterExtensions
- WeatherOverlayExtension
- WeatherEffectsExtension
- ThingDefExtension
- Stuff commonality extension
- Biome extension
- PipeSystem basics
- Resource
- Resource storage
- Resource processor
- Resource to thing
- Resource to power
- Thing to resource
- Resource trader
- Refill building with pipes
- Pipe valve
- Update to KCSG 2.0
- Exporting buildings
- Customizing symbols
- Debug helpers options
- Custom faction settlement
- Custom structure and scenarios
- Custom structure in quests
- Custom structure in WorldObjects
- Biome based structures
- Spawning world object(s) at world generation
- Prevent settlement spawning for nomadic factions
- Animal Behaviours Basics
-
Animal Behaviours Comp Classes
- Acid Attacks and Acid Immunity
- Animal Resources
- Animal Resources On Caravan
- Apply Hediff When Bound
- Asexual Reproduction
- Auto Nutrition
- Blink
- Build Periodically
- Cause Incident
- Change Def if Not Unique
- Change Weather
- Corpse Decayer
- Destroy This Item
- Die After Period
- Die And Change Into Another Def
- Dig Periodically
- Dig When Hungry
- Disease Event Immunity
- Disease Immunity
- Diseases After Period
- Doesn't flee
- Draftability
- Drop on Death
- Eat Weird Food
- Electrified
- Enrage Other Pawns
- Exploding Hatcher
- Extreme Xenophobia
- Fertilizer
- Filth Producer
- Fixed Gender
- Floating
- Gas Producer
- Give Thoughts On Caravan
- Graphic by Style
- Graphic by Terrain
- Hediff Effecter
- Hediff When Fleeing
- Highly Flammable
- Infecter
- Initial Ability
- Initial Hediff
- Initial Mental State
- Last Stand
- Light Sustenance
- Metamorphosis
- Mind Effecter
- Nearby Effecter
- No Taming Decay
- Passive Regenerator
- Pawn Overlay
- Produces no filth
- Refueling
- Regeneration
- State After Health Loss
- Summon On Spawn
- Swallow Whole
- Thought Effecter
- Untameable
- Animal Behaviours Hediff Comp Classes
- Animal Behaviours Damage Workers
- Animal Behaviours Def Extensions
- Animal Behaviours Extra Defs
- Animal Behaviours Misc