diff --git a/client/vehicle/main.lua b/client/vehicle/main.lua index ca2e960..394d5a9 100644 --- a/client/vehicle/main.lua +++ b/client/vehicle/main.lua @@ -1,5 +1,6 @@ local cruiseControlStatus = false local isPassenger = false +local isSeatbeltOn = false local function SetCruiseControlState(state) cruiseControlStatus = state @@ -9,6 +10,16 @@ exports("CruiseControlState", function(...) SetCruiseControlState(...) end) +local function SetSeatbeltState(state) + isSeatbeltOn = state +end + +exports("SeatbeltState",function(...) + SetSeatbeltState(...) +end) + + + if not Config.Disable.Vehicle then local inVehicle, vehicleType, playerPos = false, nil, nil local currentMileage = 0 @@ -100,6 +111,7 @@ if not Config.Disable.Vehicle then values.damage = engineHealth values.vehType = vehicleType values.driver = HUD.Data.Driver + values.defaultIndicators.seatbelt = isSeatbeltOn values.defaultIndicators.tempomat = cruiseControlStatus values.defaultIndicators.door = doorLockStatus values.defaultIndicators.light = lightState diff --git a/shared/config.lua b/shared/config.lua index 6bc68d2..5883e8f 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -37,6 +37,7 @@ Config = { ["speedo-outer-circle-color"] = "#242222", ["speedo-nooble-color"] = "#48a3cb", ["speedo-nooble-container"] = "#1f2937", + ["speedo-seatbelt-icon-color"] = "#D22B2B" }, }, Disable = { @@ -48,6 +49,7 @@ Config = { Money = false, Info = false, IndicatorSound = false, --vehicle index sound + IndicatorSeatbeltSound = false, --seatbelt sound VehicleHandlers = false, -- Engine toggle, Indicator lights MinimapOnFoot = false, Needle = true, diff --git a/web/DefaultDatas.js b/web/DefaultDatas.js index 133285d..30ead83 100644 --- a/web/DefaultDatas.js +++ b/web/DefaultDatas.js @@ -14,6 +14,7 @@ let disableDefaultConfig = { Money: false, Info: false, IndicatorSound: false, + IndicatorSeatbeltSound: false, VehicleHandlers: false, MinimapOnFoot: false, Needle: false, @@ -223,6 +224,10 @@ const speedoDefaultColors = [ name: "speedo-nooble-container", color: "#1f2937", }, + { + name: "speedo-seatbelt-icon-color", + color: "#D22B2B" + } ]; const allColors = { diff --git a/web/src/assets/Components/SettingsPanel/SettingsPanel.jsx b/web/src/assets/Components/SettingsPanel/SettingsPanel.jsx index 69a3d48..f4f8678 100644 --- a/web/src/assets/Components/SettingsPanel/SettingsPanel.jsx +++ b/web/src/assets/Components/SettingsPanel/SettingsPanel.jsx @@ -147,7 +147,7 @@ export const SettingsPanel = () =>{ return( <> -
+
diff --git a/web/src/assets/Components/SettingsPanel/pages/SpeedoTemplate.jsx b/web/src/assets/Components/SettingsPanel/pages/SpeedoTemplate.jsx index a829161..f4f7936 100644 --- a/web/src/assets/Components/SettingsPanel/pages/SpeedoTemplate.jsx +++ b/web/src/assets/Components/SettingsPanel/pages/SpeedoTemplate.jsx @@ -16,7 +16,7 @@ export const SpeedoTemplate = (props) => { return (
-
+
{(progress, i) =>
@@ -34,4 +34,4 @@ export const SpeedoTemplate = (props) => {
); -}; \ No newline at end of file +}; diff --git a/web/src/assets/Components/Speedo.css b/web/src/assets/Components/Speedo.css index 0fea3ef..0751c74 100644 --- a/web/src/assets/Components/Speedo.css +++ b/web/src/assets/Components/Speedo.css @@ -24,6 +24,7 @@ --speedo-nooble-color: #48a3cb; --speedo-nooble-container: #1f2937; --speedo-scale-size: 0.9; + --speedo-seatbelt-icon-color: #D22B2B; } /* SVG DONT'T TOUCH PLEASE THANK YOU */ @@ -162,6 +163,10 @@ fill: var(--fuel-icon-color); } +.seatbeltIconColor{ + fill: var(--speedo-seatbelt-icon-color); +} + .indexColor { fill: var(--left-right-index-color); } diff --git a/web/src/assets/Components/Speedo.jsx b/web/src/assets/Components/Speedo.jsx index 186cec9..b118390 100644 --- a/web/src/assets/Components/Speedo.jsx +++ b/web/src/assets/Components/Speedo.jsx @@ -2,6 +2,9 @@ import './Speedo.css' import {createEffect, createSignal, onCleanup, Show} from "solid-js"; import Sound from '../IndicatorSound.mp3' +import SeatbeltAlert from '../SeatbeltAlertSound.mp3'; +import SeatbeltOff from '../SeatbeltOffSound.mp3'; +import SeatbeltOn from '../SeatbeltOnSound.mp3'; import {useHudStorageState} from "../Contexts/HudStorage"; import {useSettingsStorageState} from "../Contexts/SettingsStorage"; @@ -129,6 +132,9 @@ const LightIcon = (props) => +const SeatbeltIcon = (props) => + + export const Speedo = (props) =>{ @@ -137,8 +143,9 @@ export const Speedo = (props) =>{ const settingsStorageState = useSettingsStorageState(); const settings = () => settingsStorageState.settings const defaultConfigs = () => settingsStorageState.defaultConfigs + const [checkSound, setCheckSound] = createSignal(false) const [onIndex,setOnIndex] = createSignal(false) - + const [seatbeltState, setSeatbeltState] = createSignal(false) const speedo = () => hudStorageState.speedo const indicators = () => speedo().defaultIndicators const damage = () => speedo().damageLevel @@ -262,6 +269,12 @@ export const Speedo = (props) =>{ } const IndicatorSound = new Audio(Sound); + const SeatbeltAlertSound = new Audio(SeatbeltAlert) + const SeatbeltOnSound = new Audio(SeatbeltOn) + const SeatbeltOffSound = new Audio(SeatbeltOff) + SeatbeltOnSound.volume = 0.5 + SeatbeltOffSound.volume = 0.5 + SeatbeltAlertSound.volume = 0.2 IndicatorSound.volume = 0.2 const indexTimer = setInterval(()=>{ if((indicators().leftIndex || indicators().rightIndex)){ @@ -272,6 +285,14 @@ export const Speedo = (props) =>{ } setOnIndex(onIndex => !onIndex) } + if(!indicators().seatbelt){ + if(!settings().IndicatorSeatbeltSound && show()){ + if(!props?.template && !checkSound()){ + SeatbeltAlertSound.play(); + } + } + setSeatbeltState(seatbeltState => !seatbeltState) + } },500) onCleanup(() => clearInterval(indexTimer)); @@ -281,6 +302,20 @@ export const Speedo = (props) =>{ const elementsTemplate = document.querySelectorAll('#templateSpeedoContainer .nob'); const currentSpeed = VehType.AIR !== vehType() ? speed() : rpm() + if(!settings().IndicatorSeatbeltSound){ + if(indicators().seatbelt && !checkSound()){ + if(!checkSound()){ + SeatbeltOnSound.play(); + setCheckSound(true) + } + } + + if(checkSound() && !indicators().seatbelt){ + SeatbeltOffSound.play(); + setCheckSound(false) + } + } + if(!settings().Needle){ const speedNoble = document.querySelectorAll('#speedoContainer .speedNobe') if(speedNoble.length > 0){ @@ -312,7 +347,6 @@ export const Speedo = (props) =>{ } }) - /* HUD COMPONENTS */ const VehicleHud = () =>{ return( @@ -374,6 +408,13 @@ export const Speedo = (props) =>{ return(
+ + +
+ +
+
+
diff --git a/web/src/assets/Contexts/HudStorage.jsx b/web/src/assets/Contexts/HudStorage.jsx index 5542387..bc6f8e6 100644 --- a/web/src/assets/Contexts/HudStorage.jsx +++ b/web/src/assets/Contexts/HudStorage.jsx @@ -55,6 +55,7 @@ const initialState = { vehType: "LAND", driver: false, defaultIndicators: { + seatbelt: false, tempomat: true, door: false, light: false, diff --git a/web/src/assets/Contexts/SettingsStorage.jsx b/web/src/assets/Contexts/SettingsStorage.jsx index 6fedf16..e292450 100644 --- a/web/src/assets/Contexts/SettingsStorage.jsx +++ b/web/src/assets/Contexts/SettingsStorage.jsx @@ -141,6 +141,10 @@ const initialState = { name: "speedo-nooble-container", color: "#1f2937" }, + { + name: "speedo-seatbelt-icon-color", + color: "#D22B2B" + } ], settings:{ Status: false, @@ -151,6 +155,7 @@ const initialState = { Money: false, Info: false, IndicatorSound: false, + IndicatorSeatbeltSound: false, VehicleHandlers:false, MinimapOnFoot:false, Needle: false, @@ -167,6 +172,7 @@ const initialState = { Money: false, Info: false, IndicatorSound: false, + IndicatorSeatbeltSound: false, VehicleHandlers:false, MinimapOnFoot:false, Needle:false, @@ -263,7 +269,6 @@ export default function SettingsStorage(props){ const currentSelectedMenu = store.selectedMenuName ? store.selectedMenuName.toLowerCase() : 'status' const currentPickedColor = store.pickedColor const currentSelectedCircleName = store.selectedElementName - setStore( `${currentSelectedMenu}Colors`, currentStatus => currentStatus.name === currentSelectedCircleName, @@ -299,7 +304,7 @@ export default function SettingsStorage(props){ Object.keys(colors).forEach((color)=>{ r.style.setProperty(`--${color}`,colors[color]) - }) + }) } diff --git a/web/src/assets/SeatbeltAlertSound.mp3 b/web/src/assets/SeatbeltAlertSound.mp3 new file mode 100644 index 0000000..c9e7583 Binary files /dev/null and b/web/src/assets/SeatbeltAlertSound.mp3 differ diff --git a/web/src/assets/SeatbeltOffSound.mp3 b/web/src/assets/SeatbeltOffSound.mp3 new file mode 100644 index 0000000..df12910 Binary files /dev/null and b/web/src/assets/SeatbeltOffSound.mp3 differ diff --git a/web/src/assets/SeatbeltOnSound.mp3 b/web/src/assets/SeatbeltOnSound.mp3 new file mode 100644 index 0000000..6b7fc84 Binary files /dev/null and b/web/src/assets/SeatbeltOnSound.mp3 differ diff --git a/web/src/assets/translate.json b/web/src/assets/translate.json index 1201cba..794f1a2 100644 --- a/web/src/assets/translate.json +++ b/web/src/assets/translate.json @@ -42,7 +42,8 @@ "speedo-outer-circle-color": "speedo outer circle color", "speedo-nooble-color": "speedo nooble color", "speedo-nooble-container": "speedo nooble container", - "resize-speedo": "resize speedo" + "resize-speedo": "resize speedo", + "speedo-seatbelt-icon-color": "speedo seatbelt icon color" }, "Settings": { "status": "Status HUD ON/OFF", @@ -53,6 +54,7 @@ "money": "Money HUD ON/OFF", "info": "Info HUD ON/OFF", "indicatorsound": "Indicator sound ON/OFF", + "indicatorseatbeltsound":"Seatbelt sound ON/OFF", "minimaponfoot": "Minimap on foot ON/OFF", "vehiclehandlers":"Vehicle handlers(Engine toggle, Indicator lights) ON/OFF", "needle": "Needle ON/OFF", @@ -107,7 +109,8 @@ "speedo-outer-circle-color": "Tacho Farbe", "speedo-nooble-color": "Tacho Nooble Farbe", "speedo-nooble-container": "Tacho Noble container", - "resize-speedo": "resize speedo" + "resize-speedo": "resize speedo", + "speedo-seatbelt-icon-color": "speedo seatbelt icon color" }, "Settings": { "status": "Status HUD AN/AUS", @@ -118,6 +121,7 @@ "money": "Geld HUD AN/AUS", "info": "Info HUD AN/AUS", "indicatorsound": "Blinker Ton AN/AUS", + "indicatorseatbeltsound":"Seatbelt sound ON/OFF", "minimaponfoot": "Minimap zu Fuß AN/AUS", "vehiclehandlers":"Fahrzeug Infos(Motor An/Ausschalten, Blinker) AN/AUS", "needle": "Nadel AN/AUS", @@ -172,7 +176,8 @@ "speedo-outer-circle-color": "Mérőegység keret színe", "speedo-nooble-color": "Sebességmérő tű szín", "speedo-nooble-container": "Sebességmérő tű körlap színe", - "resize-speedo": "Sebességmérő átméretezése" + "resize-speedo": "Sebességmérő átméretezése", + "speedo-seatbelt-icon-color": "Biztonsági öv ikon színe" }, "Settings": { "status": "Státusz HUD BE/KI", @@ -183,6 +188,7 @@ "money": "Pénz HUD BE/KI", "info": "Infó HUD BE/KI", "indicatorsound": "Indikátor hang BE/KI", + "indicatorseatbeltsound":"Biztonsági öv hang BE/KI", "minimaponfoot": "Minimap járműn kívül BE/KI", "vehiclehandlers": "Jármű opciók(Motor indítás, Indexek) BE/KI", "needle": "Sebességmérő tű BE/KI", @@ -237,7 +243,8 @@ "speedo-outer-circle-color": "boja kruga brzinometra", "speedo-nooble-color": "nooble boja brzinometra", "speedo-nooble-container": "brzinometar nooble container", - "resize-speedo": "Speedo resize" + "resize-speedo": "Speedo resize", + "speedo-seatbelt-icon-color": "speedo seatbelt icon color" }, "Settings": { "status": "Status HUD ON/OFF", @@ -248,6 +255,7 @@ "money": "Novac HUD ON/OFF", "info": "Info HUD ON/OFF", "indicatorsound": "Zvukovi Indikatora ON/OFF", + "indicatorseatbeltsound":"Seatbelt sound ON/OFF", "minimaponfoot": "Minimapa van vozila ON/OFF", "vehiclehandlers":"Delovi Vozila (Motor, Svetla) ON/OFF", "needle": "Igla ON/OFF", @@ -301,7 +309,8 @@ "speedo-background-color": "snelheidsmeter achtergrond kleur", "speedo-outer-circle-color": "kleur snelheidsmeter buitenste cirkel", "speedo-nooble-color": "kleur snelheidsmeter nooble", - "speedo-nooble-container": "snelheidsmeter nooble container" + "speedo-nooble-container": "snelheidsmeter nooble container", + "speedo-seatbelt-icon-color": "speedo seatbelt icon color" }, "Settings": { "status": "Status HUD AAN/UIT", @@ -312,6 +321,7 @@ "money": "Geld HUD AAN/UIT", "info": "Info HUD AAN/UIT", "indicatorsound": "Indicator geluid AAN/UIT", + "indicatorseatbeltsound":"Seatbelt sound ON/OFF", "minimaponfoot": "Minimap te voet AAN/UIT", "vehiclehandlers":"Voertuig handlers(Motor toggle, Indicator lichten) AAN/UIT", "needle": "Naald AAN/UIT", @@ -365,7 +375,8 @@ "speedo-background-color": "Couleur arrière plan", "speedo-outer-circle-color": "couleur du cercle extérieur", "speedo-nooble-color": "couleur de l'aguiller", - "speedo-nooble-container": "couleur fixation aiguille" + "speedo-nooble-container": "couleur fixation aiguille", + "speedo-seatbelt-icon-color": "speedo seatbelt icon color" }, "Settings": { "status": "HUD Status ON/OFF", @@ -376,6 +387,7 @@ "money": "HUD Argent ON/OFF", "info": "Info HUD ON/OFF", "indicatorsound": "Sons Clignotant ON/OFF", + "indicatorseatbeltsound":"Seatbelt sound ON/OFF", "minimaponfoot": "Minimap à piedt ON/OFF", "vehiclehandlers":"Véhicule (Moteur, clignotants) ON/OFF", "needle": "Aiguille compteur ON/OFF",