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

Collision code trace #38

Open
mlangsdorf opened this issue Dec 23, 2018 · 0 comments
Open

Collision code trace #38

mlangsdorf opened this issue Dec 23, 2018 · 0 comments

Comments

@mlangsdorf
Copy link
Owner

vehicle::act_on_map() -- called once per tile of movement
map::move_vehicle( veh, tripoint( dx, dy ), movedir )
vehicle::precalc_mounts()
std::vector collisions;
do {
collisions.clear()
vehicle::collision( collisions, dp, false )
for structure parts:
coll = vehicle::part_collision()
figure out if we're hitting a vehicle, terrain/furniture, or a creature
calculate collision energy, relative mass, etc.
do {
bash furniture until it breaks or the vehicle stops
smash creatures
} while collision velocity doesn't change sign
return damage inflicted (but don't damage the vehicle I think?)
collisions.push_back( coll )
return !collisions.empty()
for vehicle_collisions
map::vehicle_vehicle_collision()
/* something */
for non-vehicle collisions
veh.damage( impact part )
veh.damage_all( impact part )
while moving and collisions
finish move_vehicle()

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

No branches or pull requests

1 participant