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

Directional Vehicle Parts for mounted tools, seats, windshields, rams, and doors #40437

Merged
merged 20 commits into from
Jul 5, 2020

Conversation

mrkybe
Copy link
Contributor

@mrkybe mrkybe commented May 11, 2020

Summary

SUMMARY: Infrastructure "Adds a script for creating directional vehicle parts from json."

Purpose of change

A step towards making this a reality #35861

I applied the script to most vehicle parts: seats, rams, doors, tools, windshields. Game will now ask you which variant you want to mount of that piece, like it does for frames.

Describe the solution

Edit the script to set the parts.json to be modified. Possibly comment out some of the variants you don't want included. The script takes every non-abstract part in parts.json and makes it an abstract one. Then it creates a variant for each of those similar to the ones that exist for frames/boards. For convenience it also writes a textfile with every newly created id, hopefully that can help tileset makers update their tilesets?

@lgtm-com
Copy link

lgtm-com bot commented May 11, 2020

This pull request introduces 1 alert when merging d2ca094 into f6d85ac - view on LGTM.com

new alerts:

  • 1 for Unused import


with open(output_path, "w") as jf:
json.dump(result, jf, ensure_ascii=False, sort_keys=True)
subprocess.Popen(['D:/Cataclysm-DDA/tools/format/json_formatter.exe', output_path], shell=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is only going to work on windows

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The script I based this off, this https://github.com/CleverRaven/Cataclysm-DDA/blob/master/tools/json_tools/pocket_mags.py and it wasn't working for me on Windows. I don't actually expect anyone to be running this script, as I'm committing the transformed JSON along side it. It's more for documentation purposes.

@lgtm-com
Copy link

lgtm-com bot commented May 11, 2020

This pull request introduces 1 alert when merging 8d3170c into 2abca8f - view on LGTM.com

new alerts:

  • 1 for Unused import

@mrkybe mrkybe changed the title Directional vehicle parts [WIP] Directional vehicle parts May 11, 2020
@kevingranade
Copy link
Member

Unfortunately, any part that's been converted to abstract doesn't exist anymore. So vehicle definitions that were using that part will have an error instead.

If I understand you correctly, this is not ok, it's going to impose a huge rewrite and migration effort that is going to have to be adressed immediately.

Can you instead have it introduce a new abstract part and then create a non-abstrsct post that inherits from it and uses the original name?

I.e. some part "heavy_frame"
The script moves the contents of "heavy_frame" to "heavy_frame_abstract" and also creates a "heavy_frame" that is a shallow copy of "heavy_frame_abstract".

With that done everything can be migrated over piecemeal.

@mrkybe
Copy link
Contributor Author

mrkybe commented May 11, 2020

Can you instead have it introduce a new abstract part and then create a non-abstrsct post that inherits from it and uses the original name?

I.e. some part "heavy_frame"
The script moves the contents of "heavy_frame" to "heavy_frame_abstract" and also creates a "heavy_frame" that is a shallow copy of "heavy_frame_abstract".

With that done everything can be migrated over piecemeal.

Perfect, that's a lot easier than my plan of writing a script to update the vehicle definitions. I'll do that.

@ifreund ifreund added [JSON] Changes (can be) made in JSON Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Vehicles Vehicles, parts, mechanics & interactions [Python] Code made in Python labels May 11, 2020
@mrkybe mrkybe changed the title [WIP] Directional vehicle parts Directional Vehicle Parts for mounted tools, seats, windshields, rams, and doors May 13, 2020
@ZhilkinSerg ZhilkinSerg self-assigned this May 27, 2020
@I-am-Erk
Copy link
Member

How's it going with this?

@mrkybe
Copy link
Contributor Author

mrkybe commented Jun 18, 2020

How's it going with this?

This is ready.

@I-am-Erk
Copy link
Member

I-am-Erk commented Jul 5, 2020

image
🎶Did I ever tell you you're my hero?

image
🎶You're everything I would like to beeeeee

image
🎶I can fly higher than an eeeagle

image
🎶Can you help me script changes to the default json vehicles now so they use directional paaarts pleeeeeease

@I-am-Erk I-am-Erk merged commit 879889a into CleverRaven:master Jul 5, 2020
@ZhilkinSerg ZhilkinSerg removed their assignment Jul 6, 2020
I-am-Erk added a commit that referenced this pull request Jul 7, 2020
I-am-Erk added a commit that referenced this pull request Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style [JSON] Changes (can be) made in JSON [Python] Code made in Python Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants