diff --git a/sources/System/BombHolder/BombHolderSystem.cpp b/sources/System/BombHolder/BombHolderSystem.cpp index 8bbf673e..02ed40aa 100644 --- a/sources/System/BombHolder/BombHolderSystem.cpp +++ b/sources/System/BombHolder/BombHolderSystem.cpp @@ -125,7 +125,7 @@ namespace BBM } this->_wal.getScene()->scheduleNewEntity("Bomb") - .addComponent(position.round()) + .addComponent(position) .addComponent(1, [](WAL::Entity &entity, WAL::Wal &wal) { // the bomb explode when hit entity.scheduleDeletion(); @@ -180,10 +180,6 @@ namespace BBM auto &position = entity.get(); auto &controllable = entity.get(); - if (controllable.bomb && holder.bombCount > 0) { - holder.bombCount--; - this->_spawnBomb(position.position, holder); - } if (holder.bombCount < holder.maxBombCount) { holder.nextBombRefill -= dtime; if (holder.nextBombRefill <= 0ns) { @@ -191,5 +187,14 @@ namespace BBM holder.bombCount++; } } + if (controllable.bomb && holder.bombCount > 0) { + auto spawnPos = position.position.round(); + for (auto &[entity, pos, _] : this->_wal.getScene()->view()) { + if (pos.position == spawnPos) + return; + } + holder.bombCount--; + this->_spawnBomb(spawnPos, holder); + } } } \ No newline at end of file