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

Vehicle installation requirements (part 2) [RDY] #17209

Merged
merged 32 commits into from
Jun 22, 2016
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9b2e8d2
Display messages in third column
mugling Jun 19, 2016
16b24d0
Vehicle part installation uses requirement data
mugling Jun 19, 2016
4a202ee
Synthesise requirements for legacy parts
mugling Jun 19, 2016
d2f5407
Vehicle part removal uses requirement data
mugling Jun 19, 2016
d472e7d
Avoid spurious string construction
mugling Jun 19, 2016
9ed7a15
Display and enforce installation requirements
mugling Jun 19, 2016
864c6b7
Display and enforce removal requirements
mugling Jun 19, 2016
659ebf2
Consume requirements on part installation
mugling Jun 19, 2016
be0e870
Consume requirements on part removal
mugling Jun 19, 2016
3f452c2
Drop unused declarations
mugling Jun 19, 2016
b1f0450
Use time duration macros
mugling Jun 19, 2016
dfac136
Add example requirement data to frames
mugling Jun 19, 2016
8e7b84b
Fix requirements for frame installation
mugling Jun 19, 2016
2464ff5
Avoid spurious reference to global
mugling Jun 19, 2016
a9712c7
Add std namespace
mugling Jun 19, 2016
ce2954e
Fix correct casting to double
mugling Jun 19, 2016
161a7dc
Use C++11 nullptr idiom
mugling Jun 19, 2016
8cb88d8
Increase to SAW_M level 2
mugling Jun 21, 2016
0061e57
Fix inverted conditional
mugling Jun 21, 2016
99aa03e
Full screen display
mugling Jun 22, 2016
b046f82
Fix handling of TOOL_NONE
mugling Jun 22, 2016
df0fbff
Default to welding not duct tape
mugling Jun 22, 2016
c450359
Update legacy requirements
mugling Jun 22, 2016
7e6df20
Refactor part list suggestion order
mugling Jun 22, 2016
2cf5a94
Correctly break for missing requirements
mugling Jun 22, 2016
4e8028f
Merge branch 'master' into veh16
mugling Jun 22, 2016
88c5409
Replace unsafe idiom with conditional
mugling Jun 22, 2016
a216c26
Add WRENCH 2 quality
mugling Jun 22, 2016
d441efc
Update missed WRENCH 2
mugling Jun 22, 2016
6ec8ef5
Update removal difficulty
mugling Jun 22, 2016
6c7a189
Use fine screwdriving
mugling Jun 22, 2016
cbe52fd
Try again
mugling Jun 22, 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
28 changes: 27 additions & 1 deletion data/json/vehicleparts/frames.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@
"location": "structure",
"durability": 400,
"difficulty": 1,
"requirements": {
"install": {
"skills": [ [ "mechanics", 1 ] ],
"time": 120000,
"qualities": [ { "id": "GLARE", "level": 2 } ],
"tools": [ [ [ "welder", 50 ], [ "welder_crude", 75 ], [ "toolset", 75 ], [ "oxy_torch", 20 ] ] ],
"components": [ [ [ "frame", 1 ] ] ]
},
"removal": {
"skills": [ [ "mechanics", 1 ] ],
"qualities": [ { "id": "SAW_M", "level": 2 } ]
}
},
"breaks_into": "ig_vp_frame",
"flags": [ "MOUNTABLE" ]
},
Expand Down Expand Up @@ -84,7 +97,20 @@
"location": "structure",
"color": "dark_gray",
"durability": 1600,
"difficulty": 1,
"difficulty": 3,
"requirements": {
"install": {
"skills": [ [ "mechanics", 3 ] ],
"time": 240000,
"qualities": [ { "id": "GLARE", "level": 2 } ],
"tools": [ [ [ "welder", 200 ], [ "welder_crude", 300 ], [ "toolset", 300 ], [ "oxy_torch", 60 ] ] ],
Copy link
Member

Choose a reason for hiding this comment

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

@mugling @Coolthulhu How should the oxy_tourch charges scale with the welder charges? I always see different ratios.

Copy link
Contributor

Choose a reason for hiding this comment

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

Pretty sure 1 oxy to 5 welder charges is the most common one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest I don't want to delay this PR on that ground alone

"components": [ [ [ "hdframe", 1 ] ] ]
},
"removal": {
"skills": [ [ "mechanics", 1 ] ],
"qualities": [ { "id": "SAW_M", "level": 2 } ]
}
},
"breaks_into": "ig_vp_hdframe",
"flags": [ "MOUNTABLE" ]
},
Expand Down
5 changes: 5 additions & 0 deletions src/calendar.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

#include <string>

constexpr int MOVES( int n )
{
return n * 100;
}

constexpr int SECONDS( int n )
{
return n / 6;
Expand Down
14 changes: 6 additions & 8 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7431,13 +7431,10 @@ void game::exam_vehicle(vehicle &veh, const tripoint &p, int cx, int cy)
return;
}

if (vehint.sel_cmd != ' ') {
if (vehint.sel_cmd != ' '&& vehint.sel_vpart_info != nullptr ) {
int time = 200;
int skill = u.get_skill_level( skill_id( "mechanics" ) );
int diff = 1;
if (vehint.sel_vpart_info != NULL) {
diff = vehint.sel_vpart_info->difficulty + 3;
}
int diff = vehint.sel_vpart_info->difficulty + 3;
int setup = (calendar::turn == veh.last_repair_turn ? 0 : 1);
///\EFFECT_MECHANICS reduces time spent examining vehicle
int setuptime = std::max(setup * 3000, setup * 6000 - skill * 400);
Expand All @@ -7451,16 +7448,17 @@ void game::exam_vehicle(vehicle &veh, const tripoint &p, int cx, int cy)
// Stored in activity.index and used in the complete_vehicle() callback to finish task.
switch (vehint.sel_cmd) {
case 'i':
time = setuptime + std::max(mintime, 5000 * diff - skill * 2500);
time = vehint.sel_vpart_info->install_time( u );
break;
case 'r':
time = setuptime + std::max(mintime, (8 * diff - skill * 4) * dmg);
break;
case 'o':
time = setuptime + std::max(mintime, 4000 * diff - skill * 2000);
time = vehint.sel_vpart_info->removal_time( u );
break;
case 'c':
time = setuptime + std::max(mintime, 6000 * diff - skill * 4000);
time = vehint.sel_vpart_info->removal_time( u ) +
vehint.sel_vpart_info->install_time( u );
break;
}
u.assign_activity( ACT_VEHICLE, time, (int)vehint.sel_cmd );
Expand Down
6 changes: 6 additions & 0 deletions src/game_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@
/** Weight per level of LIFT/JACK tool quality */
#define TOOL_LIFT_FACTOR 500000 // 500kg/level

/** Cap JACK requirements to support arbritrarily large vehicles */
#define JACK_LIMIT 6000000 // 6000kg (6 metric tonnes)
Copy link
Contributor

Choose a reason for hiding this comment

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

It's consistent with the rest of the definitions here, but shouldn't they become static consts at some point?

Copy link
Contributor Author

@mugling mugling Jun 17, 2016

Choose a reason for hiding this comment

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

Yes on both (consistency and should be static const). Can be done as part of a further refactor of the entire constants header


/** Maximum density of a map field */
#define MAX_FIELD_DENSITY 3

/** Maximum (effective) level for a skill */
#define MAX_SKILL 10

#endif
1 change: 0 additions & 1 deletion src/newcharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@

#define HIGH_STAT 14 // The point after which stats cost double
#define MAX_STAT 20 // The point after which stats can not be increased further
#define MAX_SKILL 20 // The maximum selectable skill level

#define NEWCHAR_TAB_MAX 6 // The ID of the rightmost tab

Expand Down
5 changes: 5 additions & 0 deletions src/requirements.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ struct quality_requirement {
* std::string get_color(bool has_one, const inventory &crafting_inv) const;
*/
struct requirement_data {
// temporarily break encapsulation pending migration of legacy parts
// @see vpart_info::check
// @todo remove once all parts specify installation requirements directly
friend class vpart_info;

typedef std::vector< std::vector<tool_comp> > alter_tool_comp_vector;
typedef std::vector< std::vector<item_comp> > alter_item_comp_vector;
typedef std::vector< std::vector<quality_requirement> > alter_quali_req_vector;
Expand Down
Loading