haus system auf core geändert

This commit is contained in:
hydrant
2020-03-29 12:18:17 +02:00
parent 6bd3d4a3d0
commit bcfc2105ea
68 changed files with 1366 additions and 810 deletions

View File

@@ -1,4 +1,4 @@
export default function gangwarHandle(globalData: GlobalData) {
export default function gangwarHandle(globalData: IGlobalData) {
function inside(point, vs) {
let x = point[0],
@@ -65,12 +65,12 @@
}
_setup(name, id, x, y, range, color, rot, owner, edit, vector) {
var self = this;
self.name = name;
self.id = id;
self.range = range;
self.setColor(owner);
self.setColor(owner);
self.x = x;
self.y = y;
self.rotation = rot;
@@ -91,7 +91,7 @@
} else {
self.leaderBlipVector = null;
}
self.leaderColShape = null;
}
@@ -122,11 +122,11 @@
loadArea() {
var self = this;
self.blip = mp.game.ui.addBlipForRadius(self.x, self.y, 1, self.range);
mp.game.invoke(Natives.SET_BLIP_SPRITE, self.blip, 5);
mp.game.invoke(Natives.SET_BLIP_ALPHA, self.blip, 70);
mp.game.invoke(Natives.SET_BLIP_COLOUR, self.blip, self.color);
self.blip = mp.game.ui.addBlipForRadius(self.x, self.y, 1, self.range);
mp.game.invoke(Natives.SET_BLIP_SPRITE, self.blip, 5);
mp.game.invoke(Natives.SET_BLIP_ALPHA, self.blip, 70);
mp.game.invoke(Natives.SET_BLIP_COLOUR, self.blip, self.color);
self._colshape = mp.colshapes.newCircle(self.x, self.y, self.range * 1.5);
}
render() {
@@ -139,9 +139,9 @@
mp.game.invoke(Natives.SET_BLIP_COORDS, self.blip, mp.players.local.position.x, mp.players.local.position.y, 1);
self.x = mp.players.local.position.x;
self.y = mp.players.local.position.y;
}
mp.game.invoke(Natives.SET_BLIP_ROTATION, self.blip, self.rotation);
}
mp.game.invoke(Natives.SET_BLIP_ROTATION, self.blip, self.rotation);
}
@@ -192,10 +192,10 @@
a += 0.001
}
*/
}
}
}
if (self.isInsideArea()) {
mp.game.graphics.drawText(self.name, [self.x, self.y, mp.players.local.position.z + 20], {
@@ -205,7 +205,7 @@
outline: true,
centre: true
});
}
}
}
@@ -223,11 +223,11 @@
}
}
}
}
startGangWar() {
startGangWar() {
var self = this;
if (self._status == "normal") {
let dist = mp.game.gameplay.getDistanceBetweenCoords(mp.players.local.position.x, mp.players.local.position.y, 0, self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z, false);
@@ -251,7 +251,7 @@
}
if (status == "normal") {
self._status = "normal";
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false);
mp.game.invoke(Natives.SET_BLIP_FLASHES, self.blip, false);
return;
}
if (status == "conquered") {
@@ -296,19 +296,19 @@
self.setLeaderColShape();
mp.game.invoke(Natives.SET_BLIP_SPRITE, self.leaderBlip, 437);
mp.game.invoke(Natives.SET_BLIP_AS_SHORT_RANGE, self.leaderBlip, false);
}
}
}
setLeaderColShape() {
var self = this;
let newVector = new mp.Vector3(self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z - 2)
self.leaderColShape = mp.markers.new(1, newVector, 2, {
color: [255, 255, 0, 150],
visible: true,
dimension: 0
});
let newVector = new mp.Vector3(self.leaderBlipVector.x, self.leaderBlipVector.y, self.leaderBlipVector.z - 2)
self.leaderColShape = mp.markers.new(1, newVector, 2, {
color: [255, 255, 0, 150],
visible: true,
dimension: 0
});
}
@@ -321,7 +321,7 @@
}
check() {
var self = this
var self = this
if (self._entered == true) {
if (!self.isInsideArea() || (self.isNearGround() == false)) {
self._entered = false;
@@ -329,7 +329,7 @@
}
}
}
enter() {
var self = this;
self._timerCheck = setInterval(function () {
@@ -340,8 +340,8 @@
mp.game.audio.playSoundFrontend(1, "Enter_Capture_Zone", "DLC_Apartments_Drop_Zone_Sounds", true);
mp.game.graphics.stopScreenEffect("MinigameTransitionIn");
mp.game.graphics.startScreenEffect("MinigameTransitionOut", 500, false);
}
}
mp.events.callRemote("Gangarea:Enter", JSON.stringify(self.id));
}
} else if (self._entered == true) {
@@ -350,7 +350,7 @@
if (self._status === "attack") {
mp.game.audio.playSoundFrontend(1, "Exit_Capture_Zone", "DLC_Apartments_Drop_Zone_Sounds", true);
mp.game.graphics.startScreenEffect("MinigameTransitionIn", 500, false);
}
}
mp.events.callRemote("Gangarea:Leave", JSON.stringify(self.id));
}
}
@@ -360,7 +360,7 @@
leave() {
var self = this;
clearInterval(self._timerCheck);
self.check();
}
isNearGround() {
@@ -469,7 +469,7 @@
last_leaderBlip = mp.game.invoke(Natives.GET_NEXT_BLIP_INFO_ID, 437);
}
}
mp.events.add('GangAreas:Create', (turfsJSON) => {
var turfs = JSON.parse(turfsJSON);
if (gangturfs.length > 0) {
@@ -485,7 +485,7 @@
}
clearBlips();
if (turfs.length > 0) {
gangturfs = [];
turfs.forEach(function (turf) {
if (turf.Id != undefined) {
@@ -505,7 +505,7 @@
if (gangturfs[gangturfs.length - 1].id == -1) {
mp.events.callRemote("SERVER:SetTurf", JSON.stringify(gangturfs[gangturfs.length - 1].x), JSON.stringify(gangturfs[gangturfs.length - 1].y), JSON.stringify(gangturfs[gangturfs.length - 1].rotation), JSON.stringify(gangturfs[gangturfs.length - 1].range), name);
}
}
});
mp.events.add('ADMIN:DeleteTurf', () => {
@@ -541,13 +541,13 @@
mp.events.add('CLIENT:Turf_LoadLeaderBlip', () => {
gangturfs.forEach(function (turf) {
turf.setLeaderBlip(false);
turf.setLeaderBlip(false);
});
});
mp.events.add('ADMIN:Turf_CreateLeaderBlip', () => {
gangturfs.forEach(function (turf) {
if (turf._entered == true) {
if (turf._entered == true) {
turf.setLeaderBlip(true);
}
});
@@ -556,7 +556,7 @@
mp.events.add('CLIENT:StartGangwar', () => {
gangturfs.forEach(function (turf) {
if (turf._entered == true) {
turf.startGangWar();
turf.startGangWar();
}
});
});