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 hacksaw activity #50155

Merged
merged 11 commits into from
Sep 15, 2021
Merged

Conversation

Saicchi
Copy link
Contributor

@Saicchi Saicchi commented Jul 23, 2021

Summary

Infrastructure "Jsonize terrain and furniture hacksaw result"

Purpose of change

Hacksaw result in activity_handlers::oxytorch_finish is hardcoded, jsonizing it will allow easy addition of more terrain which it can be used and also new items which can use the hacksaw activity.

Describe the solution

Add a new field for terrain and furniture, hacksaw which is an object.

"hacksaw": {
    "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 hacksawing, default is 1 second
    "message": "You finish cutting the metal.", // ( optional ) message that will be displayed when finished
    "byproducts": [ // ( optional ) list of items that will be spawned when finished
        {
            "item": "item_id",
            "count": 100 // exact amount
        },
        {
            "item": "item_id",
            "count": [ 10, 100 ] // random number in range ( inclusive )
        }
    ]
}

Describe alternatives you've considered

Keep hardcoding the results instead.

Testing

  • Hacksaw terrain
  • Hacksaw furniture
  • Spawns correct amount of byproducts
  • Multiple byproducts

Additional context

This is essentially a copy and paste of #50133 but modified for the hacksaw.

result duration byproducts
f_rack f_null 2_minutes pipe[1,3], steel_chunk[1]
t_chainfence t_dirt 10_minutes pipe[6], steel_chunk[20]
t_chaingate_c t_dirt 10_minutes pipe[6], steel_chunk[20]
t_chaingate_l t_dirt 10_minutes pipe[6], steel_chunk[20]
t_chainfence_posts t_dirt 2_minutes pipe[6]
t_window_bars_alarm t_window_alarm 10_minutes rebar[1,8]
t_window_bars_curtains t_window_domestic 10_minutes rebar[1,8]
t_window_bars_domestic t_window_domestic 10_minutes rebar[1,8]
t_window_bars t_window_empty 10_minutes rebar[1,8]
t_window_enhanced t_window_reinforced 5_minutes rebar[1,4]
t_window_enhanced_noglass t_window_reinforced_noglass 5_minutes rebar[1,4]
t_reb_cage t_pit 10_minutes spike[19], scrap[8]
t_retractable_gate_c t_strconc_floor 10_minutes chain[1,2], wire[8,22]
t_retractable_gate_l t_strconc_floor 10_minutes chain[1,2], wire[8,22]
t_bars t_floor 15_minutes pipe[3]
t_door_bar_c t_mdoor_frame 15_minutes pipe[12]
t_door_bar_locked t_mdoor_frame 15_minutes pipe[12]
t_metal_grate_window t_window_reinforced 10_minutes pipe[1,12], sheet_metal[4]
t_metal_grate_window_with_curtain t_window_reinforced 10_minutes pipe[1,12], sheet_metal[4]
t_metal_grate_window_with_curtain_open t_window_reinforced 10_minutes pipe[1,12], sheet_metal[4]
t_metal_grate_window_noglass t_window_reinforced_noglass 10_minutes pipe[1,12], sheet_metal[4]
t_metal_grate_window_with_curtain_noglass t_window_reinforced_noglass 10_minutes pipe[1,12], sheet_metal[4]
t_metal_grate_window_with_curtain_open_noglass t_window_reinforced_noglass 10_minutes pipe[1,12], sheet_metal[4]

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

Some terrains have special conditions, like t_bars which turns into t_sewage if around sewage tiles, otherwise it turns into t_floor. Best way to replicate it would be to have two identical t_bars, one just sewers.

@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 Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. labels Jul 23, 2021
@Saicchi
Copy link
Contributor Author

Saicchi commented Aug 21, 2021

Rebase to current experimental.

@BrettDong
Copy link
Member

Need to remove unused itype_id in C++ code.

@Saicchi Saicchi marked this pull request as draft September 2, 2021 11:43
@Saicchi Saicchi marked this pull request as ready for review September 2, 2021 23:26
@kevingranade kevingranade merged commit 567594a into CleverRaven:master Sep 15, 2021
Venera3 pushed a commit to Venera3/Cataclysm-DDA that referenced this pull request Sep 21, 2021
Co-authored-by: Saicchi <Saicchi@users.noreply.github.com>
Co-authored-by: Kevin Granade <kevin.granade@gmail.com>
@Saicchi Saicchi mentioned this pull request Sep 21, 2021
13 tasks
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` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style <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.

4 participants