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

Deactivate pet robots in pet menu instead of query #1931

Merged
merged 4 commits into from
Oct 10, 2022

Conversation

chaosvolt
Copy link
Member

@chaosvolt chaosvolt commented Oct 1, 2022

Summary

SUMMARY: Features "Pet monsters with revert_to_itype now have deactivate option in pet menu, instead of prompting the player beforehand"

Purpose of change

A followup to #217 I'd been meaning to do for a while, per Coolthulhu's request. If you have a pet that can also be deactivated, it is kinda annoying as fuck to have the "turn the monster back into an item?" prompt show up every time you bump into it, making the pet menu more annoying to use and thus making robotic pets like the planned hauler bot unfeasible.

On top of the above, this also adds some sanity-checking to prevent the player from deleting stuff like bags (and stored contents), saddles, what-have-you from a pet when it returns to item form. This is a current flaw I discovered with the existing disable_robot function, that would obviously be a big blocker to adding robot friends that can carry crap for you.

Describe the solution

  1. In game::disable_robot, set it so the opening "wanna take down your X?" prompt is ignored if the creature counts as a pet. This lets the existing prompt and associated stuff used for manhacks/turrets still work unchanged for friendly non-pet bots.
  2. Added a new option to the pet menu, contingent on the affected monster having a viable reversion, that lets you revert it from a separate function. In its current form it is not shown unless the monster has both a defined item to revert to, and it doesn't count as a mech. The latter is to avoid dealing with the fact that right now spawning a mech generates a fresh battery with random charges out of thin air, same as on initial spawn.
  3. Added the relevant function itself, removing the monster and placing its item form there. Also has the same handling of loaded ammo as game::disable_robot, just in case the player somehow ends up with a pet that carries ammo. It also unloads bags, stored items, ropes, armor, and saddles automatically.
  4. Ran affected files through astyle.

Describe alternatives you've considered

Fixing spawns of mechs so that we have support for deployable mechs in vanilla that behave sanely, thus allowing mechs to be deactivatable in the pet menu. Could be done in a follow-up maybe, as part of my general plans to improve mechs.

Testing

  1. Compiled and load tested.
  2. Deployed a debug hauler bot, confirmed it brings up pet menu instead of query to take down.
  3. Confirmed that the menu option to revert correctly packs it up.
  4. Confirmed that slapping a backpack on it dumps it, and any items stowed in it, when packed up.
  5. Likewise tied the bot up and tested that, it returns the rope to inventory as expected.
  6. Debug spawned a friendly hauler bot, confirmed correctly behaves like a deactivatable non-pet robot.
  7. Spawned in and tamed a horse, confirmed that option to revert to item is not shown.
  8. Spawned in and carded a mech, confirmed that also lacks the option.

Additional context

image
image

Things of note:

  1. I'll likely need to update the "automatically untie mech" part of the function once Port complete leash and lead system #1905 is merged.
  2. Reviving the debug hauler bot into its own usable monster, together with flavoring it as less Spot and more Big Dog to make it less useless, is also being done in parallel: Implement and rework the hauler bot #1933
  3. Also super handy for my planned Arcana work here: Ability to pick up and carry glyph critters chaosvolt/cdda-arcana-mod#275

@Coolthulhu
Copy link
Member

Coolthulhu commented Oct 5, 2022

Conflicts with the leash PR, which is older. Will test the other one first.

@Coolthulhu Coolthulhu removed their assignment Oct 5, 2022
@chaosvolt
Copy link
Member Author

Ah, no worries.

@olanti-p olanti-p merged commit 408ecd8 into cataclysmbnteam:upload Oct 10, 2022
@chaosvolt chaosvolt deleted the pet-menu-tweak branch October 10, 2022 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants