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); saveItem.HighlightedBackColor = new Color(25, 118, 210);
creatorMainMenu.AddItem(saveItem); creatorMainMenu.AddItem(saveItem);
//let cancelItem = new UIMenuItem("Abbrechen", "Setzt alle \u00c4nderungen zur\u00fcck."); if (isSurgery) {
//cancelItem.BackColor = new Color(213, 0, 0); let cancelItem = new UIMenuItem("Abbrechen", "Bricht die Operation ab");
//cancelItem.HighlightedBackColor = new Color(229, 57, 53); cancelItem.BackColor = new Color(213, 0, 0);
//creatorMainMenu.AddItem(cancelItem); cancelItem.HighlightedBackColor = new Color(229, 57, 53);
creatorMainMenu.AddItem(cancelItem);
}
creatorMainMenu.ListChange.on((item, listIndex) => { creatorMainMenu.ListChange.on((item, listIndex) => {
if (item === genderItem) { 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.pointAtCoord(creatorCoords.cameraLookAt.x, creatorCoords.cameraLookAt.y, creatorCoords.cameraLookAt.z);
creatorCamera.setActive(true); creatorCamera.setActive(true);
} }
resetAppearanceMenu(); resetAppearanceMenu();
resetFeaturesMenu(); resetFeaturesMenu();
resetHairAndColorsMenu(); resetHairAndColorsMenu();
@@ -588,6 +591,7 @@ export default function charCreator(globalData: IGlobalData) {
localPlayer.freezePosition(true); localPlayer.freezePosition(true);
mp.game.cam.renderScriptCams(true, false, 0, true, false); mp.game.cam.renderScriptCams(true, false, 0, true, false);
applyCreatorOutfit(); applyCreatorOutfit();
mp.events.callRemote("creator_GenderChange", 0);
} }
}); });
@@ -611,5 +615,42 @@ export default function charCreator(globalData: IGlobalData) {
globalData.InMenu = false; globalData.InMenu = false;
globalData.InMenu = false; globalData.InMenu = false;
if (isSurgery) isSurgery = 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) => { mp.events.add("SERVER:ADMIN_SPECTATE", (targetPlayer) => {
cam.attachTo(targetPlayer.handle, 10.0, 0.0, 10.0, true); //cam.attachTo(targetPlayer.handle, 0, 1.0, 1.0, 1.0, 0, 0, 0, true, false, false, false, 0, false);
cam.setActive(true); 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", () => { mp.events.add("SERVER:ADMIN_STOP_SPECTATE", () => {
if (cam.isActive() == true) { if (mp.cameras.exists(cam)) {
cam.setActive(false); 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);
} }
}); });

View File

@@ -1796,14 +1796,23 @@ namespace ReallifeGamemode.Server.Commands
return; return;
} }
Player target; Player target;
if (targetname != null) if (targetname != null)
{ {
target = PlayerService.GetPlayerByNameOrId(targetname); target = PlayerService.GetPlayerByNameOrId(targetname);
if (target == null || !target.IsLoggedIn()) if (target == null || !target.IsLoggedIn())
{ {
ChatService.PlayerNotFound(player); ChatService.PlayerNotFound(player);
return;
}
if(target.Name == player.Name)
{
ChatService.ErrorMessage(player, "Du kannst dich nicht selbst spectaten");
return; return;
} }
player.TriggerEvent("SERVER:ADMIN_SPECTATE", target); player.TriggerEvent("SERVER:ADMIN_SPECTATE", target);
} }
else else