refactor(GravityGun): Fixed cleanup of selected entity

This commit is contained in:
Yimura 2021-05-26 14:24:49 +02:00
parent 6621562d89
commit adcee2f487

View File

@ -19,10 +19,8 @@ namespace big
bool bGravityGun = g.weapons.custom_weapon == CustomWeapon::GRAVITY_GUN; bool bGravityGun = g.weapons.custom_weapon == CustomWeapon::GRAVITY_GUN;
double multiplier = 3.0; double multiplier = 3.0;
if (bGravityGun)
{
// ZOOMED IN // ZOOMED IN
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 25)) if (bGravityGun && PAD::IS_DISABLED_CONTROL_PRESSED(0, 25))
{ {
PLAYER::DISABLE_PLAYER_FIRING(PLAYER::PLAYER_ID(), true); PLAYER::DISABLE_PLAYER_FIRING(PLAYER::PLAYER_ID(), true);
for (int control : controls) for (int control : controls)
@ -98,17 +96,14 @@ namespace big
ENTITY::SET_ENTITY_ALPHA(ent, 105, 0); ENTITY::SET_ENTITY_ALPHA(ent, 105, 0);
} }
} }
else if (ent != 0) else if (ent != 0 && entity::take_control_of(ent))
{ {
entity::take_control_of(ent);
ENTITY::SET_ENTITY_COLLISION(ent, true, true); ENTITY::SET_ENTITY_COLLISION(ent, true, true);
ENTITY::SET_ENTITY_ALPHA(ent, 255, 0); ENTITY::RESET_ENTITY_ALPHA(ent);
ent = 0; ent = 0;
notify::above_map("Released entity."); notify::above_map("Released entity.");
} }
} }
}
} }