merge: fix/flaschenwahl-unser-design

This commit is contained in:
D4rkst3r committed 2026-10-10 18:41:40 +02:00
commit d1edad425f
3 files changed
+18 -17

No files matched your search

+14 -15
View File
@@ -193,31 +193,30 @@ end
local function chooseTank(tanks) local function chooseTank(tanks)
if #tanks == 1 then return tanks[1] end if #tanks == 1 then return tanks[1] end
local selection = promise.new() -- Im d4rk_lib-Design statt lib.registerContext (d4rk-rp-planung CLAUDE.md
local options = {} -- "Unser Design, nicht das von ox_lib", 10.10.2026). Beendet wird mit dem
-- Knopf je Flasche oder ESC (= nil); blockiert wie vorher das promise.
local eintraege = {}
for i = 1, #tanks do for i = 1, #tanks do
local tank = tanks[i] local tank = tanks[i]
options[i] = { eintraege[i] = {
title = tank.label, id = tostring(i),
description = locale('info.tank_remaining', formatTime(tank.oxygen), titel = tank.label,
unterzeile = locale('info.tank_remaining', formatTime(tank.oxygen),
math.floor(tank.oxygen / tank.capacity * 100), math.floor(tank.oxygen / tank.capacity * 100),
tank.gas or '?', math.floor(tank.maxDepth or 0)), tank.gas or '?', math.floor(tank.maxDepth or 0)),
icon = 'fa-solid fa-bottle-water', symbol = 'wind',
onSelect = function() selection:resolve(tank) end aktionen = { { id = 'waehlen', label = locale('menu.use_tank'), art = 'primaer' } },
} }
end end
lib.registerContext({ local wahl = exports.d4rk_lib:menu({
id = 'd4rk_divegear_tanks', titel = locale('menu.choose_tank'),
title = locale('menu.choose_tank'), eintraege = eintraege,
options = options,
onExit = function() selection:resolve(nil) end
}) })
lib.showContext('d4rk_divegear_tanks') return type(wahl) == 'table' and tanks[tonumber(wahl.eintrag) or -1] or nil
return Citizen.Await(selection)
end end
lib.callback.register('d4rk_divegear:client:fillTank', function(tanks) lib.callback.register('d4rk_divegear:client:fillTank', function(tanks)
+2 -1
View File
@@ -35,7 +35,8 @@
"patrone_einsetzen": "Patrone wird eingesetzt..." "patrone_einsetzen": "Patrone wird eingesetzt..."
}, },
"menu": { "menu": {
"choose_tank": "Tauchflasche wählen" "choose_tank": "Tauchflasche wählen",
"use_tank": "Diese Flasche"
}, },
"hud": { "hud": {
"air": "Luft", "air": "Luft",
+2 -1
View File
@@ -35,7 +35,8 @@
"patrone_einsetzen": "Inserting cartridge..." "patrone_einsetzen": "Inserting cartridge..."
}, },
"menu": { "menu": {
"choose_tank": "Choose an air tank" "choose_tank": "Choose an air tank",
"use_tank": "Use this tank"
}, },
"hud": { "hud": {
"air": "Air", "air": "Air",