|
|
|
@ -323,7 +323,6 @@ void create_player(Player *player)
|
|
|
|
|
unlock_box(player, BoxMedbay);
|
|
|
|
|
unlock_box(player, BoxSolarPanel);
|
|
|
|
|
unlock_box(player, BoxScanner);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void create_player_entity(GameState *gs, Entity *e)
|
|
|
|
@ -1601,7 +1600,6 @@ void create_initial_world(GameState *gs)
|
|
|
|
|
create_station(gs, (V2){-50.0f, 0.0f}, BoxExplosive);
|
|
|
|
|
create_station(gs, (V2){0.0f, 100.0f}, BoxGyroscope);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void exit_seat(GameState *gs, Entity *seat_in, Entity *p)
|
|
|
|
@ -1888,11 +1886,12 @@ void process(GameState *gs, float dt)
|
|
|
|
|
if (!e->exists)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (e->body != NULL)
|
|
|
|
|
// sun processing
|
|
|
|
|
{
|
|
|
|
|
cpVect p = cpvsub(cpBodyGetPosition(e->body), v2_to_cp(SUN_POS));
|
|
|
|
|
cpFloat sqdist = cpvlengthsq(p);
|
|
|
|
|
if (sqdist > (INSTANT_DEATH_DISTANCE_FROM_SUN * INSTANT_DEATH_DISTANCE_FROM_SUN))
|
|
|
|
|
|
|
|
|
|
cpVect pos_rel_sun = v2_to_cp(V2sub(entity_pos(e), SUN_POS));
|
|
|
|
|
cpFloat sqdist = cpvlengthsq(pos_rel_sun);
|
|
|
|
|
if (e->body != NULL && sqdist > (INSTANT_DEATH_DISTANCE_FROM_SUN * INSTANT_DEATH_DISTANCE_FROM_SUN))
|
|
|
|
|
{
|
|
|
|
|
bool platonic_found = false;
|
|
|
|
|
if (e->is_grid)
|
|
|
|
@ -1909,7 +1908,7 @@ void process(GameState *gs, float dt)
|
|
|
|
|
if (platonic_found)
|
|
|
|
|
{
|
|
|
|
|
cpBody *body = e->body;
|
|
|
|
|
cpBodySetVelocity(body, cpvmult(cpBodyGetVelocity(body), -1.0));
|
|
|
|
|
cpBodySetVelocity(body, cpvmult(cpBodyGetVelocity(body), -0.5));
|
|
|
|
|
cpVect rel_to_sun = cpvsub(cpBodyGetPosition(body), v2_to_cp(SUN_POS));
|
|
|
|
|
cpBodySetPosition(body, cpvadd(v2_to_cp(SUN_POS), cpvmult(cpvnormalize(rel_to_sun), INSTANT_DEATH_DISTANCE_FROM_SUN)));
|
|
|
|
|
}
|
|
|
|
@ -1919,15 +1918,21 @@ void process(GameState *gs, float dt)
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (!e->is_grid) // grids aren't damaged (this edge case sucks!)
|
|
|
|
|
{
|
|
|
|
|
sqdist = cpvlengthsq(cpvsub(v2_to_cp(entity_pos(e)), v2_to_cp(SUN_POS)));
|
|
|
|
|
if (sqdist < (SUN_RADIUS * SUN_RADIUS))
|
|
|
|
|
{
|
|
|
|
|
e->damage += 10.0f * dt;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cpVect g = cpvmult(p, -sun_gravity_at_point(entity_pos(e)) / (sqdist * cpfsqrt(sqdist)));
|
|
|
|
|
|
|
|
|
|
if (e->body != NULL)
|
|
|
|
|
{
|
|
|
|
|
cpVect g = cpvmult(pos_rel_sun, -sun_gravity_at_point(entity_pos(e)) / (sqdist * cpfsqrt(sqdist)));
|
|
|
|
|
cpBodyUpdateVelocity(e->body, g, 1.0f, dt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e->is_explosion)
|
|
|
|
|
{
|
|
|
|
|