mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-30 01:05:24 +00:00
Spawning a bomb inside a player dont block him anymore
This commit is contained in:
@@ -14,15 +14,16 @@ namespace BBM
|
||||
void BombSystem::onUpdate(WAL::ViewEntity<BasicBombComponent, PositionComponent> &entity, std::chrono::nanoseconds dtime)
|
||||
{
|
||||
auto &bomb = entity.get<BasicBombComponent>();
|
||||
if (!bomb.ignoreOwner)
|
||||
|
||||
if (bomb.ignoredEntities.empty())
|
||||
return;
|
||||
|
||||
auto &pos = entity.get<PositionComponent>();
|
||||
for (auto &[owner, ownerPos, _] : this->_wal.getScene()->view<PositionComponent, BombHolderComponent>()) {
|
||||
if (owner.getUid() != bomb.ownerID)
|
||||
continue;
|
||||
if (pos.position.distance(ownerPos.position) >= 1.1) {
|
||||
bomb.ignoreOwner = false;
|
||||
return;
|
||||
bomb.ignoredEntities.erase(
|
||||
std::remove(bomb.ignoredEntities.begin(), bomb.ignoredEntities.end(), owner.getUid()),
|
||||
bomb.ignoredEntities.end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user