30 lines
772 B
Markdown
30 lines
772 B
Markdown
# MercanRey2.js — collectContacts() (satır 428)
|
||
|
||
[← MercanRey2.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
```javascript
|
||
function collectContacts(target, observer)
|
||
{
|
||
var contacts = {};
|
||
var pos = target.getPosition();
|
||
var entities = target.getWorld().getEntities(pos.x - 28, pos.y - 14, pos.z - 28, pos.x + 28, pos.y + 14, pos.z + 28);
|
||
|
||
for (var i = 0; i < entities.size(); i++)
|
||
{
|
||
var entity = entities.get(i);
|
||
|
||
if (entity == null || entity.isSame(target) || entity.isSame(observer) || !entity.isLivingBase())
|
||
{
|
||
continue;
|
||
}
|
||
|
||
if (entity.isPlayer() || entity.isNPC())
|
||
{
|
||
addContact(contacts, entity);
|
||
}
|
||
}
|
||
|
||
return contacts;
|
||
}
|
||
```
|