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

Separate starting battery from mechs #2831

Merged

Conversation

chaosvolt
Copy link
Member

Summary

SUMMARY: Balance "Spawn mech battery separate from the mech, allowing for mechs to be placed without a power cell when needed"

Purpose of change

Set this change aside separate from #2829 so it doesn't bog the other stuff down or vice-versa.

This is aimed specifically at making it less of a pain in the ass to add support for mechs that can be spawned via a place_monster item. Presently not useful in vanilla but it could be in the future, out of repo it's useful for Arcana.

Describe the solution

  1. In monster.cpp, change monster::monster so that mechs don't spawn with a battery pre-loaded.

The reason for this is, if you have a source of the monster from an item, there's the possbility that it may have been crafted or otherwise loaded, such that the player is well aware how charged the battery that went into it is. As such, having it spawn with a random amount of battery power in this instance is a mere annoyance, and it'd be better to have the player provide the power cell separately after getting the mech up and running.

I would've wanted to have this only take effect if the mech spawns with the pet flag, to cover the above issues, but pet flag application from place_monster items presumably takes effect after the monster generates its starting battery, so this doesn't work. As such, because this removes the starter battery from all mechs...

  1. Reworked the mech spawn in bunkers to use a nested chunk that has a 10% chance of spawning, instead of three separate super-low spawn chances. Said chunk picks one of the mechs at random to spawn along with placing the power cell on the nearby rack.
  2. Updated the lab finale variant that spawns a mech to also place the power cell on the nearby counter.
  3. Updated Dinomod and No Hope accordingly.

Describe alternatives you've considered

Spawning mech cells in these spawns with set amounts of charge, or even just grant full ones outright.

Testing

  1. Compiled and load-tested.
  2. Temporarily added Arcana to mods folder.
  3. Spawned in and used a rebuilt anomaly recon mech.
  4. Examined it and confirmed it spawned without a power cell loaded.
  5. Tested that loading an essence fuel cell into it still works, and that it drains power with use.
  6. Spawned in a vanilla recon mech, confirmed it spawns with no battery loaded but can have one loaded.
  7. Checked affected C++ file for astyle.
  8. Temporarily elevated the mech variant of bunkers to have a much higher spawn weight.
  9. Spawned in said location multiple times, confirmed that mechs sometime spawn, and when they do it's always with a power cell.
  10. Checked affected JSON files for syntax and lint errors.

Additional context

@github-actions github-actions bot added JSON related to game datas in JSON format. mods PR changes related to mods. src changes related to source code. labels May 16, 2023
chaosvolt added a commit to chaosvolt/cdda-arcana-mod that referenced this pull request May 16, 2023
Also relates to BN changes in cataclysmbnteam/Cataclysm-BN#2831 but since it turns out I'd already accidentally left out the battery in the crafting recipe I'll just leave it like that in the BN version.
Copy link
Collaborator

@Firestorm01X2 Firestorm01X2 left a comment

Choose a reason for hiding this comment

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

Ready

@Firestorm01X2 Firestorm01X2 merged commit 0b81f34 into cataclysmbnteam:upload May 19, 2023
@chaosvolt chaosvolt deleted the big-mechs-go-big-steppy-part-2 branch May 19, 2023 15:39
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. mods PR changes related to mods. src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants