From 4b81803883a07deb005285a6e378589e96564d89 Mon Sep 17 00:00:00 2001 From: hydrant Date: Tue, 18 Dec 2018 22:14:03 +0100 Subject: [PATCH] Removed map improvements, added vespucci car dealer, improved csproj, fixed vehiclesync --- Client/dlcpacks/map_improvement/dlc.rpf | 3 - Client/dlcpacks/vespucci_dealership/dlc.rpf | 3 + Client/vehiclesync/vehiclesync.js | 340 ++++++++++---------- Server/Util/VehicleSync.cs | 2 +- reallife-gamemode.csproj | 9 +- 5 files changed, 175 insertions(+), 182 deletions(-) delete mode 100644 Client/dlcpacks/map_improvement/dlc.rpf create mode 100644 Client/dlcpacks/vespucci_dealership/dlc.rpf diff --git a/Client/dlcpacks/map_improvement/dlc.rpf b/Client/dlcpacks/map_improvement/dlc.rpf deleted file mode 100644 index 2226f873..00000000 --- a/Client/dlcpacks/map_improvement/dlc.rpf +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4583d08eb98355d8640aac132b305e16504c9886fbd319aa44f10c3b7b099987 -size 13824 diff --git a/Client/dlcpacks/vespucci_dealership/dlc.rpf b/Client/dlcpacks/vespucci_dealership/dlc.rpf new file mode 100644 index 00000000..dd617679 --- /dev/null +++ b/Client/dlcpacks/vespucci_dealership/dlc.rpf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:600fcdcea0bee73c236286d15cdf6ba784791c65eaacb7131cfd4413e653f650 +size 25088 diff --git a/Client/vehiclesync/vehiclesync.js b/Client/vehiclesync/vehiclesync.js index facee9ee..70f6c2b8 100644 --- a/Client/vehiclesync/vehiclesync.js +++ b/Client/vehiclesync/vehiclesync.js @@ -50,177 +50,177 @@ mp.events.add("VehStream_PlayerExitVehicleAttempt", (entity) => { }); mp.events.add("VehStream_PlayerExitVehicle", (entity) => { - try { - if (entity === undefined || entity === null || !entity.isAVehicle()) return; - setTimeout(() => { - var Status = []; - let y = 0; - for (y = 0; y < 8; y++) { - if (entity.isDoorDamaged(y)) { - Status.push(2); - } - else if (entity.getDoorAngleRatio(y) > 0.15) { - Status.push(1); - } - else { - Status.push(0); - } - } - mp.events.callRemote("VehStream_SetDoorData", entity, Status[0], Status[1], Status[2], Status[3], Status[4], Status[5], Status[6], Status[7]); - - Status = []; - if (entity.isWindowIntact(0)) { - if (entity.getBoneIndexByName("window_rf") === -1) { - Status.push(1); - } - else { - Status.push(0); - } - } - else { - Status.push(2); - } - if (entity.isWindowIntact(1)) { - if (entity.getBoneIndexByName("window_lf") === -1) { - Status.push(1); - } - else { - Status.push(0); - } - } - else { - Status.push(2); - } - if (entity.isWindowIntact(2)) { - if (entity.getBoneIndexByName("window_rr") === -1) { - Status.push(1); - } - else { - Status.push(0); - } - } - else { - Status.push(2); - } - if (entity.isWindowIntact(3)) { - if (entity.getBoneIndexByName("window_lr") === -1) { - Status.push(1); - } - else { - Status.push(0); - } - } - else { - Status.push(2); - } - mp.events.callRemote("VehStream_SetWindowData", entity, Status[0], Status[1], Status[2], Status[3]); - - Status = []; - if (!entity.isTyreBurst(0, false)) { - Status.push(0); - } - else if (entity.isTyreBurst(0, false)) { - Status.push(1); - } - else { - Status.push(2); - } - - if (!entity.isTyreBurst(1, false)) { - Status.push(0); - } - else if (entity.isTyreBurst(1, false)) { - Status.push(1); - } - else { - Status.push(2); - } - - if (!entity.isTyreBurst(2, false)) { - Status.push(0); - } - else if (entity.isTyreBurst(2, false)) { - Status.push(1); - } - else { - Status.push(2); - } - - if (!entity.isTyreBurst(3, false)) { - Status.push(0); - } - else if (entity.isTyreBurst(3, false)) { - Status.push(1); - } - else { - Status.push(2); - } - - if (!entity.isTyreBurst(4, false)) { - Status.push(0); - } - else if (entity.isTyreBurst(4, false)) { - Status.push(1); - } - else { - Status.push(2); - } - - if (!entity.isTyreBurst(5, false)) { - Status.push(0); - } - else if (entity.isTyreBurst(5, false)) { - Status.push(1); - } - else { - Status.push(2); - } - - if (!entity.isTyreBurst(6, false)) { - Status.push(0); - } - else if (entity.isTyreBurst(6, false)) { - Status.push(1); - } - else { - Status.push(2); - } - - if (!entity.isTyreBurst(7, false)) { - Status.push(0); - } - else if (entity.isTyreBurst(7, false)) { - Status.push(1); - } - else { - Status.push(2); - } - - if (!entity.isTyreBurst(45, false)) { - Status.push(0); - } - else if (entity.isTyreBurst(45, false)) { - Status.push(1); - } - else { - Status.push(2); - } - - if (!entity.isTyreBurst(47, false)) { - Status.push(0); - } - else if (entity.isTyreBurst(47, false)) { - Status.push(1); - } - else { - Status.push(2); - } - - mp.events.callRemote("VehStream_SetWheelData", entity, Status[0], Status[1], Status[2], Status[3], Status[4], Status[5], Status[6], Status[7], Status[8], Status[9]); - }, 2500); - } catch (e) { - console.log("error: " + e); + entity = mp.vehicles.atRemoteId(entity); + if (entity === undefined || entity === null || !entity.isAVehicle()) { + mp.gui.chat.push(typeof entity); + return; } + setTimeout(() => { + var Status = []; + let y = 0; + for (y = 0; y < 8; y++) { + if (entity.isDoorDamaged(y)) { + Status.push(2); + } + else if (entity.getDoorAngleRatio(y) > 0.15) { + Status.push(1); + } + else { + Status.push(0); + } + } + mp.events.callRemote("VehStream_SetDoorData", entity, Status[0], Status[1], Status[2], Status[3], Status[4], Status[5], Status[6], Status[7]); + + Status = []; + if (entity.isWindowIntact(0)) { + if (entity.getBoneIndexByName("window_rf") === -1) { + Status.push(1); + } + else { + Status.push(0); + } + } + else { + Status.push(2); + } + if (entity.isWindowIntact(1)) { + if (entity.getBoneIndexByName("window_lf") === -1) { + Status.push(1); + } + else { + Status.push(0); + } + } + else { + Status.push(2); + } + if (entity.isWindowIntact(2)) { + if (entity.getBoneIndexByName("window_rr") === -1) { + Status.push(1); + } + else { + Status.push(0); + } + } + else { + Status.push(2); + } + if (entity.isWindowIntact(3)) { + if (entity.getBoneIndexByName("window_lr") === -1) { + Status.push(1); + } + else { + Status.push(0); + } + } + else { + Status.push(2); + } + mp.events.callRemote("VehStream_SetWindowData", entity, Status[0], Status[1], Status[2], Status[3]); + + Status = []; + if (!entity.isTyreBurst(0, false)) { + Status.push(0); + } + else if (entity.isTyreBurst(0, false)) { + Status.push(1); + } + else { + Status.push(2); + } + + if (!entity.isTyreBurst(1, false)) { + Status.push(0); + } + else if (entity.isTyreBurst(1, false)) { + Status.push(1); + } + else { + Status.push(2); + } + + if (!entity.isTyreBurst(2, false)) { + Status.push(0); + } + else if (entity.isTyreBurst(2, false)) { + Status.push(1); + } + else { + Status.push(2); + } + + if (!entity.isTyreBurst(3, false)) { + Status.push(0); + } + else if (entity.isTyreBurst(3, false)) { + Status.push(1); + } + else { + Status.push(2); + } + + if (!entity.isTyreBurst(4, false)) { + Status.push(0); + } + else if (entity.isTyreBurst(4, false)) { + Status.push(1); + } + else { + Status.push(2); + } + + if (!entity.isTyreBurst(5, false)) { + Status.push(0); + } + else if (entity.isTyreBurst(5, false)) { + Status.push(1); + } + else { + Status.push(2); + } + + if (!entity.isTyreBurst(6, false)) { + Status.push(0); + } + else if (entity.isTyreBurst(6, false)) { + Status.push(1); + } + else { + Status.push(2); + } + + if (!entity.isTyreBurst(7, false)) { + Status.push(0); + } + else if (entity.isTyreBurst(7, false)) { + Status.push(1); + } + else { + Status.push(2); + } + + if (!entity.isTyreBurst(45, false)) { + Status.push(0); + } + else if (entity.isTyreBurst(45, false)) { + Status.push(1); + } + else { + Status.push(2); + } + + if (!entity.isTyreBurst(47, false)) { + Status.push(0); + } + else if (entity.isTyreBurst(47, false)) { + Status.push(1); + } + else { + Status.push(2); + } + + mp.events.callRemote("VehStream_SetWheelData", entity, Status[0], Status[1], Status[2], Status[3], Status[4], Status[5], Status[6], Status[7], Status[8], Status[9]); + }, 2500); }); mp.events.add("VehStream_PlayerEnterVehicleAttempt", (entity, seat) => { diff --git a/Server/Util/VehicleSync.cs b/Server/Util/VehicleSync.cs index 52306c61..c4abc718 100644 --- a/Server/Util/VehicleSync.cs +++ b/Server/Util/VehicleSync.cs @@ -397,7 +397,7 @@ namespace reallife_gamemode.Server.Util data.Rotation = veh.Rotation; UpdateVehicleSyncData(veh, data); - NAPI.ClientEvent.TriggerClientEvent(player, "VehStream_PlayerExitVehicle", veh); + NAPI.ClientEvent.TriggerClientEvent(player, "VehStream_PlayerExitVehicle", veh.Handle.Value); } [ServerEvent(Event.PlayerEnterVehicle)] diff --git a/reallife-gamemode.csproj b/reallife-gamemode.csproj index 52f95c3f..4b9f02d8 100644 --- a/reallife-gamemode.csproj +++ b/reallife-gamemode.csproj @@ -7,9 +7,6 @@ true AnyCPU;x64 - - - Always @@ -34,11 +31,7 @@ ..\Bootstrapper.dll - - - - - + \ No newline at end of file