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

Port over two improvements to simple deconstruct #3334

Merged
merged 2 commits into from
Oct 1, 2023

Conversation

chaosvolt
Copy link
Member

Summary

SUMMARY: Bugfixes "Port over fix for deconstructing furniture over carpet, time change"

Purpose of change

This ports over a fix related to deconstruction of simple items, along with also porting over a JSON improvement to simple deconstruction.

Fixes #3330

Given rationale for the time change:

Simple deconstruction is used basically exclusively for furniture that you "pick up". Examples: mattress, carpet, pallet of cement bags, band saw, oven, charcoal kiln, mannequin, hammock, indoor plant, stack of planks, resin pod. None of these deserve to take 10 entire minutes to disassemble.

Describe the solution

C++ changes:

  1. In construction.cpp, changed the bigger spicier version of can_construct so that its check for requested flags distinguishes between terrain and furniture.

JSON changes:

  1. Changed simple deconstruct to take 10 seconds instead of 10 minutes.

Describe alternatives you've considered

  1. Not porting over the time change, doing it in a separate PR when it's such a tiny change, making it like 1-5 minutes instead...
  2. Rigging some way to make tools and time for deconstruct vary depending on what's being deconstructed so we can just not have to question whether the step makes sense for all cases or not.

Testing

  1. Checked affected JSON file for syntax and lint errors.
  2. Compiled and load tested.
  3. Spawned in carpet with a fridge over it.
  4. Confirmed it still goes for the fridge first, then the carpet.
  5. Spawned more carpet with a chair over it this time.
  6. It no longer allows trying to simple deconstruct so long as the chair is blocking the carpet.
  7. Spawned in a toolbox and confirmed you deconstruct the chair first, then go back to being able to take apart the carpet via either method.
  8. Checked affected C++ file for astyle.

Additional context

PRs ported over:

  1. Fix simple deconstruction, by @dseguin: Construction: Prevent non-simple furniture from simple deconstruction CleverRaven/Cataclysm-DDA#54234
  2. Time edit for simple deconstruct, by @anoobindisguise: make simple deconstructions much faster CleverRaven/Cataclysm-DDA#63656

Co-Authored-By: David Seguin <davidseguin@live.ca>
Co-Authored-By: anoobindisguise <56016372+anoobindisguise@users.noreply.github.com>
@github-actions github-actions bot added src changes related to source code. JSON related to game datas in JSON format. labels Sep 30, 2023
scarf005
scarf005 previously approved these changes Oct 1, 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.

image

LGTM, furniture over tiles are correctly checked.

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.

made some stuff const, used &here directly.

@scarf005 scarf005 enabled auto-merge October 1, 2023 01:12
@scarf005 scarf005 added this pull request to the merge queue Oct 1, 2023
Merged via the queue into cataclysmbnteam:upload with commit ba032af Oct 1, 2023
@chaosvolt chaosvolt deleted the port-deconstruct-fix branch October 1, 2023 01:21
olanti-p pushed a commit to olanti-p/Cataclysm-BN that referenced this pull request Oct 6, 2023
* Port over two improvements to simple deconstruct

Co-Authored-By: David Seguin <davidseguin@live.ca>
Co-Authored-By: anoobindisguise <56016372+anoobindisguise@users.noreply.github.com>

* refactor: use map from outer closure

---------

Co-authored-by: David Seguin <davidseguin@live.ca>
Co-authored-by: anoobindisguise <56016372+anoobindisguise@users.noreply.github.com>
Co-authored-by: scarf <greenscarf005@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Carpet allows all furniture over it to be simple deconstruct
2 participants