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(UI): move remaining deactivate and manhack functions to pet menus, sanity-check docile behavior, rework pheromone function into generic monster culling #4247

Merged
merged 8 commits into from
Mar 2, 2024

Conversation

chaosvolt
Copy link
Member

@chaosvolt chaosvolt commented Feb 22, 2024

Purpose of change

This finishes up some cleanup of the pet and friend menus, to allow taking down friendly monsters and the special manhack behavior to not be separate queries entirely. Along the way this turned into some cleanup and sanity-checking of paybot behavior as well as the rarely-used docile/passive state.

Also comes with being able to cull livestock like you can zombie zlaves, reworking that option to be more broadly usable.

Describe the solution

C++ changes:

  1. In character.cpp, changed Character::attitude_to so characters treat passive creatures as friends, since this state can only be entered by friendly monsters.
  2. Removed game::disable_robot from game.cpp and game.h as it's now redundant, along with the call to it in game::examine.
  3. In monattack.cpp, fixed up mattack::check_money_left to fix it checking the wrong effects. Now pay-bots correctly clear the pet effect and revert to normal when time runs out, instead of checking for an effect that's set to be permanent.
  4. In monexamine.cpp, added commands to monexamine::pet_menu for changing orders and deactivating monsters. The former is a new option, also added to monexamine::pet_menu, that toggles adding/removing the docile effect to the monster if they have the CAN_BE_ORDERED monster flag. This effectively JSONizes the effect manhacks had allowing you to toggle their aggression.
  5. Also in monexamine.cpp, checks for deactivation now exclude paybots since their entire shtick is only counting as pets when paid.
  6. And lastly in monexamine.cpp, reworked monexamine::kill_zslave to be reflavored as a generic slaughter mechanic. Can now be used on pets in the wildlife category as well as zombie zlaves, requires a source of butchering quality (1 or higher, so negative quality like with sharp rocks won't suffice), and no longer involves ripping a pheromone ball out with your bare hands. Option now replaces attack when available, and moved it to the bottom to be consistent
  7. In monmove.cpp, reworked out docile monster behavior is handled in monster::plan, with it forcing them to clear their target and no longer returning. Also moved it to just above friendly monster following behavior, after all target math is finished, so that a monster that was set to passive mid-fight will switch focus to following the player.
  8. In monster.cpp, set the switch/case stuff in monster::attitude_to so passive monsters still regard themselves as friendly towards the player instead of neutral.
  9. Defined the new monster flag in monstergenerator.cpp and mtype.h.

JSON changes:

  1. Added the new CAN_BE_ORDERED flag to the drone template all hacks inherit from.

Doc changes:

  1. Documented new monster flag in json_flags.md.

Describe alternatives you've considered

  1. Adding a more complex command system allowing NPC rules similar to what NPCs have, and bundling it into a command submenu of some sort instead of just a plain toggle.
  2. Adding the ability to yell command changes at relevant monsters in the C menu.
  3. Making the tool quality needed to slaughter animals cutting or fine cutting instead of positive butchering quality. Cutting quality would permit weird options like scissors, however.

Testing

  1. Checked affected JSON file for syntax and lint errors.
  2. Compiled and load-tested.
  3. Spawned in and interacted with a grocery bot, confiming the pay functions all work as expected and I can no longer deactivate them while paid for.
  4. Spawned in a friendly manhack, confirmed the deactivation and command functions are correctly in the friendly menu and not prompts.
  5. Set manhack to docile, confirmed I can now get the friendly menu to still come up, and that it now prefers to properly follow me instead of sitting around doing nothing, and cancels its attack run if I set it to docile while it's advancing on an enemy.
  6. Set it back to engage targets, confirmed it switches from passive back to friendly and goes mental on a debug monster.
  7. Set myself up with a friendly mininuke hack, confirmed I can set it to passive and it won't commit snackbar even if a monster wanders next to it.
  8. Spawned in and befriended a cow, picked the slaughter option with a butcher's knife in inventory, confirmed it works and doesn't damage the corpse.
  9. Repeated this with a newly-made zombie zlave, confirmed the option appears and works the same.
  10. Yote my tools and replaced it with a sharp rock, confirmed the attack option replaces slaughter.
  11. Checked affected C++ files for astyle.

image
image

Additional context

DDA implemented culling livestock a while back but dunno what PR that was, I just kinda implemented an adaptation of the existing monster-execution function while I was already in this.

I want to rework the busted variant into a hacked/jailbroken variant that lacks pay-bot functions entirely, with the idea being crafting an inactive grocery bot will be easier than building a jailbroken one, with converting an inactive regular grocery bot to a hacked one as an alternative recipe. Those will still retain the standard skill roll to deploy as friendly, and count as pets if done so, while a failed roll will have it uselessly faff about and require deactivation to try again due to its payment programming being disabled.

Idea being that, since spawning as friendly has no actual impact on paybot functions currently, the regular version will be relatively easy to get back in working order but will always spawn as neutral (thus requiring payment to be useful), while the hacked version will be a more complex craft that lets you skip the cash card stuff if successfully deployed. I figured however that can wait for a later PR.

Checklist

@github-actions github-actions bot added src changes related to source code. JSON related to game datas in JSON format. labels Feb 22, 2024
@github-actions github-actions bot added the docs PRs releated to docs page label Feb 22, 2024
@scarf005 scarf005 self-requested a review March 2, 2024 01:04
@scarf005 scarf005 self-assigned this Mar 2, 2024
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.

image

took 383 files to rebuild but was worth the time as it's due to feature removal in game.h.

@scarf005 scarf005 merged commit 8c42631 into cataclysmbnteam:main Mar 2, 2024
13 checks passed
@chaosvolt chaosvolt deleted the pet-menu-cleanup branch March 2, 2024 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs PRs releated to docs page JSON related to game datas in JSON format. src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants