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

Jsonize Prying #51778

Merged
merged 7 commits into from
Sep 24, 2021
Merged

Jsonize Prying #51778

merged 7 commits into from
Sep 24, 2021

Conversation

Saicchi
Copy link
Contributor

@Saicchi Saicchi commented Sep 21, 2021

Summary

Infrastructure "Jsonize crowbar and hammer terrain and furniture results"

Purpose of change

Closes #51706

Continuation of #50155, #50133 and #50365.
Instead of making two separate PRs, since they're exactly the same I bundled them into one PR, also because the hammer uses both iuse::hammer and iuse::crowbar.

Describe the solution

A new field for terrain and furniture, prying which are both an object, this object can have two variations.

"prying": {
    "result": "terID/furnID", // (mandatory/optional) terrain/furniture it will become when done, defaults to f_null if furniture, otherwise it is mandatory
    "duration": "1 seconds", // (optional) time required for prying nails, default is 1 second
    "message": "You finish prying the door.", // (optional) message that will be displayed when finished prying successfully
    "byproducts": [ // (optional) list of items that will be spawned when finished successfully
        {
            "item": "item_id",
            "count": 100 // exact amount
        },
        {
            "item": "item_id",
            "count": [ 10, 100 ] // random number in range inclusive
        }
    ],
    "prying_data": {
        "prying_nails": false, // (optional, default false) if set to true, ALL fields below are ignored
        "difficulty": 0, // (optional, default 0) base difficulty of prying action
        "prying_level": 0, // (optional, default 0) minimum prying level tool needs to have
        "noisy": false, // (optional, defaul false) makes noise when successfully prying
        "alarm": false, // (optional) has an alarm, on success will trigger the police
        "breakable": false, // (optional) has a chance to trigger the break action on failure, best used with fragile items as the break WILL ALWAYS succeed
        "failure": "You try to pry the window but fail." // (optional) failure message
    }
}

On failure, if the breakable roll fails, the terrain/furniture bash field will be used.

Create a new activity actor prying_activity_actor which handles both prying with nails and without nails.

Describe alternatives you've considered

Keep hardcoding the results instead.

Testing

  • Prying terrain
    • Examine prying
    • Terrain with nails
    • Terrain without nails
  • Prying furniture
    • Examine prying
    • Furniture with nails
    • Furniture without nails
  • Spawns correct amount of byproducts
  • Multiple byproducts
  • Test very high difficulty level
  • Test very high prying_level
  • Test noisy
  • Test alarm
  • Test breakable

Additional context

When there is no result and the player finishes the prying action, an error will show up on screen and the action won't finish.

The iuse::hammer was redirected to iuse::crowbar. It's set to be removed after 0.G. Because of that I modified the description when using the hammer to be the same as the crowbar.

@Saicchi Saicchi marked this pull request as draft September 21, 2021 21:17
@actual-nh actual-nh added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. labels Sep 21, 2021
@Saicchi Saicchi force-pushed the jsonizecrowbarhammer branch 3 times, most recently from 398f461 to 910f6e1 Compare September 23, 2021 23:00
@Saicchi Saicchi force-pushed the jsonizecrowbarhammer branch from 910f6e1 to ce32f7e Compare September 23, 2021 23:47
@Saicchi Saicchi marked this pull request as ready for review September 23, 2021 23:47
@ISuckM8
Copy link
Contributor

ISuckM8 commented Sep 24, 2021

Mark my words: As soon as this gets merged I'm making a PR to make metal doors pry-able with halligan bars.

@Saicchi
Copy link
Contributor Author

Saicchi commented Sep 24, 2021

As soon as this gets merged I'll make another PR removing duplicate code and changing how batteries are contsumed for electric tools in the ::do_turn section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Crafting / Construction / Recipes Includes: Uncrafting / Disassembling <Enhancement / Feature> New features, or enhancements on existing Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. [JSON] Changes (can be) made in JSON
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pryable furniture cannot be defined in json alone
4 participants