Skip to content

Commit

Permalink
Migrate convertible to foldable (CleverRaven#59572)
Browse files Browse the repository at this point in the history
* Allow itype definitions assign item's item_vars

* Add docs on item properties, variables, itype's variables

* Allow migrations to reset item's variables, document it

* Migrate saved vehicles to generic foldables

* Migrate folding bicycle, wheelchair, inflatable boat items

* Remove "convertible" and unfold iuse from C++ side

* Cosmetic changes

* Adjust item groups, professions to new folded items
  • Loading branch information
irwiss authored and Hirmuolio committed Aug 27, 2022
1 parent 26de4e5 commit dd35627
Show file tree
Hide file tree
Showing 29 changed files with 281 additions and 645 deletions.
5 changes: 0 additions & 5 deletions data/json/item_actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -1035,11 +1035,6 @@
"id": "change_scent",
"name": { "str": "Mask scent" }
},
{
"type": "item_action",
"id": "unfold_vehicle",
"name": { "str": "Unfold" }
},
{
"type": "item_action",
"id": "install_bionic",
Expand Down
2 changes: 1 addition & 1 deletion data/json/itemgroups/Clothing_Gear/clothing.json
Original file line number Diff line number Diff line change
Expand Up @@ -2465,7 +2465,7 @@
[ "fish_sandwich", 2 ],
[ "mango", 1 ],
[ "hand_pump", 5 ],
[ "inflatable_boat", 1 ]
[ "folded_inflatable_boat", 1 ]
]
},
{
Expand Down
5 changes: 4 additions & 1 deletion data/json/itemgroups/Clothing_Gear/gear.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@
"collection": [ { "item": "rebreather_filter", "prob": 50 }, { "item": "rebreather", "prob": 90, "charges": [ 10, 60 ] } ],
"prob": 20
},
{ "collection": [ { "item": "inflatable_boat", "prob": 30 }, { "item": "hand_pump", "prob": 60 } ], "prob": 15 }
{
"collection": [ { "item": "folded_inflatable_boat", "prob": 30 }, { "item": "hand_pump", "prob": 60 } ],
"prob": 15
}
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions data/json/itemgroups/Locations_MapExtras/locations.json
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@
{ "item": "glowstick", "prob": 60, "charges": 1400 },
{ "item": "handflare", "prob": 40, "charges": 300 },
[ "hand_pump", 10 ],
[ "inflatable_boat", 10 ],
[ "folded_inflatable_boat", 10 ],
[ "grapnel", 40 ],
[ "fishing_rod_professional", 60 ],
[ "fishing_rod_basic", 60 ],
Expand Down Expand Up @@ -1268,7 +1268,7 @@
[ "hose", 15 ],
[ "water_faucet", 20 ],
[ "screwdriver", 40 ],
[ "inflatable_boat", 10 ],
[ "folded_inflatable_boat", 10 ],
[ "hand_pump", 10 ],
[ "wrench", 30 ],
[ "pipe", 20 ],
Expand Down Expand Up @@ -2389,7 +2389,7 @@
[ "soup_meat", 15 ],
[ "soup_chicken", 15 ],
[ "soup_mushroom", 15 ],
[ "inflatable_boat", 5 ],
[ "folded_inflatable_boat", 5 ],
[ "hand_pump", 5 ],
[ "soup_tomato", 15 ],
[ "soup_dumplings", 15 ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
{ "item": "oxylamp", "prob": 50, "charges-min": 0 },
[ "bathroom_scale", 50 ],
[ "polisher", 6 ],
[ "inflatable_boat", 10 ],
[ "folded_inflatable_boat", 10 ],
[ "hand_pump", 10 ],
[ "wakizashi_inferior", 30 ],
[ "katana_inferior", 30 ],
Expand Down Expand Up @@ -666,7 +666,7 @@
[ "kukri", 2 ],
[ "knife_hunting", 4 ],
[ "knife_rambo", 20 ],
[ "inflatable_boat", 40 ],
[ "folded_inflatable_boat", 40 ],
[ "hand_pump", 40 ],
[ "throwing_knife", 14 ],
[ "leg_sheath6", 10 ],
Expand Down Expand Up @@ -857,7 +857,7 @@
{ "item": "game_watch", "prob": 15 },
{ "item": "deck_of_cards", "prob": 25 },
{ "item": "atomic_light", "prob": 1 },
{ "item": "inflatable_boat", "prob": 10 },
{ "item": "folded_inflatable_boat", "prob": 10 },
{ "item": "hand_pump", "prob": 15 },
{ "item": "toastem", "prob": 45 },
{ "item": "toastem2", "prob": 45 },
Expand All @@ -872,7 +872,7 @@
{ "item": "teleumbrella", "prob": 4 },
{ "group": "kids_books", "prob": 215 },
{ "item": "novel_pulp", "prob": 30 },
{ "item": "folding_bicycle", "prob": 3 },
{ "item": "folded_bicycle", "prob": 3 },
{ "item": "sunglasses", "prob": 25 },
{ "item": "cowboy_hat", "prob": 25 },
{ "item": "mp3", "prob": 35, "charges": [ 0, 100 ] },
Expand Down Expand Up @@ -1141,7 +1141,7 @@
{ "item": "bike_rack", "prob": 20 },
{ "item": "small_storage_battery", "prob": 10 },
{ "item": "alternator_bicycle", "prob": 10 },
{ "item": "folding_bicycle", "prob": 10 },
{ "item": "folded_bicycle", "prob": 10 },
{ "item": "roller_blades", "prob": 10 }
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
[ "disc_golf", 40 ],
[ "magic_8_ball", 30 ],
[ "novel_pulp", 20 ],
[ "folding_bicycle", 5 ],
[ "folded_bicycle", 5 ],
[ "sunglasses", 25 ],
[ "cowboy_hat", 25 ],
{ "item": "mp3", "prob": 40, "charges": 100 },
Expand Down
8 changes: 4 additions & 4 deletions data/json/itemgroups/activities_hobbies.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
{ "item": "bandolier_wrist", "prob": 100 },
{ "item": "fitness_band", "prob": 10 },
{ "item": "hand_pump", "prob": 10 },
{ "item": "inflatable_boat", "prob": 4 }
{ "item": "folded_inflatable_boat", "prob": 4 }
]
},
{
Expand All @@ -241,7 +241,7 @@
{ "item": "misc_repairkit", "prob": 5, "charges-min": 0 },
{ "item": "mess_kit", "prob": 10, "charges": [ 0, 500 ] },
[ "pot", 20 ],
[ "inflatable_boat", 25 ],
[ "folded_inflatable_boat", 25 ],
[ "hand_pump", 5 ],
[ "pot_copper", 5 ],
[ "teapot", 5 ],
Expand Down Expand Up @@ -384,7 +384,7 @@
{ "item": "electric_lantern", "prob": 8, "charges": [ 0, 100 ] },
{ "item": "oil_lamp", "prob": 5, "charges-min": 0 },
{ "item": "lamp_oil", "prob": 5, "charges-min": 0 },
[ "folding_bicycle", 1 ],
[ "folded_bicycle", 1 ],
[ "coat_rain", 10 ],
[ "hood_rain", 5 ],
[ "rubber_harness_dog", 3 ],
Expand Down Expand Up @@ -448,7 +448,7 @@
{ "item": "misc_repairkit", "prob": 5, "charges-min": 0 },
{ "item": "mess_kit", "prob": 10, "charges": [ 0, 500 ] },
[ "pot", 20 ],
[ "inflatable_boat", 25 ],
[ "folded_inflatable_boat", 25 ],
[ "hand_pump", 5 ],
[ "pot_copper", 5 ],
[ "teapot", 5 ],
Expand Down
18 changes: 18 additions & 0 deletions data/json/items/migration.json
Original file line number Diff line number Diff line change
Expand Up @@ -1795,5 +1795,23 @@
"id": "canola",
"type": "MIGRATION",
"replace": "seed_canola"
},
{
"id": "folding_bicycle",
"type": "MIGRATION",
"replace": "folded_bicycle",
"reset_item_vars": true
},
{
"id": "folded_wheelchair",
"type": "MIGRATION",
"replace": "folded_wheelchair_generic",
"reset_item_vars": true
},
{
"id": "inflatable_boat",
"type": "MIGRATION",
"replace": "folded_inflatable_boat",
"reset_item_vars": true
}
]
75 changes: 0 additions & 75 deletions data/json/items/tool/deployable.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,41 +137,6 @@
"done_message": "You unfold the cot and place it on the ground."
}
},
{
"id": "folding_bicycle",
"type": "TOOL",
"name": { "str": "folding bicycle" },
"description": "This is a bicycle folded into a relatively portable package.",
"weight": "10160 g",
"volume": "76651 ml",
"//": "Data taken from given values/dimensions for the Brompton S1E folding bicycle",
"price": 35000,
"price_postapoc": 2000,
"to_hit": -5,
"bashing": 10,
"material": [ "steel" ],
"symbol": "0",
"color": "light_gray",
"use_action": {
"type": "unfold_vehicle",
"vehicle_name": "bicycle",
"unfold_msg": "You painstakingly unfold the bicycle and make it ready to ride.",
"moves": 500
}
},
{
"id": "generic_folded_vehicle",
"type": "TOOL",
"name": { "str_sp": "seeing this is a bug" },
"description": "seeing this is a bug",
"volume": "0 ml",
"price": 0,
"price_postapoc": 0,
"symbol": "/",
"color": "light_gray",
"flags": [ "ZERO_WEIGHT" ],
"use_action": [ "UNFOLD_GENERIC" ]
},
{
"id": "metal_butcher_rack",
"type": "TOOL",
Expand All @@ -189,28 +154,6 @@
"color": "light_gray",
"use_action": { "type": "deploy_furn", "furn_type": "f_metal_butcher_rack" }
},
{
"id": "inflatable_boat",
"type": "TOOL",
"symbol": "0",
"color": "light_gray",
"name": { "str": "inflatable boat" },
"description": "This rubber rowboat (oars included) is deflated for storage. Activate it (having an air pump in inventory) to inflate and launch.",
"price": 350000,
"price_postapoc": 4000,
"material": [ "rubber" ],
"weight": "1100 g",
"volume": "10000 ml",
"bashing": 10,
"to_hit": -5,
"use_action": {
"type": "unfold_vehicle",
"vehicle_name": "inflatable_boat",
"tools_needed": { "hand_pump": 1 },
"unfold_msg": "You painstakingly unfold, inflate, and launch the %s.",
"moves": 15000
}
},
{
"id": "metal_smoking_rack",
"type": "TOOL",
Expand Down Expand Up @@ -366,23 +309,5 @@
"symbol": "7",
"color": "yellow_red",
"use_action": { "type": "deploy_furn", "furn_type": "f_manual_tire_changer" }
},
{
"id": "folded_wheelchair",
"type": "TOOL",
"name": { "str": "folded wheelchair" },
"description": "A folded wheelchair.",
"weight": "10586 g",
"volume": "13500 ml",
"longest_side": "92 cm",
"symbol": "/",
"color": "light_gray",
"flags": [ "NO_REPAIR" ],
"use_action": {
"type": "unfold_vehicle",
"vehicle_name": "wheelchair",
"unfold_msg": "You painstakingly unfold the wheelchair and make it ready to use.",
"moves": 500
}
}
]
60 changes: 60 additions & 0 deletions data/json/items/tool/unfoldable.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[
{
"id": "generic_folded_vehicle",
"type": "TOOL",
"name": { "str_sp": "seeing this is a bug" },
"description": "seeing this is a bug",
"volume": "0 ml",
"price": 0,
"price_postapoc": 0,
"symbol": "/",
"color": "light_gray",
"flags": [ "ZERO_WEIGHT" ],
"use_action": [ "UNFOLD_GENERIC" ]
},
{
"id": "folded_bicycle",
"type": "TOOL",
"copy-from": "generic_folded_vehicle",
"name": { "str": "folded Bicycle" },
"description": "A folded Bicycle.",
"weight": "20790 g",
"volume": "18500 ml",
"symbol": "0",
"color": "light_gray",
"variables": {
"vehicle_name": "Bicycle",
"folded_parts": "[{\"id\":\"folding_frame\",\"base\":{\"typeid\":\"foldframe\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":0},{\"id\":\"saddle_pedal\",\"base\":{\"typeid\":\"saddle\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":0},{\"id\":\"horn_bicycle\",\"base\":{\"typeid\":\"horn_bicycle\",\"item_vars\":{\"magazine_converted\":\"1\"},\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":0},{\"id\":\"foot_pedals\",\"base\":{\"typeid\":\"foot_crank\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":0},{\"id\":\"folding_frame\",\"base\":{\"typeid\":\"foldframe\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":1,\"mount_dy\":0},{\"id\":\"wheel_mount_light_steerable\",\"base\":{\"typeid\":\"wheel_mount_light\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":1,\"mount_dy\":0},{\"id\":\"wheel_bicycle\",\"base\":{\"typeid\":\"wheel_bicycle\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":1,\"mount_dy\":0},{\"id\":\"folding_frame\",\"base\":{\"typeid\":\"foldframe\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":-1,\"mount_dy\":0},{\"id\":\"wheel_mount_light\",\"base\":{\"typeid\":\"wheel_mount_light\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":-1,\"mount_dy\":0},{\"id\":\"wheel_bicycle\",\"variant\":\"rear\",\"base\":{\"typeid\":\"wheel_bicycle\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":-1,\"mount_dy\":0},{\"id\":\"basketsm_bike\",\"variant\":\"rear\",\"base\":{\"typeid\":\"bike_basket\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":-1,\"mount_dy\":0}]"
}
},
{
"id": "folded_wheelchair_generic",
"type": "TOOL",
"copy-from": "generic_folded_vehicle",
"name": { "str": "folded wheelchair" },
"description": "A folded Wheelchair.",
"weight": "10586 g",
"volume": "13500 ml",
"symbol": "/",
"color": "light_gray",
"variables": {
"vehicle_name": "Wheelchair",
"folded_parts": "[{\"id\":\"folding_frame\",\"base\":{\"typeid\":\"foldframe\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":0},{\"id\":\"folding_seat\",\"base\":{\"typeid\":\"sheet\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":0},{\"id\":\"wheel_mount_light\",\"base\":{\"typeid\":\"wheel_mount_light\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":0},{\"id\":\"wheel_wheelchair\",\"base\":{\"typeid\":\"wheel_wheelchair\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":0},{\"id\":\"hand_rims\",\"base\":{\"typeid\":\"hand_rims\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":0},{\"id\":\"basketsm_wheelchair\",\"base\":{\"typeid\":\"bike_basket\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":0}]"
}
},
{
"id": "folded_inflatable_boat",
"type": "TOOL",
"copy-from": "generic_folded_vehicle",
"name": { "str": "inflatable boat" },
"description": "This rubber rowboat in original packaging (oars and pump included) is deflated for storage. Activate it to inflate and launch.",
"weight": "32420 g",
"volume": "9000 ml",
"symbol": "0",
"color": "light_gray",
"variables": {
"vehicle_name": "inflatable boat",
"folded_parts": "[{\"id\":\"inflatable_section\",\"base\":{\"typeid\":\"inflatable_section\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":0},{\"id\":\"folding_seat\",\"base\":{\"typeid\":\"sheet\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":0},{\"id\":\"inflatable_airbag\",\"base\":{\"typeid\":\"inflatable_airbag\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":0},{\"id\":\"hand_paddles\",\"base\":{\"typeid\":\"hand_paddles\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":0},{\"id\":\"inflatable_section\",\"base\":{\"typeid\":\"inflatable_section\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":1,\"mount_dy\":0},{\"id\":\"inflatable_airbag\",\"base\":{\"typeid\":\"inflatable_airbag\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":1,\"mount_dy\":0},{\"id\":\"inflatable_section\",\"base\":{\"typeid\":\"inflatable_section\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":1,\"mount_dy\":1},{\"id\":\"inflatable_airbag\",\"base\":{\"typeid\":\"inflatable_airbag\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":1,\"mount_dy\":1},{\"id\":\"inflatable_section\",\"base\":{\"typeid\":\"inflatable_section\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":1},{\"id\":\"inflatable_airbag\",\"base\":{\"typeid\":\"inflatable_airbag\",\"item_tags\":[\"VEHICLE\"]},\"mount_dx\":0,\"mount_dy\":1}]"
}
}
]
2 changes: 1 addition & 1 deletion data/json/monsterdrops/feral_humans.json
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@
{ "item": "cookies", "prob": 100 },
{ "group": "harddrugs", "prob": 10 },
{ "item": "dentures", "prob": 75 },
{ "item": "folded_wheelchair", "damage": [ 1, 4 ], "prob": 100 }
{ "item": "folded_wheelchair_generic", "damage": [ 1, 4 ], "prob": 100 }
]
}
]
2 changes: 1 addition & 1 deletion data/json/npcs/items_generic.json
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@
[ "flask_hip", 5 ],
[ "flour", 10 ],
[ "flyer", 1 ],
[ "folding_bicycle", 1 ],
[ "folded_bicycle", 1 ],
[ "folding_poncho", 5 ],
[ "foon", 1 ],
[ "football", 1 ],
Expand Down
43 changes: 43 additions & 0 deletions data/json/obsolete.json
Original file line number Diff line number Diff line change
Expand Up @@ -692,5 +692,48 @@
]
},
"deconstruct": { "items": [ { "item": "compact_ASRG_containment", "count": 1 } ] }
},
{
"id": "folding_bicycle",
"type": "TOOL",
"name": { "str": "folding bicycle" },
"description": "This is a bicycle folded into a relatively portable package.",
"weight": "10160 g",
"volume": "76651 ml",
"//": "Data taken from given values/dimensions for the Brompton S1E folding bicycle",
"price": 35000,
"price_postapoc": 2000,
"to_hit": -5,
"bashing": 10,
"material": [ "steel" ],
"symbol": "0",
"color": "light_gray"
},
{
"id": "folded_wheelchair",
"type": "TOOL",
"name": { "str": "folded wheelchair" },
"description": "A folded wheelchair.",
"weight": "10586 g",
"volume": "13500 ml",
"longest_side": "92 cm",
"symbol": "/",
"color": "light_gray",
"flags": [ "NO_REPAIR" ]
},
{
"id": "inflatable_boat",
"type": "TOOL",
"symbol": "0",
"color": "light_gray",
"name": { "str": "inflatable boat" },
"description": "This rubber rowboat (oars included) is deflated for storage. Activate it (having an air pump in inventory) to inflate and launch.",
"price": 350000,
"price_postapoc": 4000,
"material": [ "rubber" ],
"weight": "1100 g",
"volume": "10000 ml",
"bashing": 10,
"to_hit": -5
}
]
Loading

0 comments on commit dd35627

Please sign in to comment.