Delete dangerous items only in safe suns

main
Cameron Murphy Reikes 2 years ago
parent 8ca9f2257e
commit bd41a64b84

@ -2897,16 +2897,18 @@ void process(struct GameState *gs, double dt)
cpVect pos_rel_sun = (cpvsub(entity_pos(e), (entity_pos(i.sun)))); cpVect pos_rel_sun = (cpvsub(entity_pos(e), (entity_pos(i.sun))));
cpFloat sqdist = cpvlengthsq(pos_rel_sun); cpFloat sqdist = cpvlengthsq(pos_rel_sun);
bool is_entity_dangerous = false; if(i.sun->sun_is_safe)
is_entity_dangerous |= e->is_missile;
if (e->is_box)
{ {
is_entity_dangerous |= e->box_type == BoxExplosive; bool is_entity_dangerous = false;
} is_entity_dangerous |= e->is_missile;
if (is_entity_dangerous && sqdist < sun_dist_no_gravity(i.sun) * sun_dist_no_gravity(i.sun)) if (e->is_box)
{ {
e->flag_for_destruction = true; is_entity_dangerous |= e->box_type == BoxExplosive;
break; }
if (is_entity_dangerous && sqdist < sun_dist_no_gravity(i.sun) * sun_dist_no_gravity(i.sun))
{
e->flag_for_destruction = true;
}
} }
if (!e->is_grid) // grids aren't damaged (this edge case sucks!) if (!e->is_grid) // grids aren't damaged (this edge case sucks!)

Loading…
Cancel
Save