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

Move vehicle flyability to a flag, allow modifying flying vehicles #40509

Merged
merged 1 commit into from
May 17, 2020

Conversation

anothersimulacrum
Copy link
Member

Summary

SUMMARY: None

Purpose of change

Follow-up to #40467
Instead of forbidding modification, use a tag on a vehicle to determine if it is airworthy. Doing any of the previously prevented activities will not set this tag to false.

Describe the solution

Add vehicle::flyable, vehicle::is_flyable() and vehicle::set_flyable() these either return or modify this value. This value defaults to true.
Add vehicle::would_prevent_flyable() this determines if modifying a specific vehicle part would render this vehicle non-flyable.
In vehicle interaction, query if the player wants to render the vehicle unflyable, and if they consent to it, render the vehicle non-flyable.
In vehicle modification activities, bail out if the selected action would make the vehicle unflyable.
When determining if the player can change z levels, check if the vehicle is flyable, and if it is not, bail out.

Testing

Spawn in a helicopter. Attempt to uninstall a part that is not a curtain or seatbelt.
Spawn in a helicopter. Attempt to install a part that is not a curtain or seatbelt.
Spawn in a helicopter. Smash it up a bit, then attempt to repair a part that is not a curtain or seatbelt.
Say no to each of these actions. You can still fly the helicopter. Say yes to each of these actions. Be prevented from flying the helicopter.
Save and load, unflyable vehicles are still unflyable.
Attempt to deconstruct an untouched vehicle. It works fine.
Attempt to deconstruct an intact helicopter. It bails out.

Additional context

image
image
image

@mrkybe
Copy link
Contributor

mrkybe commented May 13, 2020

Seats should be repairable and removing doors from a helicopter is a thing for some helicopters. I don't see why mounting a storage trunk inside a helicopter would make it not airworthy either. It's also weird that a character who doesn't have the helicopter pilot skill knows what would or wouldn't make a vehicle flight worthy. And likewise its weird that a trained helicopter pilot with mechanical skill wouldn't be able to make some kinds of modifications or basic repairs.

I think the better solution might be to have some parts be unrepairable and keep track of how much of the frame/parts are DIY'd. After a certain % of DIY, it becomes less and less flightworthy.

@Rogal-Dorn
Copy link
Contributor

This seems like a much better solution and seems to have a clearer vision going forward, in my opinion at least. One problem I see is that the previously trivial to json out behavior now seems hardcoded. The ROTOR flag is the only place determining both flight and this airworthy check, I believe. Could a new flag be added or something similar that allows json edits to re enable the "gamey" helicopter modification?

@curstwist curstwist added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON Vehicles Vehicles, parts, mechanics & interactions labels May 13, 2020
@Rogal-Dorn
Copy link
Contributor

With the latest commit this seems to be much more logical. Thanks for putting in the work.
In another PR it may be desirable to have other ways to lose airworthiness such as the hull taking too much damage. Should damaged rotors ever be able to fly? I don't know if there are any cases of that historically to refer to, but flying with a damaged rotor seems like a bad idea. Regardless, out of scope for this PR.

This implementation is much more desirable and makes more sense.
@nphyx
Copy link
Contributor

nphyx commented May 16, 2020

This is a much better solution! I still think a lot of arguments could be made as to what should and shouldn't be repairable, but with this change those can be done incrementally without making flying vehicles useless to anyone without a pilot license in the meanwhile (at least they're good for parts again now).

@kevingranade kevingranade merged commit a5cfac0 into CleverRaven:master May 17, 2020
@anothersimulacrum anothersimulacrum deleted the heli3 branch May 17, 2020 04:04
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` [JSON] Changes (can be) made in JSON Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants