Merge branch 'develop' of ssh://development.life-of-german.org:451/log-gtav/reallife-gamemode into develop
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import * as NativeUI from '../libs/NativeUI';
|
||||
import InputHelper from '../inputhelper';
|
||||
import relativeVector from '../util/relativevector';
|
||||
const Menu = NativeUI.Menu;
|
||||
const UIMenuItem = NativeUI.UIMenuItem;
|
||||
const UIMenuListItem = NativeUI.UIMenuListItem;
|
||||
@@ -17,7 +18,7 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
var sorting = 0;
|
||||
var firstSorting = true;
|
||||
var activeTask = null;
|
||||
var activeCheckpoint;
|
||||
var activeCheckpoint: CheckpointMp;
|
||||
var taskStart;
|
||||
var taskFinish;
|
||||
var taskRange;
|
||||
@@ -216,6 +217,7 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
let reviveTaskMenuMedic;
|
||||
let healTaskMenuMedic;
|
||||
let fireTaskMenuMedic;
|
||||
let deleteCheckpointItem;
|
||||
|
||||
if (userFactionId == 2) {
|
||||
if (isDuty) {
|
||||
@@ -231,6 +233,12 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
fireTaskMenuMedic.SetRightLabel(fPM + fireTaskCountMedic);
|
||||
factionInteractionMenu.AddItem(fireTaskMenuMedic);
|
||||
*/
|
||||
if (activeTask != null) {
|
||||
if (activeTask.Type == 1 && activeCheckpoint && mp.checkpoints.exists(activeCheckpoint)) {
|
||||
deleteCheckpointItem = new UIMenuItem("~r~Checkpoint löschen");
|
||||
factionInteractionMenu.AddItem(deleteCheckpointItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,6 +268,13 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
mp.gui.chat.activate(true);
|
||||
globalData.InMenu = false;
|
||||
break;
|
||||
case deleteCheckpointItem:
|
||||
factionInteractionMenu.Close();
|
||||
mp.gui.chat.activate(true);
|
||||
globalData.InMenu = false;
|
||||
mp.events.call("destroyMedicTaskCheckpoint");
|
||||
break;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@@ -305,7 +320,7 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
mp.game.graphics.requestStreamedTextureDict("medicimages", true);
|
||||
mp.events.callRemote("updateMedicTask", 0, tasks[index].Victim);
|
||||
mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y);
|
||||
activeCheckpoint = mp.checkpoints.new(1, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0,
|
||||
activeCheckpoint = mp.checkpoints.new(4, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0,
|
||||
{
|
||||
direction: new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 5),
|
||||
color: [255, 0, 0, 150],
|
||||
@@ -359,7 +374,7 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
mp.game.graphics.requestStreamedTextureDict("medicimages", true);
|
||||
mp.events.callRemote("updateMedicTask", 1, tasks[index].Victim);
|
||||
mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y);
|
||||
activeCheckpoint = mp.checkpoints.new(1, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0,
|
||||
activeCheckpoint = mp.checkpoints.new(4, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0,
|
||||
{
|
||||
direction: new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 5),
|
||||
color: [255, 0, 0, 150],
|
||||
@@ -389,73 +404,13 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
mp.events.add("sortFactionTasks", (sortByKey) => {
|
||||
if (firstSorting) {
|
||||
sortText = "Nach Uhrzeit";
|
||||
firstSorting = false;
|
||||
//mp.gui.chat.push("Init Sort");
|
||||
return;
|
||||
} else {
|
||||
if (sortByKey) {
|
||||
if (sorting < 1) {
|
||||
sorting++;
|
||||
} else {
|
||||
sorting = 0;
|
||||
}
|
||||
|
||||
switch (sorting) {
|
||||
case 0: //Standartsortierung
|
||||
|
||||
reviveTaskMenuMedic.Close();
|
||||
factionInteractionMenu.Close();
|
||||
sortText = "Nach Uhrzeit";
|
||||
mp.events.call("showMedicTasks", 0, JSON.stringify(initTasks));
|
||||
break;
|
||||
|
||||
case 1: //Sortierung nach Metern (aufsteigend)
|
||||
for (var d = 0; d < tasks.length; d++) {
|
||||
for (var e = 0; e < tasks.length - 1; e++) {
|
||||
if (getDistance1(e) > getDistance2(e + 1)) {
|
||||
var tempTask = tasks[e];
|
||||
tasks[e] = tasks[e + 1];
|
||||
tasks[e + 1] = tempTask;
|
||||
mp.gui.chat.push("SWITCH");
|
||||
}
|
||||
}
|
||||
}
|
||||
reviveTaskMenuMedic.Close();
|
||||
factionInteractionMenu.Close();
|
||||
sortText = "Entfernung aufsteigend";
|
||||
mp.events.call("showMedicTasks", 0, JSON.stringify(tasks));
|
||||
break;
|
||||
|
||||
//case 2: //Sortierung nach Metern (absteigend)
|
||||
// mp.gui.chat.push("Sorting 2");
|
||||
// sortText = "Entfernung absteigend";
|
||||
// break;
|
||||
//case 3: //Sortierung nach Zeit (aufsteigend)
|
||||
// mp.gui.chat.push("Sorting 3");
|
||||
// sortText = "Restzeit aufsteigend";
|
||||
// break;
|
||||
//case 4: //Sortierung nach Zeit (absteigend)
|
||||
// mp.gui.chat.push("Sorting 4");
|
||||
// sortText = "Restzeit absteigend";
|
||||
// break;
|
||||
}
|
||||
}
|
||||
mp.events.add('playerEnterCheckpoint', (activeCheckpoint) => {
|
||||
if (activeTask.Type == 1) {
|
||||
activeCheckpoint.destroy();
|
||||
activeCheckpoint = null;
|
||||
activeTask = null;
|
||||
timeLeft = null;
|
||||
}
|
||||
});*/
|
||||
|
||||
function getDistance1(index) {
|
||||
return mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, newTasks[index].Position.x, newTasks[index].Position.y, newTasks[index].Position.z, true).toFixed(2);
|
||||
}
|
||||
function getDistance2(index) {
|
||||
return mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, newTasks[index].Position.x, newTasks[index].Position.y, newTasks[index].Position.z, true).toFixed(2);
|
||||
}
|
||||
|
||||
mp.events.add("cutMedicEarnings", () => {
|
||||
deadRespawned = true;
|
||||
});
|
||||
|
||||
mp.events.add("destroyMedicTaskCheckpoint", () => {
|
||||
@@ -464,24 +419,6 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
activeCheckpoint = null;
|
||||
activeTask = null;
|
||||
timeLeft = null;
|
||||
mp.events.callRemote("MedicTaskTimeout");
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add('playerEnterCheckpoint', (activeCheckpoint) => {
|
||||
if (deadRespawned == true) {
|
||||
activeCheckpoint.destroy();
|
||||
activeCheckpoint = null;
|
||||
mp.events.callRemote("PayCutMedicEarnings");
|
||||
activeTask = null;
|
||||
deadRespawned = false;
|
||||
timeLeft = null;
|
||||
} else if (activeTask.Type == 1) {
|
||||
activeCheckpoint.destroy();
|
||||
activeCheckpoint = null;
|
||||
mp.events.callRemote("delHealTaskAsMedic", activeTask.Victim);
|
||||
activeTask = null;
|
||||
timeLeft = null;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -491,7 +428,23 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
}
|
||||
});
|
||||
|
||||
mp.events.add('render', () => {
|
||||
mp.events.add('updateHealCheckpoint', (xPos, yPos, zPos) => {
|
||||
if (activeTask && activeTask.Type == 1) {
|
||||
activeCheckpoint.destroy();
|
||||
activeCheckpoint = null;
|
||||
activeCheckpoint = mp.checkpoints.new(4, new mp.Vector3(xPos, yPos, zPos - 2), 3.0,
|
||||
{
|
||||
direction: new mp.Vector3(xPos, yPos, zPos - 5),
|
||||
color: [255, 0, 0, 150],
|
||||
visible: true,
|
||||
dimension: 0
|
||||
});
|
||||
|
||||
mp.game.ui.setNewWaypoint(xPos, yPos);
|
||||
}
|
||||
});
|
||||
|
||||
function renderMedicGui() {
|
||||
if (activeTask) {
|
||||
rangeLeft = mp.game.gameplay.getDistanceBetweenCoords(player.position.x, player.position.y, player.position.z, taskFinish.x, taskFinish.y, taskFinish.z, true).toFixed(2);
|
||||
if (rangeLeft > 1.9) {
|
||||
@@ -513,18 +466,10 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
}
|
||||
}
|
||||
|
||||
var currentDate = new Date();
|
||||
|
||||
if (timeLeft != null) {
|
||||
if (deadRespawned == false) {
|
||||
//timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - activeTask.TimeLeft - 60));
|
||||
if (timeLeft < 120) mp.events.call("cutMedicEarnings");
|
||||
} else {
|
||||
//timeLeft = Math.round(Math.abs(Math.floor(currentDate.getTime() / 1000) - activeTask.TimeLeft - 120));
|
||||
if (timeLeft < 1) mp.events.call("destroyMedicTaskCheckpoint");
|
||||
}
|
||||
|
||||
if (deadRespawned == false) {
|
||||
mp.game.graphics.drawText(timeLeft + "s", [0.5, 0.85], {
|
||||
font: 7,
|
||||
color: [60, 179, 113, 255],
|
||||
@@ -545,5 +490,9 @@ export default function factionInteraction(globalData: IGlobalData) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mp.events.add('render', () => {
|
||||
renderMedicGui();
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user