test: target in nodm2
This commit is contained in:
@@ -8,15 +8,6 @@ let vec5 = new mp.Vector3(-500.05966, -2178.3372, 3.6730707);
|
||||
|
||||
const polygon = polygons.add([vec1, vec2, vec3, vec4, vec5], 6, true, [255, 255, 255, 255], 0);
|
||||
|
||||
export function isTargetInPolygon(pos) {
|
||||
polygons.pool.forEach(zone => {
|
||||
if (polygons.isPositionWithinPolygon(pos, zone, zone.dimension)) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
export let isInAnyPolygon;
|
||||
|
||||
export default function nodmHandler() {
|
||||
|
||||
@@ -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