From c77c0781413c48e281920e823ffddb44f43547c8 Mon Sep 17 00:00:00 2001 From: Fabian Date: Thu, 22 Apr 2021 19:25:20 +0200 Subject: [PATCH] liste of nodm zones --- ReallifeGamemode.Client/Player/nodm.ts | 8 ++++---- ReallifeGamemode.Client/util/weapondamage.ts | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ReallifeGamemode.Client/Player/nodm.ts b/ReallifeGamemode.Client/Player/nodm.ts index bb4a5f4e..70481b6e 100644 --- a/ReallifeGamemode.Client/Player/nodm.ts +++ b/ReallifeGamemode.Client/Player/nodm.ts @@ -16,22 +16,22 @@ let fahrschuleVector3 = new mp.Vector3(-757.4177, -1279.31, 5.1093183); let fahrschuleVector4 = new mp.Vector3(-832.14087, -1268.561, 4.9827914); let fahrschuleVector5 = new mp.Vector3(-856.8085, -1286.7786, 6.474576); - const polygon_busbase = polygons.add([busbaseVector1, busbaseVector2, busbaseVector3, busbaseVector4], 15, true, [255, 155, 0, 255], 0); const polygon_stadthalle = polygons.add([stadthalleVector1, stadthalleVector2, stadthalleVector3, stadthalleVector4], 15, true, [255, 155, 0, 255], 0); const polygon_fahrschule = polygons.add([fahrschuleVector1, fahrschuleVector2, fahrschuleVector3, fahrschuleVector4, fahrschuleVector5], 15, true, [255, 155, 0, 255], 0); -export let isInAnyPolygon; +export let listNoDMZones = [polygon_busbase, polygon_stadthalle, polygon_fahrschule]; +export let isInAnyNoDMPolygon; export default function nodmHandler() { mp.events.add('playerEnterPolygon', (polygon) => { mp.events.call('toggleNoDmZone', true); - isInAnyPolygon = true; + isInAnyNoDMPolygon = true; }); mp.events.add('playerLeavePolygon', (polygon) => { mp.events.call('toggleNoDmZone', false); - isInAnyPolygon = false; + isInAnyNoDMPolygon = false; }); } diff --git a/ReallifeGamemode.Client/util/weapondamage.ts b/ReallifeGamemode.Client/util/weapondamage.ts index 45e744f5..c706d07c 100644 --- a/ReallifeGamemode.Client/util/weapondamage.ts +++ b/ReallifeGamemode.Client/util/weapondamage.ts @@ -1,10 +1,11 @@ -import { isInAnyPolygon } from "../Player/nodm"; +import { isInAnyNoDMPolygon, listNoDMZones } from "../Player/nodm"; import polygons from "../polygons"; function isTargetInPolygon(pos): boolean { let found = false; - polygons.pool.forEach(zone => { + + listNoDMZones.forEach(zone => { if (polygons.isPositionWithinPolygon(pos, zone, zone.dimension)) { found = true; return; @@ -26,7 +27,7 @@ export default function weapondamageUtil() { mp.events.add('outgoingDamage', (sourceEntity, targetEntity, sourcePlayer, weapon, boneIndex, damage) => { - if (isTargetInPolygon(targetEntity.position) || isInAnyPolygon) { + if (isTargetInPolygon(targetEntity.position) || isInAnyNoDMPolygon) { mp.gui.chat.push("nodm"); return true; }