Sani Checkpoint Rework
This commit is contained in:
@@ -18,7 +18,8 @@ export default function factionInteraction(globalData: IGlobalData) {
|
|||||||
var sorting = 0;
|
var sorting = 0;
|
||||||
var firstSorting = true;
|
var firstSorting = true;
|
||||||
var activeTask = null;
|
var activeTask = null;
|
||||||
var activeCheckpoint: CheckpointMp;
|
var activeMarker: MarkerMp;
|
||||||
|
var activeColshape: ColshapeMp;
|
||||||
var taskStart;
|
var taskStart;
|
||||||
var taskFinish;
|
var taskFinish;
|
||||||
var taskRange;
|
var taskRange;
|
||||||
@@ -234,7 +235,7 @@ export default function factionInteraction(globalData: IGlobalData) {
|
|||||||
factionInteractionMenu.AddItem(fireTaskMenuMedic);
|
factionInteractionMenu.AddItem(fireTaskMenuMedic);
|
||||||
*/
|
*/
|
||||||
if (activeTask != null) {
|
if (activeTask != null) {
|
||||||
if (activeTask.Type == 1 && activeCheckpoint && mp.checkpoints.exists(activeCheckpoint)) {
|
if (activeTask.Type == 1 && activeColshape && mp.colshapes.exists(activeColshape)) {
|
||||||
deleteCheckpointItem = new UIMenuItem("~r~Checkpoint löschen");
|
deleteCheckpointItem = new UIMenuItem("~r~Checkpoint löschen");
|
||||||
factionInteractionMenu.AddItem(deleteCheckpointItem);
|
factionInteractionMenu.AddItem(deleteCheckpointItem);
|
||||||
}
|
}
|
||||||
@@ -320,13 +321,13 @@ export default function factionInteraction(globalData: IGlobalData) {
|
|||||||
mp.game.graphics.requestStreamedTextureDict("medicimages", true);
|
mp.game.graphics.requestStreamedTextureDict("medicimages", true);
|
||||||
mp.events.callRemote("updateMedicTask", 0, tasks[index].Victim);
|
mp.events.callRemote("updateMedicTask", 0, tasks[index].Victim);
|
||||||
mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y);
|
mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y);
|
||||||
activeCheckpoint = mp.checkpoints.new(4, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0,
|
activeMarker = mp.markers.new(1, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 1), 3.0,
|
||||||
{
|
{
|
||||||
direction: new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 5),
|
|
||||||
color: [255, 0, 0, 150],
|
color: [255, 0, 0, 150],
|
||||||
visible: true,
|
visible: true,
|
||||||
dimension: 0
|
dimension: 0
|
||||||
});
|
});
|
||||||
|
activeColshape = mp.colshapes.newTube(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 1, 2, 3, 0);
|
||||||
reviveTaskMenuMedic.Close();
|
reviveTaskMenuMedic.Close();
|
||||||
mp.gui.chat.activate(true);
|
mp.gui.chat.activate(true);
|
||||||
globalData.InMenu = false;
|
globalData.InMenu = false;
|
||||||
@@ -374,13 +375,13 @@ export default function factionInteraction(globalData: IGlobalData) {
|
|||||||
mp.game.graphics.requestStreamedTextureDict("medicimages", true);
|
mp.game.graphics.requestStreamedTextureDict("medicimages", true);
|
||||||
mp.events.callRemote("updateMedicTask", 1, tasks[index].Victim);
|
mp.events.callRemote("updateMedicTask", 1, tasks[index].Victim);
|
||||||
mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y);
|
mp.game.ui.setNewWaypoint(tasks[index].Position.x, tasks[index].Position.y);
|
||||||
activeCheckpoint = mp.checkpoints.new(4, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 2), 3.0,
|
activeMarker = mp.markers.new(1, new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 1), 3.0,
|
||||||
{
|
{
|
||||||
direction: new mp.Vector3(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 5),
|
|
||||||
color: [255, 0, 0, 150],
|
color: [255, 0, 0, 150],
|
||||||
visible: true,
|
visible: true,
|
||||||
dimension: 0
|
dimension: 0
|
||||||
});
|
});
|
||||||
|
activeColshape = mp.colshapes.newTube(tasks[index].Position.x, tasks[index].Position.y, tasks[index].Position.z - 1, 2, 3, 0);
|
||||||
healTaskMenuMedic.Close();
|
healTaskMenuMedic.Close();
|
||||||
mp.gui.chat.activate(true);
|
mp.gui.chat.activate(true);
|
||||||
globalData.InMenu = false;
|
globalData.InMenu = false;
|
||||||
@@ -404,19 +405,27 @@ export default function factionInteraction(globalData: IGlobalData) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mp.events.add('playerEnterCheckpoint', (activeCheckpoint) => {
|
mp.events.add('playerEnterColshape', (activeColshape) => {
|
||||||
if (activeTask.Type == 1) {
|
if (activeTask.Type == 1) {
|
||||||
activeCheckpoint.destroy();
|
activeColshape.destroy();
|
||||||
activeCheckpoint = null;
|
activeColshape = null;
|
||||||
|
if (mp.markers.exists(activeMarker)) {
|
||||||
|
activeMarker.destroy();
|
||||||
|
activeMarker = null;
|
||||||
|
}
|
||||||
activeTask = null;
|
activeTask = null;
|
||||||
timeLeft = null;
|
timeLeft = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mp.events.add("destroyMedicTaskCheckpoint", () => {
|
mp.events.add("destroyMedicTaskCheckpoint", () => {
|
||||||
if (activeCheckpoint && mp.checkpoints.exists(activeCheckpoint)) {
|
if (activeColshape && mp.colshapes.exists(activeColshape)) {
|
||||||
activeCheckpoint.destroy();
|
activeColshape.destroy();
|
||||||
activeCheckpoint = null;
|
activeColshape = null;
|
||||||
|
if (mp.markers.exists(activeMarker)) {
|
||||||
|
activeMarker.destroy();
|
||||||
|
activeMarker = null;
|
||||||
|
}
|
||||||
activeTask = null;
|
activeTask = null;
|
||||||
timeLeft = null;
|
timeLeft = null;
|
||||||
}
|
}
|
||||||
@@ -430,16 +439,13 @@ export default function factionInteraction(globalData: IGlobalData) {
|
|||||||
|
|
||||||
mp.events.add('updateHealCheckpoint', (xPos, yPos, zPos) => {
|
mp.events.add('updateHealCheckpoint', (xPos, yPos, zPos) => {
|
||||||
if (activeTask && activeTask.Type == 1) {
|
if (activeTask && activeTask.Type == 1) {
|
||||||
activeCheckpoint.destroy();
|
if (mp.colshapes.exists(activeColshape) && mp.markers.exists(activeMarker)) {
|
||||||
activeCheckpoint = null;
|
activeMarker.setCoords2(xPos, yPos, zPos, 0, 0, 0, false);
|
||||||
activeCheckpoint = mp.checkpoints.new(4, new mp.Vector3(xPos, yPos, zPos - 2), 3.0,
|
activeColshape.setCoords2(xPos, yPos, zPos, 0, 0, 0, false);
|
||||||
{
|
}
|
||||||
direction: new mp.Vector3(xPos, yPos, zPos - 5),
|
taskFinish.x = xPos;
|
||||||
color: [255, 0, 0, 150],
|
taskFinish.y = yPos;
|
||||||
visible: true,
|
taskFinish.z = zPos;
|
||||||
dimension: 0
|
|
||||||
});
|
|
||||||
|
|
||||||
mp.game.ui.setNewWaypoint(xPos, yPos);
|
mp.game.ui.setNewWaypoint(xPos, yPos);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user