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

vehicles: make shock absorbers actually absorb shock damage #43013

Merged
merged 1 commit into from
Aug 19, 2020

Conversation

mlangsdorf
Copy link
Contributor

Summary

SUMMARY: Bugfixes "vehicles: make shock absorbers actually absorb shock damage"

Purpose of change

Shock absorbers are supposed to absorb transmitted shock damage from collision, but they're just low grade armor. Fix them so they aren't armor at all (though they take up the armor location) and absorb transmitted shock damage properly.

Describe the solution

Add the SHOCK_ABSORBER flag to shock absorbers, and change vehicle::damage_all() so that parts on the same tile as a
shock absorber take substantially less damage from transmitted shock damage in collisions.

Testing

I spawned a solar car and welded a shock absorber to the (-4, 0) frame, then I saved the game. Running into a concrete barrier in reverse at -20 mph completely wrecked every upgraded solar panel in the rear of the car.

I added the patch and reloaded the game. This time, running into the concrete barrier in reverse at -20 mph completely wrecked every solar panel in the rear of the car except the one at (-4, 0), which was unscathed.

Repeating the test with a collision speed of -45 mph wrecked all the solar panels again.

@mlangsdorf mlangsdorf added <Bugfix> This is a fix for a bug (or closes open issue) Vehicles Vehicles, parts, mechanics & interactions labels Aug 18, 2020
@kevingranade
Copy link
Member

Wait, so shock absorbers act as shock isolation just for the location where they are installed?
I was imagining them as more like a bumper that protected the whole vehicle if it was at the impact site.

I see that the "info" field for the property is clear about it, might be a good idea to adjust the vehicle part to match.

@mlangsdorf
Copy link
Contributor Author

shock absorbers as bumpers has three problems:

  • you only get one armor part, so if you put a shock absorber on the edge, you're not armoring the edge
  • shock absorbers become more powerful as your vehicle gets larger, because they protect more parts by attenuating the shock for all parts beyond the part
  • I really don't want to try to figure out whether there is a shock absorber between part Fix compile issues with g++4.2 #4 and part segfault on going downstairs #21; checking whether there is a shock absorber at a tile is easy.

I'll update the JSON_FLAGS.md, of course.

@nexusmrsep
Copy link
Contributor

What about crumple zones? Are shock absorber equal to crumple zones or are they something else?

How I imagine crumple zone parts would work: Lets say that damage_all is made to parse vehicle parts in a particular order where each tier is a set of parts with 'x' distance from impact point. This would simulate damage traveling in a wave along a stiff structure of the vehicle (now it's only used to determine damage, but the order of it's application is irrelevant). If any given part in tier 1 (first pass, parts nearest to the impact zone) has a crumple zone, it can absorb 'x' amount of damage, and that damage could be deducted from the damage that is passed to calculation for tiers 1+, but not in tier 1 since every tile in this set is experiencing same energy from impact simultaneously (even though they will be processed in order) etc.

In other words if the front row of the car tiles has crumple zones built in front each such zone would contribute to protecting the second row of car tiles. This contribution can also be modeled - damage for the crumple zone tile could be actually increased as it is specifically designed for a destructive absorption of impact energy. Result: front of the car smashed to smithereens, but the passenger is intact.

@mlangsdorf
Copy link
Contributor Author

Crumple zones are way beyond the scope of this PR.

Add the SHOCK_ABSORBER flag to shock absorbers, and change
vehicle::damage_all() so that parts on the same tile as a
shock absorber take substantially less damage from transmitted
shock damage in collisions.
@ZhilkinSerg ZhilkinSerg merged commit 536e832 into CleverRaven:master Aug 19, 2020
@mlangsdorf mlangsdorf deleted the shock_absorbers branch August 21, 2020 14:20
@kevingranade
Copy link
Member

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/collision-damage-through-the-roof-intended/25383/2

@kevingranade
Copy link
Member

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/does-shock-absorber-reduce-the-transmission-of-shock-damage/27086/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants