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

Allow components/structures to be made unavailable #3785

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

Arithyce
Copy link

@Arithyce Arithyce commented May 1, 2024

Description:
Modders need the ability to remove/make-unavailable components and structures, both through the API and through research.
Adds removedComponents and removedStructures to research.json.
Adds disableStructure and makeComponentUnavailable to the API.

Why it is needed:
Making things redundant isn't always good enough. Lets say you want to add Mk2/Mk3 propulsions, you don't want the objectively inferior versions showing up at all, especially if they share the same exact name. Another example, going from Scavenger tech to Military tech, you don't want the inferior Scavenger stuff showing up at all.

Additional information:
I am a newb at C++, so there may be some big or small problems.
Fixes: #3776

Issues that need to be resolved:
See #3799.

@Arithyce
Copy link
Author

Arithyce commented May 2, 2024

I gave my PR another look over (self-review), it all seems good.

@Arithyce Arithyce marked this pull request as ready for review May 2, 2024 19:51
@Arithyce
Copy link
Author

Arithyce commented May 2, 2024

This has been tested, and works for me.

@Arithyce
Copy link
Author

Arithyce commented May 2, 2024

This has been tested, and works for me.

Re-tested more thoroughly. It is broken a bit, see OP for details.

@Arithyce Arithyce marked this pull request as draft May 3, 2024 03:40
@Arithyce
Copy link
Author

Arithyce commented May 3, 2024

Issues that need to be resolved:
When a component is made unavailable, any queued units with that component will remain in the production menu and will only be cleared upon re-opening the menu if there is only 1 queued, otherwise the "ghost" template will remain until unqueued. An error is given when the game attempts to produce the unit:
Machinegun Viper Half-tracks : not researched weapon 0,
Wrong template for player 0 factory, type 1..

I don't plan on fixing these issues any time soon (i frankly don't know how). So if anyone wants to do it go right ahead. It would be nice to get this PR into v4.5.0. Thanks.

See #3799 for more info.

@Arithyce Arithyce changed the title Allow components/structures to be made unavailable [WIP] Allow components/structures to be made unavailable May 9, 2024
Attempts to fix these issues: When a component is made unavailable, any queued units with that component will remain in the production menu and will only be cleared upon re-opening the menu if there is only 1 queued, otherwise the "ghost" template will remain until unqueued. An error is given when the game attempts to produce the unit:
"Machinegun Viper Half-tracks : not researched weapon 0",
"Wrong template for player 0 factory, type 1".
@Arithyce Arithyce changed the title [WIP] Allow components/structures to be made unavailable Allow components/structures to be made unavailable May 9, 2024
@Arithyce Arithyce marked this pull request as ready for review May 9, 2024 08:02
@Arithyce Arithyce changed the title Allow components/structures to be made unavailable [WIP] Allow components/structures to be made unavailable May 10, 2024
@Arithyce Arithyce marked this pull request as draft May 10, 2024 05:14
This reverts commit da013b7.
@Arithyce Arithyce changed the title [WIP] Allow components/structures to be made unavailable Allow components/structures to be made unavailable May 11, 2024
@Arithyce Arithyce marked this pull request as ready for review May 11, 2024 01:29
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.

[Modding] Add ability to make components/structures unavailable
1 participant