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

Conversation

mugling
Copy link
Contributor

@mugling mugling commented Jun 16, 2016

Replaces #16941 and follows #17208

demo

@mugling mugling force-pushed the veh16 branch 2 times, most recently from 038a94a to 7509dbb Compare June 16, 2016 10:13
part.removal_reqs.qualities = { { { { quality_id( "HAMMER" ), 1, 1 } } } };
part.install_reqs.components.push_back( { { { "nail", 20 } } } );
} else {
part.install_reqs.components.push_back( { { { "duct_tape", 20 } } } );
Copy link
Contributor

Choose a reason for hiding this comment

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

Will it allow welding?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but this is specified via the vehicle parts requirement data

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See 13ddd1c. Heavy duty frames now require much more welding than standard frames

@mugling mugling force-pushed the veh16 branch 2 times, most recently from 03452a6 to 13ddd1c Compare June 16, 2016 11:59
@mugling
Copy link
Contributor Author

mugling commented Jun 16, 2016

There's a lot more refactoring possible within veh_interact.cpp however that can wait for a further PR.

See updated preamble for screenshot

@mugling mugling changed the title Vehicle installation requirements (part 2) [WIP] Vehicle installation requirements (part 2) [CR] Jun 16, 2016
@Coolthulhu
Copy link
Contributor

Could it also fix the regression with wheels not showing their sizes in install menu?
They did show everything before the var size tampering.

@mugling
Copy link
Contributor Author

mugling commented Jun 16, 2016

Preferably #17195 and #17061 first as we can then have much more interesting installation requirements. For example headlights should take a small amount of electronics skill as well as a supply of electrical wire.

@Coolthulhu
Copy link
Contributor

But that's a rather significant regression brought by recent changes to the vehicle system.
In general, fixing regressions gets a priority over new features.

@mugling
Copy link
Contributor Author

mugling commented Jun 16, 2016

@Coolthulhu We were both typing at the same time - that isn't the reply to your earlier comment

@mugling
Copy link
Contributor Author

mugling commented Jun 16, 2016

See 360d00a. Can handle set of 4" casters as well as 17" wheel

"skills": [ [ "mechanics", 3 ] ],
"time": 240000,
"qualities": [ { "id": "GLARE", "level": 2 } ],
"tools": [ [ [ "welder", 200 ], [ "welder_crude", 300 ], [ "toolset", 150 ], [ "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.

Shouldn't "toolset" be 300?

@Coolthulhu Coolthulhu self-assigned this Jun 17, 2016
@Coolthulhu
Copy link
Contributor

Conflict with #17208

@Coolthulhu Coolthulhu removed their assignment Jun 17, 2016
@@ -7467,16 +7464,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( g->u );
Copy link
Contributor

Choose a reason for hiding this comment

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

g-> can (should) be omitted. It's in the game class (x4).

@Coolthulhu
Copy link
Contributor

Lack of relevant tools isn't properly checked until the work is finished.

@mugling
Copy link
Contributor Author

mugling commented Jun 22, 2016

Lack of relevant tools isn't properly checked until the work is finished.

Can you expand upon this and also confirm the above test case?

@Coolthulhu
Copy link
Contributor

The extra steering axles requirement isn't properly checked when you don't meet the base requirements. For example, you can install extra casters with 0 skill if the vehicle has a steering axle.

@Coolthulhu
Copy link
Contributor

Can you expand upon this and also confirm the above test case?

You can start working on grayed out parts.

Not sure what you did differently with your test case, but in general it works like this:

  • Try to install a part you don't meet some requirements for
  • Some parts won't be installable
  • Some parts will be installable despite unmet requirements

@mugling
Copy link
Contributor Author

mugling commented Jun 22, 2016

What is the exact sequence as I still can't reproduce that

EDIT: Can reproduce. It only occurs for multiple axles/engines

@mugling
Copy link
Contributor Author

mugling commented Jun 22, 2016

The ok -= conditional idiom looks to be unsound

@Coolthulhu
Copy link
Contributor

Minimal example would be:

  • Start new game
  • Drop everything
  • Set skill levels to zero
  • Spawn a car
  • Try to install a roof over the engine
  • Long action starts despite unmet dependencies

The only requirements that seem to stop it are the extra requirements like strength.

@Coolthulhu
Copy link
Contributor

The ok -= conditional idiom looks to be unsound

In a language that has implicit casts to and from bool, anything that treats any non-bool as bool or vice versa is generally a bad idea.
There are good reasons for why Java and C# and many other languages didn't inherit the implicit bool cast from C and C++.

@mugling
Copy link
Contributor Author

mugling commented Jun 22, 2016

Agreed, fixed in 88c5409

{ { quality_id( "GLARE" ), 1, 2 } } } };
part.install_reqs.tools.push_back( { { { "welder", 50 }, { "welder_crude", 75 }, { "oxy_torch", 10 } } } );
part.removal_reqs.qualities = { { { { quality_id( "WRENCH" ), 1, 2 } },
{ { quality_id( "SAW_M" ), 1, 2 } } } };
Copy link
Contributor

Choose a reason for hiding this comment

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

I was pretty sure wrench 2 existed, but looks like it doesn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, it should though and I'm going to handle that now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@Coolthulhu
Copy link
Contributor

Add WRENCH 2 quality

Also the survivor utility belt.

Removal difficulty still needs changing (or arguments that it is an improvement).
In master it is:

  • 2 by default
  • 1 for stuff that isn't welded
  • Equal to install difficulty for security (which has the difficult removal flag)

@mugling
Copy link
Contributor Author

mugling commented Jun 22, 2016

Fixed removal difficulty

@Coolthulhu
Copy link
Contributor

Screw driving 2 doesn't exist. It's fine screw driving.

@mugling
Copy link
Contributor Author

mugling commented Jun 22, 2016

Screw driving 2 doesn't exist. It's fine screw driving.

Done

@Coolthulhu
Copy link
Contributor

It's FINE, not F

@mugling
Copy link
Contributor Author

mugling commented Jun 22, 2016

Ok, sorted

@Coolthulhu Coolthulhu merged commit e025ca4 into CleverRaven:master Jun 22, 2016
bool has_skill = g->u.get_skill_level( skill_mechanics ) >= vpart.difficulty;
bool is_wheel = vpart.has_flag("WHEEL");
return (has_comps && (has_skill || is_wheel));
return g->u.has_trait( "DEBUG_HS" ) || vpart.install_reqs.can_make_with_inventory( crafting_inv );
Copy link
Contributor

Choose a reason for hiding this comment

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

@mugling The check for the debug trait should probably be in can_make_with_inventory or even deeper in the inventory. At least you have to add this special case to the check in complete_vehicle. Currently I can start installing things with the help of that trait, but when the character finishes it gets the sarcastic "You lack the requirements to install the %s." and the vehicle part is not installed.

Copy link
Contributor Author

@mugling mugling Jun 23, 2016

Choose a reason for hiding this comment

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

Noted. I've patched it to fix the instance @Coolthulhu noticed testing #17302 but I agree we should move the check higher to prevent future regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need info on what level of lifting equipment needed for vehicle modification
5 participants