| 42 | } |
| 43 | |
| 44 | bool LuaBindings::EntityCallbacks::isValidTarget(Entity const* entity, EntityId entityId) { |
| 45 | auto target = entity->world()->entity(entityId); |
| 46 | |
| 47 | if (!target || !entity->getTeam().canDamage(target->getTeam(), false)) |
| 48 | return false; |
| 49 | |
| 50 | if (auto monster = as<Monster>(target)) |
| 51 | return monster->aggressive(); |
| 52 | |
| 53 | if (auto npc = as<Npc>(target)) { |
| 54 | if (auto attackerNpc = as<Npc>(entity)) |
| 55 | return npc->aggressive() || attackerNpc->aggressive(); |
| 56 | return true; |
| 57 | } |
| 58 | |
| 59 | return is<Player>(target); |
| 60 | } |
| 61 | |
| 62 | Vec2F LuaBindings::EntityCallbacks::distanceToEntity(Entity const* entity, EntityId entityId) { |
| 63 | Vec2F dist; |
nothing calls this directly
no test coverage detected