Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(content): looks_like, trigger message with spells, and can alarm for trap #3939

Merged
merged 5 commits into from
Dec 18, 2023

Conversation

chaosvolt
Copy link
Member

@chaosvolt chaosvolt commented Dec 17, 2023

Purpose of change

Some ideas that came up in the vein of making trapping less hassle to grind and for bonus points add more options using it. Led to a fix or two along the way.

WIP because I need this PR's number to finish the external_tileset.md update and because I might add more traps to this.

Describe the solution

C++ changes:

  1. In trapfunc.cpp, changed trapfunc::cast_spell so that it prints a message when a trap is triggered by a player or NPC, as it doesn't print the spell's noise message when triggered by the player so the player really oughta have some warning.
  2. In the same function, set it so that the spellcasting trap effect doesn't make a predefined sound volume and instead triesd to get the spell volume.
  3. In cata_tiles.cpp, added support for looks_like for traps to cata_tiles::find_tile_looks_like.
  4. In trap.cpp and trap.h, added the relevant support for looks_like as used in other areas of the code.

JSON changes:

  1. Added a makeshift perimeter alarm item, basically a tripwire converted into a noisemaker using empty cans.
  2. Added trap definition for the above. Currently set to 2 levels easier to spot than tripwires (shiny cans :3) but 2 levels harder to avoid and disarm (idea being the hard part is not bumping into or otherwise rattling the cans in the process). Functions as a spellcasting trap since is a way to get some extra functions done without having to rely on
  3. Defined spell data for the can alarm trap effect. Uses a fake target_attack with the actual effect, a noisemaker spell, as the secondary effect. Volume set to 25.
  4. Added recipe for makeshift perimeter alarm. Takes a tripwire and adds some tin or alumimum cans, as well as pebbles/marbles/etc to add to the delicious rattling. One level higher than tripwire, and some survival skill needed given its common use innawoods as a bear alarm.
  5. Per feedback, changed superglue required for tripwire recipe to allow the adhesive crafting quality in general, and added nails as an alternative.
  6. Set it so a tripwire yields itself when disarmed, instead of being able to convert makeshift cordage into long string. This makes them reusable, which may feel odd if you use glue instead of nails, but makes it less clunky for gameplay. Honestly we could rely on the assumption that you could just be tying this down instead of gluing it in place if we want to fix that issue.
  7. Per suggestions, set it so that recipes involving a tripwire in their description use a tripwire instead of just raw cordage, with the idea being this allows you to build on your crafting and re-use already-crafted tripwires in other traps, instead of being primarily used for craft-grinding.
  8. Added sprite for new trap to external tileset.
  9. Added looks_like pointing to tripwires for can alarms and booby traps.

Doc changes:

  1. Documented new trap in external tileset documentation.
  2. Misc: Fixed documentation of feat (interface): new UDP external tileset sprite for signs #3670 saying the new sign sprite was in the wrong file.

Describe alternatives you've considered

Screaming and JSONizing trapfuncs. The latter will involve much of the former.

Testing

  1. Checked affected files for syntax and lint errors.
  2. Compiled and load-tested.
  3. Confirmed that stepping onto a can alarm trap triggers the intended message and correct level of sound.
  4. Confirmed UDP sprite shows as intended.
  5. Spawned in tripwire, can alarm, and booby trap. Confirmed they still all use the correct sprites in UDP.
  6. Set tileset to Ultica, confirmed the latter two no longer show as just a plain ^.
    image

Additional context

I'd REALLY like to figure out how to fix spellcasting traps needing a minimum AoE defined along with some of the other janky horseshit going on under the hood there, as then we could have basic shit like single-tile damaging spell traps for things like deadfalls or spear traps, without having to fuck about with either new trap funcs, struggling with JSONizing this crap, and/or limiting spellcasting traps to stuff where it being an AoE makes perfect sense.

I checked to see if DDA's version of Ultica (as of build 2023-11-21-0110) has more of its traps sprited or not, seems to not be the case, as booby traps are still using a fallback sprite. So tripwire sprite (which made it into our version of Ultica) is about to start getting some more use:
image

Checklist

@github-actions github-actions bot added docs PRs releated to docs page src PR changes related to source code. data PRs related to datas. Won't crash game (probably) labels Dec 17, 2023
Copy link
Contributor

autofix-ci bot commented Dec 17, 2023

The Autofix app has automatically formatted this Pull Request.

If you edit your PR on web UI, you can ignore this message.
If you edit your PR locally, YOU MUST DO EITHER OF THE FOLLOWING:

  • Run git pull to merge the automated commit into your local copy of the PR branch.
  • Format your code locally, and force push to your PR branch.

If you don't do this, your following work will be based on the old commit, and cause MERGE CONFLICT.

@chaosvolt chaosvolt changed the title feat(content): expand trap options, some related code fixes feat(content): expand trap options, some related code fixes, looks_like support Dec 17, 2023
…ileset.md

Co-authored-by: scarf <greenscarf005@gmail.com>
@chaosvolt chaosvolt marked this pull request as ready for review December 17, 2023 22:41
@scarf005 scarf005 self-requested a review December 17, 2023 22:44
@scarf005 scarf005 self-assigned this Dec 17, 2023
@chaosvolt
Copy link
Member Author

Side note, can alarms don't drop anything when triggered. I think for my next followup PR, instead of going straight to adding more traps, I'm gonna focus on JSONizing what drops when a trap is triggered.

@scarf005 scarf005 changed the title feat(content): expand trap options, some related code fixes, looks_like support feat(content): looks_like, trigger message with spells, and can alarm for trap Dec 18, 2023
Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noise generation

image
image
image
image

both zombie and player could trigger trap and cause noise.

Looks-like

Without sprite for tr_can_alarm

image

correctly fallbacks to tr_tripwire.

With sprite for tr_can_alarm

image

@scarf005 scarf005 merged commit 7d54e3e into cataclysmbnteam:main Dec 18, 2023
17 checks passed
@chaosvolt chaosvolt deleted the traps-go-nyoom branch December 18, 2023 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data PRs related to datas. Won't crash game (probably) docs PRs releated to docs page src PR changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants