feat(balance): increase variety of potential damage states for spawned vehicles #4746
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose of change
It's a famous Cata meme, on Zero Day every tire in the world magically explodes. While all the other mechanisms for spawning a vehicle disabled in the game's code are more subtle and natural-looking, the "wreck the tires" code always looks jarring with how it vehicles only ever generate with intact wheels or with all wheels busted. It not only looks odd, but means the player rarely gets to contend with the "unbalanced" and "no steering" conditions.
Along the way, in looking at the code I found myself rapidly being tempted to tinker with the code a bit more to flesh out the variation in spawn conditions further.
Describe the solution
In vehicle.cpp, set the
destroyTires
behavior invehicle::init_state
to pick wheels to destroy a number of tries equal to the number of wheels it has, instead of intentionally trying to overkill the wheels with 100 attempts. Idea is, since it will target a random wheel each time and might try to hit the same wheel more than once, the odds of it wrecking every single wheel go down the more wheels the vehicle has, any the damage to wheels will fittingly appear more random and look less obviously faked.In addition, as a bonus cars set to spawn damaged but not disabled can now also make a single bonus roll to spawn with a busted wheel and some added potential to spawn with a random amount of wrecked windshields. A single 5% chance to bust one wheel and a 5% chance per windshield, respectively.
Next, set it so that reactors, minifridges, and minifreezers only spawn active some of the time, adding more variation to whether a car with those features that spawns will drain its batteries and/or plutonium while left idle before you get to it.
Describe alternatives you've considered
Screaming.
Testing
Status of a car that spawned messed up in an uncommon way due to the new randomization:
A semi showing how more wheels means better chance to still be drivable:
Additional context
Checklist