There is this token, [RETRACT_INTO_BP], that allows a creature to retract into a body part when threatened. This token is currently used by various animals*, allowing them to retract into their shells and upper bodies respectively (the latter is flavored as them rolling up in a ball). However, it is also oddly lacking from others.
Snails and desert tortoises both retract into their shells when they feel threatened in real life, yet they can't in Dwarf Fortress, something that has struck me as very odd.
This seems like an obvious oversight that could be fixed by replacing lines 1559-1561 of creature_bug_slug_new.txt:
[MUNDANE]
[APPLY_CREATURE_VARIATION:STANDARD_WALK_CRAWL_GAITS:9000:8900:8825:8775:9500:9900] 1 kph
[APPLY_CREATURE_VARIATION:STANDARD_CRAWLING_GAITS:9000:8900:8825:8775:9500:9900] 1 kph
with:
[MUNDANE]
[RETRACT_INTO_BP:BY_CATEGORY:SHELL:retract into <pro_pos> shell:retracts into <pro_pos> shell:come out of <pro_pos> shell:comes out of <pro_pos> shell]
[APPLY_CREATURE_VARIATION:STANDARD_WALK_CRAWL_GAITS:9000:8900:8825:8775:9500:9900] 1 kph
[APPLY_CREATURE_VARIATION:STANDARD_CRAWLING_GAITS:9000:8900:8825:8775:9500:9900] 1 kph
and lines 180-183 of creature_desert_new.txt:
[HAS_NERVES]
[APPLY_CREATURE_VARIATION:STANDARD_WALK_CRAWL_GAITS:9000:8900:8825:8775:9500:9900] 1 kph
[APPLY_CREATURE_VARIATION:STANDARD_CRAWLING_GAITS:9000:8900:8825:8775:9500:9900] 1 kph
[APPLY_CREATURE_VARIATION:STANDARD_SWIMMING_GAITS:9000:8900:8825:8775:9500:9900] 1 kph
with:
[HAS_NERVES]
[RETRACT_INTO_BP:BY_CATEGORY:SHELL:retract into <pro_pos> shell:retracts into <pro_pos> shell:come out of <pro_pos> shell:comes out of <pro_pos> shell]
[APPLY_CREATURE_VARIATION:STANDARD_WALK_CRAWL_GAITS:9000:8900:8825:8775:9500:9900] 1 kph
[APPLY_CREATURE_VARIATION:STANDARD_CRAWLING_GAITS:9000:8900:8825:8775:9500:9900] 1 kph
[APPLY_CREATURE_VARIATION:STANDARD_SWIMMING_GAITS:9000:8900:8825:8775:9500:9900] 1 kph
**
*Giant tortoise, armadillo, pond turtle, hedgehog, echidna, and pangolin
**Of course, the tokens could be placed at other locations in the creature's raws, but these were chosen as an example based on where it is in the giant tortoise raws.