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

feat(content): Support for antigrav #5502

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

David-Silva-Jr
Copy link
Contributor

Checklist

Required

Optional

  • This is a C++ PR that modifies JSON loading or behavior.
    • I have documented the changes in the appropriate location in the doc/ folder.
    • New localizable fields need to be added to the lang/bn_extract_json_strings.sh script if it does not support them yet.
    • If applicable, add checks on game load that would validate the loaded data.

Purpose of change

Add support for flying vehicles powered by anti-gravity repulsors, as opposed to rotors. Also includes a test repulsor.

Describe the solution

The game assumes that all flying vehicles will be helicopters, so this replaces references to "rotorcraft" with "aircraft" where necessary. In addition, I've added some functions which repulsor craft use to calculate lift, and added a [ "REPULSOR" ] tag which vehicle parts can now use.

Describe alternatives you've considered

Balloons?

Testing

Have not tested this yet

Additional context

@github-actions github-actions bot added src changes related to source code. JSON related to game datas in JSON format. labels Oct 4, 2024
@David-Silva-Jr
Copy link
Contributor Author

PLEASE do not merge this before json changes are documented

@chaosvolt
Copy link
Member

Only thought I have so far is: since rotors had their stupid janky invisible hitboxes removed, what functionally is the difference between rotor size and repulsion? What does a repulsor do differently compared to what a rotor does, besides have a different name?

If they both do the same thing then it's possible we could be using a generic "max lift" property for both? Obviously in the future we mainly need to distinguish between 100% always-on lift (for airships), on-so-long-as-engine-is-running lift (helis), and must-stay-moving lift (for airplanes), but raw "liftiness" could be a unified stat for now unless your code has a current reason for them to be separate stats.

@David-Silva-Jr
Copy link
Contributor Author

David-Silva-Jr commented Oct 5, 2024

@chaosvolt the main difference right now is that propulsor lift scales linearly while increasing the rotor area doesn't. For example, doubling the number of repulsors doubles your lift, while doubling total rotor area only increases your lift by about 1.2. But I totally understand if that's not differentiated enough, and it might not be super clear to the user that the scaling is different as well

@chaosvolt
Copy link
Member

Ah, interesting. I think I do like the idea of linear lift scaling too, as well...

David-Silva-Jr and others added 3 commits October 4, 2024 22:34
…hicle construction

* update repulsors.json to be more clear that repulsors are just a test/placeholder for now (please don't read the branch name please)
* Make it so only rotor craft make rotor noises
* add new has_lift() function to check if vehicle generates any lift at all
Copy link
Contributor

autofix-ci bot commented Oct 5, 2024

Autofix has formatted code style violation in this PR.

I edit commits locally (e.g: git, github desktop) and want to keep autofix
  1. Run git pull. this will merge the automated commit into your local copy of the PR branch.
  2. Continue working.
I do not want the automated commit
  1. Format your code locally, then commit it.
  2. Run git push --force to force push your branch. This will overwrite the automated commit on remote with your local one.
  3. Continue working.

If you don't do this, your following commits will be based on the old commit, and cause MERGE CONFLICT.

@RoyalFox2140
Copy link
Collaborator

I could foresee rotor damage on taking off next to a building coming back but only if we:

  1. Display rotor area in a menu, similar to spell AoE
  2. Make it a game option off by default.
  3. Have support for retracting rotors back into the aircraft, it shouldn't be blackhawk technology it should be some futuristic stuff you'd see in Ghost in the Shell. We could put it on different craft like a VTOL. Something on military airfields. I mostly say this in case it interferes with driving somehow.

@@ -913,6 +928,11 @@ int vpart_info::rotor_diameter() const
return has_flag( VPFLAG_ROTOR ) ? rotor_info->rotor_diameter : 0;
}

float vpart_info::repulsion() const
{
return has_flag( "REPULSOR" ) ? repulsor_info->repulsion : 0;
Copy link
Member

Choose a reason for hiding this comment

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

Worth extracting to a VPFLAG_*, since it's going to be checked a lot.

@@ -4081,7 +4085,7 @@ void vehicle::noise_and_smoke( int load, time_duration time )
spew_field( mufflesmoke, exhaust_part, fd_smoke,
bad_filter ? fd_smoke.obj().get_max_intensity() : 1 );
}
if( is_flying && is_rotorcraft() ) {
if( is_flying && has_part( "ROTOR" ) ) {
Copy link
Member

Choose a reason for hiding this comment

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

Check for the VPFLAG_* variant of the flag preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JSON related to game datas in JSON format. src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants