fix: Flaschenwahl im d4rk_lib-Design (#158)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
79f468d1aa
commit
8eb1ebbdef
3 files changed
+18
-17
No files matched your search
+14
-15
@@ -193,31 +193,30 @@ end
|
||||
local function chooseTank(tanks)
|
||||
if #tanks == 1 then return tanks[1] end
|
||||
|
||||
local selection = promise.new()
|
||||
local options = {}
|
||||
-- Im d4rk_lib-Design statt lib.registerContext (d4rk-rp-planung CLAUDE.md
|
||||
-- "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
|
||||
local tank = tanks[i]
|
||||
options[i] = {
|
||||
title = tank.label,
|
||||
description = locale('info.tank_remaining', formatTime(tank.oxygen),
|
||||
eintraege[i] = {
|
||||
id = tostring(i),
|
||||
titel = tank.label,
|
||||
unterzeile = locale('info.tank_remaining', formatTime(tank.oxygen),
|
||||
math.floor(tank.oxygen / tank.capacity * 100),
|
||||
tank.gas or '?', math.floor(tank.maxDepth or 0)),
|
||||
icon = 'fa-solid fa-bottle-water',
|
||||
onSelect = function() selection:resolve(tank) end
|
||||
symbol = 'wind',
|
||||
aktionen = { { id = 'waehlen', label = locale('menu.use_tank'), art = 'primaer' } },
|
||||
}
|
||||
end
|
||||
|
||||
lib.registerContext({
|
||||
id = 'd4rk_divegear_tanks',
|
||||
title = locale('menu.choose_tank'),
|
||||
options = options,
|
||||
onExit = function() selection:resolve(nil) end
|
||||
local wahl = exports.d4rk_lib:menu({
|
||||
titel = locale('menu.choose_tank'),
|
||||
eintraege = eintraege,
|
||||
})
|
||||
|
||||
lib.showContext('d4rk_divegear_tanks')
|
||||
|
||||
return Citizen.Await(selection)
|
||||
return type(wahl) == 'table' and tanks[tonumber(wahl.eintrag) or -1] or nil
|
||||
end
|
||||
|
||||
lib.callback.register('d4rk_divegear:client:fillTank', function(tanks)
|
||||
|
||||
+2
-1
@@ -35,7 +35,8 @@
|
||||
"patrone_einsetzen": "Patrone wird eingesetzt..."
|
||||
},
|
||||
"menu": {
|
||||
"choose_tank": "Tauchflasche wählen"
|
||||
"choose_tank": "Tauchflasche wählen",
|
||||
"use_tank": "Diese Flasche"
|
||||
},
|
||||
"hud": {
|
||||
"air": "Luft",
|
||||
|
||||
+2
-1
@@ -35,7 +35,8 @@
|
||||
"patrone_einsetzen": "Inserting cartridge..."
|
||||
},
|
||||
"menu": {
|
||||
"choose_tank": "Choose an air tank"
|
||||
"choose_tank": "Choose an air tank",
|
||||
"use_tank": "Use this tank"
|
||||
},
|
||||
"hud": {
|
||||
"air": "Air",
|
||||
|
||||
Reference in new issue
Block a user