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

Overhaul vehicle part installation [RDY] #16280

Merged
merged 36 commits into from
Apr 20, 2016
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
976291c
Rework vehicle_selector to traverse all parts
mugling Apr 19, 2016
7a9a898
Drop function deprecated by visitable interface
mugling Apr 19, 2016
dbfe267
Deprecate item::has_quality
mugling Apr 19, 2016
d169da4
Visitable interface supports tool qualities
mugling Apr 19, 2016
ef8e8b5
Vehicle parts can provide tool qualities
mugling Apr 19, 2016
8bab031
Implement max_quality for visitable interface
mugling Apr 19, 2016
13b09de
Encapsulate lifting strength requirements
mugling Apr 19, 2016
be1e9ac
Overhaul installation requirements
mugling Apr 19, 2016
3ea8809
Add folding engine crane
mugling Apr 19, 2016
4bb4ef8
Prevent lifting ourselves
mugling Apr 19, 2016
b7adbd2
Fix broken conditional
mugling Apr 19, 2016
83fb8b4
Rescale TOOL_LIFT_FACTOR to 500kg per unit
mugling Apr 19, 2016
0799db1
Add different types of crane
mugling Apr 19, 2016
6f7bddd
Support lifting of vehicles when changing wheels
mugling Apr 19, 2016
284e767
Rescale JACK capacities
mugling Apr 19, 2016
8658093
Cap JACK requirements for arbitrarily large vehicles
mugling Apr 19, 2016
d2bd29e
Short-circuit evaluation is more efficient
mugling Apr 19, 2016
fad5c2b
Simplify display of requirements
mugling Apr 20, 2016
7768b3c
Fix visitable interface
mugling Apr 20, 2016
826c124
Provide separate values for JACK
mugling Apr 20, 2016
54963e0
Add excavator and overhaul public works vehicles
mugling Apr 20, 2016
9ec51a8
Fix calculation of maximum installation weight
mugling Apr 20, 2016
ccf460d
Add makeshift jack
mugling Apr 20, 2016
59dae1d
Increase weights of some parts
mugling Apr 20, 2016
fbc1a63
Increase range of vehicle cranes
mugling Apr 20, 2016
4a49134
Fix astyle
mugling Apr 20, 2016
c047287
Support dumping of vehicle weights
mugling Apr 20, 2016
06d24c0
Increase HP for heavy duty frames
mugling Apr 20, 2016
cbe6fed
Support dumping of vehicle parts
mugling Apr 20, 2016
6ac9fa8
Rebalance crafting rigs
mugling Apr 20, 2016
8810013
Adjust carrying/lifting weights
mugling Apr 20, 2016
50b9603
Fix regression of DIG qualities
mugling Apr 20, 2016
e731f45
Fix visitable<T>::max_quality() when quality not found
mugling Apr 20, 2016
7899828
Final balancing of craft rigs
mugling Apr 20, 2016
f537def
Fix positional format string
mugling Apr 20, 2016
c382737
Defang changes
mugling Apr 20, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions data/json/itemgroups/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"items": [
[ "forge", 100 ],
[ "jack", 100 ],
[ "jack_small", 100 ],
[ "oxy_torch", 100 ],
[ "polisher", 100 ],
[ "welder", 100 ]
Expand Down
30 changes: 30 additions & 0 deletions data/json/items/tool/workshop.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
[
{
"id": "jack",
"type": "TOOL",
"name": "bottle jack",
"description": "A portable hydraulic bottle jack rated to lift 3 metric tonnes.",
"material": "steel",
"symbol": ";",
"color": "light_gray",
"weight": 11974,
"volume": 6,
"price": 5000,
"bashing": 8,
"to_hit": -2,
"qualities": [ ["JACK", 6 ] ]
},
{
"id": "jack_small",
"type": "TOOL",
"name": "scissor jack",
"description": "A small scissor jack rated to lift one metric tonne.",
"material": "steel",
"symbol": ";",
"color": "light_gray",
"weight": 1200,
"volume": 3,
"price": 5000,
"bashing": 4,
"to_hit": -2,
"qualities": [ ["JACK", 2 ] ]
},
{
"id": "oxy_torch",
"type": "TOOL",
Expand Down
13 changes: 0 additions & 13 deletions data/json/items/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -7229,19 +7229,6 @@
"use_action": { "type": "knife" },
"qualities": [["CUT", 1], ["BUTCHER", 19]]
},
{
"id": "jack",
"type": "TOOL",
"symbol": ";",
"color": "light_gray",
"name": "jack",
"description": "This is a common hydraulic jack, used when changing tires.",
"price": 5000,
"material": "steel",
"weight": 11974,
"volume": 5,
"bashing": 8
},
{
"id": "scythe",
"type": "TOOL",
Expand Down
28 changes: 28 additions & 0 deletions data/json/items/vehicle/engineering.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[
{
"id": "cantilever_medium",
"type": "GENERIC",
"category": "veh_parts",
"name": "steel boom",
"description": "A large rigid steel boom. If attached to a frame it could be used for lifting.",
"price": 23400,
"weight": 31600,
"volume": 50,
"material": "steel",
"symbol": "&",
"color": "dark_gray"
},
{
"id": "cantilever_small",
"type": "GENERIC",
"category": "veh_parts",
"name": "telescopic cantilever",
"description": "A small steel telescoping cantilever. If attached to a frame it could be used for lifting.",
"price": 7900,
"weight": 12000,
"volume": 12,
"material": "steel",
"symbol": "&",
"color": "dark_gray"
}
]
52 changes: 52 additions & 0 deletions data/json/recipes/other/vehicle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[
{
"result": "cantilever_medium",
"type" : "recipe",
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_VEHICLE",
"skill_used": "mechanics",
"skills_required": [ "fabrication", 3 ],
"difficulty": 5,
"time": 360000,
"book_learn": [ [ "textbook_fabrication", 6 ] , [ "textbook_mechanics", 5 ] ],
"qualities": [
{ "id": "HAMMER", "level": 2 },
{ "id": "SAW_M", "level": 1 },
{ "id": "WRENCH", "level": 2 }
],
"tools": [
[ [ "goggles_welding", -1 ] ],
[ [ "welder", 100 ], [ "welder_crude", 150 ], [ "toolset", 150 ] ]
],
"components": [
[ [ "pipe", 32 ] ],
[ [ "steel_chunk", 8 ], [ "scrap", 24 ] ],
[ [ "chain", 1 ] ]
]
},
{
"result": "cantilever_small",
"type" : "recipe",
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_VEHICLE",
"skill_used": "mechanics",
"skills_required": [ "fabrication", 2 ],
"difficulty": 2,
"time": 60000,
"book_learn": [ [ "textbook_fabrication", 4 ] , [ "textbook_mechanics", 2 ] , [ "manual_mechanics", 2 ] ],
"qualities": [
{ "id": "HAMMER", "level": 2 },
{ "id": "SAW_M", "level": 1 },
{ "id": "WRENCH", "level": 2 }
],
"tools": [
[ [ "goggles_welding", -1 ] ],
[ [ "welder", 50 ], [ "welder_crude", 75 ], [ "toolset", 75 ] ]
],
"components": [
[ [ "pipe", 8 ] ],
[ [ "steel_chunk", 2 ], [ "scrap", 6 ] ],
[ [ "wire", 8 ] ]
]
}
]
1 change: 1 addition & 0 deletions data/json/recipes/recipes.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"CSC_OTHER_MATERIALS",
"CSC_OTHER_PARTS",
"CSC_OTHER_TRAPS",
"CSC_OTHER_VEHICLE",
"CSC_OTHER_OTHER"
]
},{
Expand Down
8 changes: 8 additions & 0 deletions data/json/tool_qualities.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,13 @@
"type" : "tool_quality",
"id" : "PRY",
"name" : "prying"
},{
"type" : "tool_quality",
"id" : "LIFT",
"name" : "lifting"
},{
"type" : "tool_quality",
"id" : "JACK",
"name" : "jacking"
}
]
25 changes: 13 additions & 12 deletions data/json/vehicle_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,18 +162,19 @@
["portable_generator", 50]
]
},{
"type" : "vehicle_group",
"id" : "garage",
"vehicles" : [
["car", 200],
["quad_bike", 120],
["motorcycle", 120],
["superbike", 50],
["welding_cart", 120],
["car_chassis", 200],
["quad_bike_chassis", 120],
["motorcycle_chassis", 120],
["portable_generator", 50]
"id": "garage",
"type": "vehicle_group",
"vehicles": [
[ "car", 10 ],
[ "car_chassis", 20 ],
[ "engine_crane", 40 ],
[ "motorcycle", 10 ],
[ "motorcycle_chassis", 20 ],
[ "portable_generator", 20 ],
[ "quad_bike", 10 ],
[ "quad_bike_chassis", 20 ],
[ "superbike", 5 ],
[ "welding_cart", 20 ]
]
},{
"type" : "vehicle_group",
Expand Down
2 changes: 1 addition & 1 deletion data/json/vehicle_parts.json
Original file line number Diff line number Diff line change
Expand Up @@ -5733,4 +5733,4 @@
{"item": "scrap", "count": [2,6]}
]
}
]
]
41 changes: 41 additions & 0 deletions data/json/vehicleparts/engineering.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[
{
"id": "crane_medium",
"type": "vehicle_part",
"name": "boom crane",
"item": "cantilever_medium",
"location": "structure",
"symbol": "=",
"color": "light_gray",
"broken_symbol": "*",
"broken_color": "light_blue",
"difficulty": 5,
"durability": 200,
"qualities": [ [ "LIFT", 4 ] ],
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not specify JACK explicitly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a very good point

"flags" : [ "TOOL_WRENCH", "PROTRUSION", "OBSTACLE", "UNMOUNT_ON_DAMAGE" ],
"breaks_into": [
{ "item": "pipe", "count": [ 8, 32 ] },
{ "item": "scrap", "count": [ 8, 24 ] }
]
},
{
"id": "crane_small",
"type": "vehicle_part",
"name": "telescopic crane",
"item": "cantilever_small",
"location": "center",
"symbol": "=",
"color": "light_gray",
"broken_symbol": "*",
"broken_color": "light_blue",
"folded_volume": 12,
"difficulty": 2,
"durability": 100,
"qualities": [ [ "LIFT", 1 ] ],
"flags" : [ "TOOL_WRENCH", "PROTRUSION", "OBSTACLE", "FOLDABLE" ],
"breaks_into": [
{ "item": "pipe", "count": [ 2, 8 ] },
{ "item": "scrap", "count": [ 2, 6 ] }
]
}
]
10 changes: 5 additions & 5 deletions data/json/vehicles/cars.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
{"x": 0, "y": 1, "chance": 2, "item_groups": "fast_food"},
{"x": -2, "y": 0, "chance": 11, "item_groups": "car_kit"},
{"x": -2, "y": 1, "chance": 15, "item_groups": "car_kit"},
{"x": -2, "y": 1, "chance": 15, "items": ["jack", "wheel"]}
{"x": -2, "y": 1, "chance": 15, "items": ["jack_small", "wheel"]}
]
},{
"type" : "vehicle",
Expand Down Expand Up @@ -498,7 +498,7 @@
{"x": -2, "y": 1, "chance": 5, "items": "scissors"},
{"x": -2, "y": 1, "chance": 5, "items": "crowbar"},
{"x": -2, "y": 1, "chance": 5, "items": "jumper_cable"},
{"x": -2, "y": 1, "chance": 15, "items": ["jack", "wheel"]}
{"x": -2, "y": 1, "chance": 15, "items": ["jack_small", "wheel"]}
]
},{
"type" : "vehicle",
Expand Down Expand Up @@ -611,7 +611,7 @@
{"x": -2, "y": 1, "chance": 5, "items": "scissors"},
{"x": -2, "y": 1, "chance": 5, "items": "crowbar"},
{"x": -2, "y": 1, "chance": 5, "items": "jumper_cable"},
{"x": -2, "y": 1, "chance": 15, "items": ["jack", "wheel"]}
{"x": -2, "y": 1, "chance": 15, "items": ["jack_small", "wheel"]}
]
},{
"type" : "vehicle",
Expand Down Expand Up @@ -746,7 +746,7 @@
{"x": 0, "y": 0, "chance": 8, "item_groups": "car_misc"},
{"x": 2, "y": 0, "chance": 6, "item_groups": "car_kit"},
{"x": 2, "y": 1, "chance": 8, "item_groups": "car_kit"},
{"x": 2, "y": 1, "chance": 8, "items": ["jack", "wheel"]}
{"x": 2, "y": 1, "chance": 8, "items": ["jack_small", "wheel"]}
]
},{
"type" : "vehicle",
Expand Down Expand Up @@ -825,7 +825,7 @@
],
"items" : [
{"x": -2, "y": 0, "chance": 3, "item_groups": "car_kit"},
{"x": -2, "y": 0, "chance": 3, "items": ["jack", "wheel"]}
{"x": -2, "y": 0, "chance": 3, "items": ["jack_small", "wheel"]}
]
},{
"type" : "vehicle",
Expand Down
10 changes: 10 additions & 0 deletions data/json/vehicles/carts.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,5 +221,15 @@
{"x": 0, "y": 0, "part": "wheel_caster"},
{"x": 0, "y": 0, "part": "seat"}
]
},{
"type" : "vehicle",
"id" : "engine_crane",
"name" : "engine crane",
"blueprint" : "#",
"parts" : [
{"x": 0, "y": 0, "part": "folding_frame"},
{"x": 0, "y": 0, "part": "wheel_caster"},
{"x": 0, "y": 0, "part": "crane_small"}
]
}
]
1 change: 0 additions & 1 deletion lua/class_definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,6 @@ classes = {
{ name = "has_identified", rval = "bool", args = { "string" } },
{ name = "has_item", rval = "bool", args = { "item" } },
{ name = "has_item_with_flag", rval = "bool", args = { "string" } },
{ name = "has_items_with_quality", rval = "bool", args = { "string", "int", "int" } },
{ name = "has_lower_trait", rval = "bool", args = { "string" } },
{ name = "has_mabuff", rval = "bool", args = { "mabuff_id" } },
{ name = "has_martialart", rval = "bool", args = { "matype_id" } },
Expand Down
2 changes: 1 addition & 1 deletion src/bionics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ bool player::uninstall_bionic( std::string const &b_id, int skill_level )
return false;
}
//If you are paying the doctor to do it, shouldn't use your supplies
if( !( has_items_with_quality( "CUT", 1, 1 ) && has_amount( "1st_aid", 1 ) ) &&
if( !( has_quality( "CUT" ) && has_amount( "1st_aid", 1 ) ) &&
skill_level == -1 ) {
popup( _( "Removing bionics requires a cutting tool and a first aid kit." ) );
return false;
Expand Down
6 changes: 6 additions & 0 deletions src/game_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,10 @@
/** Amount by which to charge an item for each unit of plutonium cell */
#define PLUTONIUM_CHARGES 500

///\EFFECT_STR allows lifting of heavier objects */
#define STR_LIFT_FACTOR 10000 // 10kg/STR

/** Weight per level of LIFT/JACK tool quality */
#define TOOL_LIFT_FACTOR 500000 // 500kg/level

#endif
8 changes: 4 additions & 4 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ void iexamine::cardreader(player &p, const tripoint &examp)

void iexamine::rubble(player &p, const tripoint &examp)
{
bool has_digging_tool = p.has_items_with_quality( "DIG", 2, 1 );
bool has_digging_tool = p.has_quality( "DIG", 2 );
if( !has_digging_tool ) {
add_msg(m_info, _("If only you had a shovel..."));
return;
Expand All @@ -680,7 +680,7 @@ void iexamine::rubble(player &p, const tripoint &examp)
void iexamine::crate(player &p, const tripoint &examp)
{
// Check for a crowbar in the inventory
bool has_prying_tool = p.crafting_inventory().has_items_with_quality( "PRY", 1, 1 );
bool has_prying_tool = p.crafting_inventory().has_quality( "PRY", 1 );
if( !has_prying_tool ) {
add_msg( m_info, _("If only you had a crowbar...") );
return;
Expand Down Expand Up @@ -1362,7 +1362,7 @@ void iexamine::flower_dahlia(player &p, const tripoint &examp)
return;
}

if( !p.has_items_with_quality( "DIG", 1, 1 ) ) {
if( !p.has_quality( "DIG" ) ) {
none( p, examp );
add_msg( m_info, _( "If only you had a shovel to dig up those roots..." ) );
return;
Expand Down Expand Up @@ -2263,7 +2263,7 @@ void iexamine::tree_hickory(player &p, const tripoint &examp)
if( !( p.skillLevel( skill_survival ) > 0 ) ) {
return;
}
if( !p.has_items_with_quality( "DIG", 1, 1 ) ) {
if( !p.has_quality( "DIG" ) ) {
add_msg(m_info, _("You have no tool to dig with..."));
return;
}
Expand Down
Loading