Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Allow snails and tortoises to retract into their shells  (Read 1292 times)

voliol

  • Bay Watcher
    • View Profile
    • Website
Allow snails and tortoises to retract into their shells
« on: September 29, 2021, 04:00:46 pm »

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:
Code: [Select]
[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:
Code: [Select]
[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:
Code: [Select]
[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:
Code: [Select]
[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.

A_Curious_Cat

  • Bay Watcher
    • View Profile
Re: Allow snails and tortoises to retract into their shells
« Reply #1 on: September 29, 2021, 04:54:08 pm »

I hope the animal retracting into and out of it’s shell doesn’t generate combat messages like when a pangolin rolls and unrolls.  That really fills the combat log with so much spam that I often end up ignoring combat announcements until it’s too late.
Logged
Really hoping somebody puts this in their signature.

IndigoFenix

  • Bay Watcher
  • All things die, but nothing dies forever.
    • View Profile
    • Boundworlds: A Browser-Based Multiverse Creation and Exploration Game
Re: Allow snails and tortoises to retract into their shells
« Reply #2 on: October 06, 2021, 01:05:59 am »

The [RETRACTS_INTO_BP] ability is very rudimentary - it essentially dematerializes all body parts except the one being retracted into, and all internal organs inside it.  For creatures like hedgehogs that retract into their BODY_UPPER, this is functional, if not perfect; it is impossible to break their limbs or skull since these become non-corporeal, but piercing their skin can still kill them by bleeding or injuring their heart and lungs.

However, since the SHELL body part has no vital organs or blood vessels, [RETRACTS_INTO_BP:SHELL] makes the creature nigh-unkillable.  Even completely smashing the shell does not force the creature to pop out, so you can just hit them forever.  The [RETRACTS_INTO_BP] code must be reworked before snails and tortoises can retract properly.

I did create tortoises that could retract into their shells for my Mario mod, but I had to create a new body plan to do it.  Instead of having a separate shell body part, their upper body has a shell tissue layer, and they retract into their upper body.  This functions like the hedgehog's curl-up ability except that the shell layer must be penetrated to damage their vitals.

DwarfStar

  • Bay Watcher
    • View Profile
Re: Allow snails and tortoises to retract into their shells
« Reply #3 on: October 07, 2021, 12:43:38 pm »

Honestly your fix sounds better to me than changing how the tag works. Not only does your body plan make more sense, but it’s probably cheaper/safer to handle a problem via changing the raws vs. a change in the code.
Logged