Flexible Entity Releaser - KonradHeinser/EBSGFramework GitHub Wiki

This building class allows you to create traps similar to the Wasp Trap in Odyssey that spawn some enemies when enemies get too close or the trap is destroyed. In addition to the special thingClass, the EBSG Extension is required for setting up the details of the spawns:

        <thingClass>EBSGFramework.Building_FlexibleTrapReleaseEntity</thingClass>
        <modExtensions>
            <li Class="EBSGFramework.EBSGExtension">
            </li>
        </modExtensions>

These are the options available in the extension:

  • pawnKind : The PawnKindDef to spawn
  • countRange : Default (1) : A range of numbers (or a singular one) that determines how many of the pawnKind to spawn
  • sound : The SoundDef to play when spawning the pawns
  • message : An optional message to give. Within the message you can use {0} to reference the trap's label with capitalized letters, {1} for the label, {2} for the shortest version of the label available, and {3} for the number of pawnKinds that are being spawned
  • bioAge : Default (0) : A range of ages to pick from. All of the spawned pawns will have the same age. For some pawn kinds, this won't be relevant
  • chronoAge : Default (0) : A range of chronological ages to pick from. This generally doesn't have an actual effect in game beyond whatever the game says is their "true" age. All of the pawns spawned will have the same chronological age
  • mentalState : A MentalStateDef to give all of the pawns when spawned. For some pawns, this won't be relevant (i.e. wasps), but for others it will be required for them to actually ambush the pawn that triggers the trap

This example creates a pale version of a spike trap that spawns 3-5 angry bears when enemies get too close or the trap is destroyed. Because bears don't normally attack every enemy near them immediately after spawning, they need to be given the manhunter mind state:

    <ThingDef ParentName="BuildingBase">
        <defName>EBSG_BearTrap</defName>
        <label>bear trap</label>
        <description>It looks like a standard spike trap, but something feels off.</description>
        <thingClass>EBSGFramework.Building_FlexibleTrapReleaseEntity</thingClass>
        <graphicData>
        <texPath>Things/Building/Security/TrapSpikeArmed</texPath>
        <graphicClass>Graphic_Single</graphicClass>
        <damageData>
            <rect>(0,0,1,0.15)</rect>
        </damageData>
        </graphicData>
        <altitudeLayer>Building</altitudeLayer>
        <rotatable>false</rotatable>
        <tickerType>Normal</tickerType>
        <stealable>false</stealable>
        <minifiedDef>MinifiedThing</minifiedDef>
        <uiOrder>30</uiOrder>
        <thingCategories>
            <li>BuildingsSecurity</li>
        </thingCategories>
        <statBases>
            <Mass>2.5</Mass>
            <MaxHitPoints>40</MaxHitPoints>
            <WorkToBuild>3200</WorkToBuild>
            <Flammability>1</Flammability>
            <Beauty>-18</Beauty>
            <Cleanliness>-5</Cleanliness>
            <TrapMeleeDamage>100</TrapMeleeDamage>
            <TrapSpringChance>1.0</TrapSpringChance>
        </statBases>
        <building>
            <isTrap>true</isTrap>
            <trapDestroyOnSpring>true</trapDestroyOnSpring>
            <trapDamageCategory>Sharp</trapDamageCategory>
            <expandHomeArea>false</expandHomeArea>
            <ai_chillDestination>false</ai_chillDestination>
        </building>
        <placeWorkers>
            <li>PlaceWorker_NeverAdjacentTrap</li>
        </placeWorkers>
        <modExtensions>
            <li Class="EBSGFramework.EBSGExtension">
                <countRange>3~5</countRange>
                <pawnKind>Bear_Grizzly</pawnKind>
                <sound>Pawn_Bear_Angry</sound>
                <message>The {1} has released {3} bears!</message>
                <mentalState>Manhunter</mentalState>
                <bioAge>5</bioAge>
            </li>
        </modExtensions>
    </ThingDef>
⚠️ **GitHub.com Fallback** ⚠️