Fix spectate und Movement im Creator geht jez nich mehr

This commit is contained in:
VegaZ
2021-05-04 23:29:21 +02:00
parent 6cf20abb7b
commit 62d283600e
3 changed files with 75 additions and 10 deletions

View File

@@ -237,10 +237,13 @@ export default function charCreator(globalData: IGlobalData) {
saveItem.HighlightedBackColor = new Color(25, 118, 210);
creatorMainMenu.AddItem(saveItem);
//let cancelItem = new UIMenuItem("Abbrechen", "Setzt alle \u00c4nderungen zur\u00fcck.");
//cancelItem.BackColor = new Color(213, 0, 0);
//cancelItem.HighlightedBackColor = new Color(229, 57, 53);
//creatorMainMenu.AddItem(cancelItem);
if (isSurgery) {
let cancelItem = new UIMenuItem("Abbrechen", "Bricht die Operation ab");
cancelItem.BackColor = new Color(213, 0, 0);
cancelItem.HighlightedBackColor = new Color(229, 57, 53);
creatorMainMenu.AddItem(cancelItem);
}
creatorMainMenu.ListChange.on((item, listIndex) => {
if (item === genderItem) {
@@ -571,7 +574,7 @@ export default function charCreator(globalData: IGlobalData) {
creatorCamera.pointAtCoord(creatorCoords.cameraLookAt.x, creatorCoords.cameraLookAt.y, creatorCoords.cameraLookAt.z);
creatorCamera.setActive(true);
}
resetAppearanceMenu();
resetFeaturesMenu();
resetHairAndColorsMenu();
@@ -588,6 +591,7 @@ export default function charCreator(globalData: IGlobalData) {
localPlayer.freezePosition(true);
mp.game.cam.renderScriptCams(true, false, 0, true, false);
applyCreatorOutfit();
mp.events.callRemote("creator_GenderChange", 0);
}
});
@@ -611,5 +615,42 @@ export default function charCreator(globalData: IGlobalData) {
globalData.InMenu = false;
globalData.InMenu = false;
if (isSurgery) isSurgery = false;
}
mp.events.add("render", () => {
if (mp.cameras.exists(creatorCamera)) disableInput();
});
function disableInput() {
//WASD
mp.game.controls.disableControlAction(0, 30, true);
mp.game.controls.disableControlAction(0, 31, true);
mp.game.controls.disableControlAction(0, 32, true);
mp.game.controls.disableControlAction(0, 33, true);
mp.game.controls.disableControlAction(0, 34, true);
mp.game.controls.disableControlAction(0, 35, true);
mp.game.controls.disableControlAction(0, 266, true);
mp.game.controls.disableControlAction(0, 267, true);
mp.game.controls.disableControlAction(0, 268, true);
mp.game.controls.disableControlAction(0, 269, true);
//SPACE
mp.game.controls.disableControlAction(0, 22, true);
//R
mp.game.controls.disableControlAction(0, 140, true);
mp.game.controls.disableControlAction(0, 263, true);
//LMB
mp.game.controls.disableControlAction(0, 24, true);
mp.game.controls.disableControlAction(0, 257, true);
//LEFT CTRL
mp.game.controls.disableControlAction(0, 36, true);
//Q
mp.game.controls.disableControlAction(0, 44, true);
}
}

View File

@@ -1,12 +1,27 @@
let cam: CameraMp = mp.cameras.new('spectateCam');;
let cam: CameraMp;
let specPlayer: PlayerMp;
mp.events.add("SERVER:ADMIN_SPECTATE", (targetPlayer) => {
cam.attachTo(targetPlayer.handle, 10.0, 0.0, 10.0, true);
cam.setActive(true);
//cam.attachTo(targetPlayer.handle, 0, 1.0, 1.0, 1.0, 0, 0, 0, true, false, false, false, 0, false);
specPlayer = targetPlayer;
cam = mp.cameras.new('spectateCam');
cam.attachTo(targetPlayer.handle, 0, -4, 1.5, true);
cam.pointAt(targetPlayer.handle, 0, 0, 0, true);
cam.setActive(true);
mp.game.cam.renderScriptCams(true, false, 0, true, false);
});
mp.events.add("SERVER:ADMIN_STOP_SPECTATE", () => {
if (cam.isActive() == true) {
cam.setActive(false);
if (mp.cameras.exists(cam)) {
cam.destroy();
mp.game.cam.renderScriptCams(false, false, 0, true, false);
}
});
mp.events.add("render", () => {
if (mp.cameras.exists(cam)) {
cam.setRot(0, 0, specPlayer.getRotation(0).z, 0);
}
});