test: target in nodm2
This commit is contained in:
@@ -1,6 +1,20 @@
|
||||
import { isInAnyPolygon, isTargetInPolygon } from "../Player/nodm";
|
||||
import { isInAnyPolygon } from "../Player/nodm";
|
||||
import polygons from "../polygons";
|
||||
|
||||
|
||||
function isTargetInPolygon(pos): boolean {
|
||||
let found = false;
|
||||
polygons.pool.forEach(zone => {
|
||||
if (polygons.isPositionWithinPolygon(pos, zone, zone.dimension)) {
|
||||
found = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (found) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export default function weapondamageUtil() {
|
||||
let blockInput = false;
|
||||
|
||||
@@ -11,12 +25,9 @@ export default function weapondamageUtil() {
|
||||
});
|
||||
|
||||
mp.events.add('outgoingDamage', (sourceEntity, targetEntity, sourcePlayer, weapon, boneIndex, damage) => {
|
||||
if (isInAnyPolygon) {
|
||||
mp.gui.chat.push("source in nodm");
|
||||
return true;
|
||||
}
|
||||
if (isTargetInPolygon(targetEntity.position)) {
|
||||
mp.gui.chat.push("target in nodm");
|
||||
|
||||
if (isTargetInPolygon(targetEntity.position) || isInAnyPolygon) {
|
||||
mp.gui.chat.push("nodm");
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user