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

Item faults #71961

Merged
merged 1 commit into from
Mar 6, 2024
Merged

Item faults #71961

merged 1 commit into from
Mar 6, 2024

Conversation

zack-shoylev
Copy link
Contributor

@zack-shoylev zack-shoylev commented Feb 25, 2024

Summary

Balance "Replace ITEM_BROKEN flag with a nuanced but simple system that uses faults following the system used for vehicle parts"

Purpose of change

The current system of items becoming permanently disabled by water and electricity, while necessary for balance and providing a challenge, lacks nuance and complexity. Instead, use the system of mending and repair used for vehicle parts and guns. Also see issue #64528

Describe the solution

For now, create a number of faults that can be applied to items with the ELECTRONIC or WATER_BREAK or WATER_BREAK_ACTIVE flags when these items are damaged by water or EMP-like effects.

When an item with a WATER_BREAK or WATER_BREAK_ACTIVE flag is exposed to water, it receives a random fault of fault type "wet".

When an item with a WATER_BREAK or WATER_BREAK_ACTIVE flag is exposed to water, if it has the ELECTRONIC flag, it receives a random fault of fault type "shorted".

When an item with the ELECTRONIC flag is exposed to EMP, it receives a random fault of type "shorted".

Fault type is a new json property for faults.

New "wet" and "shorted" faults added. Fault fixes added for those as well (a few example ones only, more faults and fixes can be added later).

Describe alternatives you've considered

Health-points damage

Making flags reversable (faults seem more nuanced as you can have multiples for both problems and fixes).

Testing

Tested via item unit tests and manually via spawning items, jumping in water, and fixing items.
Screenshot 1
Screenshot 2
Screenshot 3

Additional context

At this point this needs reviews
Note this affected performance of item.is_broken
This introduces optional types to faults which was out-of-scope for what I wanted to do

Future work: relevant items also take damage points and/or permanent damage points when they are exposed to water/EMP?

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON new contributor Game: Balance Balancing of (existing) in-game features. labels Feb 25, 2024
@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Feb 25, 2024
@worm-girl
Copy link
Contributor

If you're looking for recipe ideas, we have hair dryers that have a currently unused BLOW_HOT_AIR quality which might dry out a wet phone faster than a bag of rice.

@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Feb 25, 2024
data/json/faults/faults_water.json Outdated Show resolved Hide resolved
data/json/faults/faults_water.json Outdated Show resolved Hide resolved
@IdleSol
Copy link

IdleSol commented Feb 25, 2024

Bionics repair system. Take a broken item, press m, spend time and possibly materials and get a working item.

But does it make sense? Most often my smartphone breaks down. Threw it out and got a new one.

@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions and removed json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Feb 25, 2024
data/json/faults/faults_electronic.json Outdated Show resolved Hide resolved
data/json/faults/faults_electronic.json Outdated Show resolved Hide resolved
data/json/faults/faults_electronic.json Outdated Show resolved Hide resolved
data/json/faults/faults_electronic.json Show resolved Hide resolved
@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` and removed json-styled JSON lint passed, label assigned by github actions labels Feb 25, 2024
src/fault.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the astyled astyled PR, label is assigned by github actions label Feb 25, 2024
src/fault.cpp Outdated Show resolved Hide resolved
src/fault.h Outdated Show resolved Hide resolved
src/fault.h Outdated Show resolved Hide resolved
Copy link
Contributor

Spell checker encountered unrecognized words in the in-game text added in this pull request. See below for details.

Click to expand
  • An electronic circuit has been destroyed by overvoltage

This alert is automatically generated. You can simply disregard if this is inaccurate, or (optionally) you can also add the new words to tools/spell_checker/dictionary.txt so they will not trigger an alert next time.

@zack-shoylev
Copy link
Contributor Author

If you're looking for recipe ideas, we have hair dryers that have a currently unused BLOW_HOT_AIR quality which might dry out a wet phone faster than a bag of rice.

Added

@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions and removed json-styled JSON lint passed, label assigned by github actions labels Feb 26, 2024
src/explosion.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the astyled astyled PR, label is assigned by github actions label Feb 26, 2024
src/item.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions and removed astyled astyled PR, label is assigned by github actions labels Feb 28, 2024
src/item.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions and removed astyled astyled PR, label is assigned by github actions labels Feb 28, 2024
src/avatar_action.cpp Outdated Show resolved Hide resolved
src/explosion.cpp Outdated Show resolved Hide resolved
src/explosion.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions and removed astyled astyled PR, label is assigned by github actions labels Feb 29, 2024
src/avatar_action.cpp Outdated Show resolved Hide resolved
src/avatar_action.cpp Outdated Show resolved Hide resolved
src/explosion.cpp Outdated Show resolved Hide resolved
src/explosion.cpp Outdated Show resolved Hide resolved
src/game.cpp Outdated Show resolved Hide resolved
tests/item_test.cpp Outdated Show resolved Hide resolved
tests/item_test.cpp Outdated Show resolved Hide resolved
tests/item_test.cpp Outdated Show resolved Hide resolved
tests/item_test.cpp Outdated Show resolved Hide resolved
tests/item_test.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot removed the astyled astyled PR, label is assigned by github actions label Mar 2, 2024
src/item.h Outdated Show resolved Hide resolved
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions and removed astyled astyled PR, label is assigned by github actions labels Mar 2, 2024
tests/item_test.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions and removed astyled astyled PR, label is assigned by github actions labels Mar 2, 2024
Copy link
Member

@RenechCDDA RenechCDDA left a comment

Choose a reason for hiding this comment

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

I'm not wholly in love with the fault types being arbitrary strings, but the technical implementation is competent.

@zack-shoylev
Copy link
Contributor Author

I'm not wholly in love with the fault types being arbitrary strings, but the technical implementation is competent.

A good next-step refactoring would be to give all faults fault types and move the faults types to a similar implementation as item flags, and maybe allow faults to have multiple fault types. But don't want to balloon the PR.

@zack-shoylev
Copy link
Contributor Author

Cleaned up commit history

@Maleclypse
Copy link
Member

Maleclypse commented Mar 6, 2024

The big concern I’m getting is that repairing modern electronics that have gotten wet like a phone just isn’t possible. Is it possible to do this only to simple electronics like radios? I apologize if I’m confused about ground that’s already covered. But I definitely think we’d want to limit this to simple electronics in vanilla and make it expandable to more complicated electronics in mods like Aftershock and Blaze Industries.

Edit: contributors I trust have suggested that my suggestion is a good following PR

@RenechCDDA
Copy link
Member

My recommendation remains that submerging electronics in water should apply both a short and a wet type fault. Which means that it at least requires replacingsome of the hardware (although very valid concerns were raised elsewhere about the ability to repair consumer electronics with random PCBs).

Right now our electronics are all simply electronics, a supercomputer is the same thing as a flashlight with no regards for how complex it might be to repair. Differentiating all of our electronics into their specific fault types is a worthy cause, but it would badly bloat this PR's scope.

@Maleclypse Maleclypse merged commit 58cef75 into CleverRaven:master Mar 6, 2024
21 of 27 checks passed
@zack-shoylev
Copy link
Contributor Author

I think this discussion should continue in #64528

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. Game: Balance Balancing of (existing) in-game features. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions new contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants