NoDM: Nicht für Leude mit Wanteds
This commit is contained in:
@@ -1,11 +1,19 @@
|
|||||||
export default function wanteds(globalData: IGlobalData) {
|
let wantedCount = 0;
|
||||||
|
|
||||||
|
export default function wanteds(globalData: IGlobalData) {
|
||||||
var browser = mp.browsers.new("package://assets/html/wanteds/index.html");
|
var browser = mp.browsers.new("package://assets/html/wanteds/index.html");
|
||||||
|
|
||||||
mp.events.add("SERVER:SetWanteds", (count: number) => {
|
mp.events.add("SERVER:SetWanteds", (count: number) => {
|
||||||
browser.execute(`setWanteds(${count});`);
|
browser.execute(`setWanteds(${count});`);
|
||||||
|
wantedCount = count;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
mp.events.add("SERVER:SetWantedFlash", (flash) => {
|
mp.events.add("SERVER:SetWantedFlash", (flash) => {
|
||||||
browser.execute(`setFlashing(${flash});`);
|
browser.execute(`setFlashing(${flash});`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getWantedCount(): number {
|
||||||
|
return wantedCount;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { isInAnyNoDMPolygon, listNoDMZones } from "../Player/nodm";
|
import { isInAnyNoDMPolygon, listNoDMZones } from "../Player/nodm";
|
||||||
import polygons from "../polygons";
|
import polygons from "../polygons";
|
||||||
|
import { getWantedCount } from "../Gui/wanteds";
|
||||||
|
|
||||||
|
|
||||||
function isTargetInPolygon(pos): boolean {
|
function isTargetInPolygon(pos): boolean {
|
||||||
@@ -25,8 +26,8 @@ export default function weapondamageUtil() {
|
|||||||
player.setSuffersCriticalHits(false);
|
player.setSuffersCriticalHits(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
mp.events.add('outgoingDamage', (sourceEntity, targetEntity, sourcePlayer, weapon, boneIndex, damage) => {
|
mp.events.add(RageEnums.EventKey.INCOMING_DAMAGE, (sourceEntity: EntityMp, sourcePlayer: PlayerMp, targetEntity: EntityMp, weapon: number, boneIndex: number, damage: number) => {
|
||||||
if (isTargetInPolygon(targetEntity.position) || isInAnyNoDMPolygon) {
|
if ((isTargetInPolygon(sourceEntity.position) || isInAnyNoDMPolygon) && getWantedCount() === 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user