Compare commits

..
4 Commits
Author SHA1 Message Date
D4rkst3r d1edad425f merge: fix/flaschenwahl-unser-design 2026-10-10 18:41:40 +02:00
D4rkst3randClaude Opus 5.5 8eb1ebbdef fix: Flaschenwahl im d4rk_lib-Design (#158)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 18:41:40 +02:00
D4rkst3r 79f468d1aa merge: fix/befehle-f8 (#81) 2026-10-07 12:49:19 +02:00
D4rkst3randClaude Opus 5.5 056215d0ae fix: Befehlsausgabe in die F8-Konsole statt nur in die Serverkonsole (#81)
/tauchartikel und /tauchstand laufen jetzt ueber Diagnosebefehl: die Ausgabe geht an die F8-Konsole
des Aufrufers. Reine Konsolenbefehle sind fuer Admins im Spiel offen
(restricted group.admin, Betreiber 07.10.2026). print -> sag in den
betroffenen Dateien; ausserhalb eines Diagnosebefehls ist sag ein print.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-07 12:49:19 +02:00
5 changed files with 40 additions and 39 deletions

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)
+1
View File
@@ -14,6 +14,7 @@ shared_scripts {
} }
server_scripts { server_scripts {
'@d4rk_lib/server/diagnose_shared.lua',
'server/main.lua', 'server/main.lua',
-- /tauchartikel: die Items in d4rk_item anlegen, nur auf Zuruf (28.09.2026). -- /tauchartikel: die Items in d4rk_item anlegen, nur auf Zuruf (28.09.2026).
'server/artikel.lua', 'server/artikel.lua',
+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",
+21 -22
View File
@@ -10,7 +10,8 @@
Geloeschtes zurueck"). Vorhandene Items werden NICHT angefasst - was im Geloeschtes zurueck"). Vorhandene Items werden NICHT angefasst - was im
Panel gepflegt ist, gewinnt. Panel gepflegt ist, gewinnt.
NUR AN DER SERVERKONSOLE (restricted, source 0). SERVERKONSOLE ODER ADMIN IM SPIEL (Diagnosebefehl, restricted group.admin,
seit 07.10.2026 - vorher nur source 0; Ausgabe in die F8-Konsole, #81).
Taucherflasche Kleidung (Kleiderladen, d4rk_garment -> item). Traegt Taucherflasche Kleidung (Kleiderladen, d4rk_garment -> item). Traegt
die Patrone in der Metadata. Gewicht GESETZT: Geraet die Patrone in der Metadata. Gewicht GESETZT: Geraet
@@ -81,7 +82,7 @@ local function kleidungAnlegen()
local ok, zeilen = pcall(function() return exports[ITEMS]:adminGarmentList() end) local ok, zeilen = pcall(function() return exports[ITEMS]:adminGarmentList() end)
if not ok or type(zeilen) ~= 'table' then if not ok or type(zeilen) ~= 'table' then
print('^1 Kleidung: adminGarmentList antwortet nicht - UNGUELTIG, nichts angelegt.^7') sag('^1 Kleidung: adminGarmentList antwortet nicht - UNGUELTIG, nichts angelegt.^7')
return return
end end
@@ -99,7 +100,7 @@ local function kleidungAnlegen()
local name = ('%s %s %s:%d'):format(k.pedset, k.komponente, k.collection, k.drawable) local name = ('%s %s %s:%d'):format(k.pedset, k.komponente, k.collection, k.drawable)
if vorhanden then if vorhanden then
print((' Kleidung %-34s vorhanden (Item %s)%s'):format(name, tostring(vorhanden.item), sag((' Kleidung %-34s vorhanden (Item %s)%s'):format(name, tostring(vorhanden.item),
vorhanden.item == k.item and '' or ' ^3- soll ' .. k.item .. ', im Panel pruefen^7')) vorhanden.item == k.item and '' or ' ^3- soll ' .. k.item .. ', im Panel pruefen^7'))
else else
local okC, erfolg, grund = pcall(function() local okC, erfolg, grund = pcall(function()
@@ -110,27 +111,26 @@ local function kleidungAnlegen()
}) })
end) end)
print((' Kleidung %-34s %s'):format(name, sag((' Kleidung %-34s %s'):format(name,
(okC and erfolg == true) and '^2angelegt -> ' .. k.item .. '^7' (okC and erfolg == true) and '^2angelegt -> ' .. k.item .. '^7'
or ('^1FEHLER: %s^7'):format(okC and tostring(grund) or tostring(erfolg)))) or ('^1FEHLER: %s^7'):format(okC and tostring(grund) or tostring(erfolg))))
end end
end end
end end
RegisterCommand('tauchartikel', function(source, args) Diagnosebefehl('tauchartikel', { restricted = 'group.admin' }, function(source, args)
if source ~= 0 then return end
local nachziehen = args[1] == 'nachziehen' local nachziehen = args[1] == 'nachziehen'
if GetResourceState(ITEMS) ~= 'started' then if GetResourceState(ITEMS) ~= 'started' then
print('^1[d4rk_divegear] tauchartikel: d4rk_items laeuft nicht - nichts angelegt.^7') sag('^1[d4rk_divegear] tauchartikel: d4rk_items laeuft nicht - nichts angelegt.^7')
return return
end end
local ok, zeilen = pcall(function() return exports[ITEMS]:adminItemList() end) local ok, zeilen = pcall(function() return exports[ITEMS]:adminItemList() end)
if not ok or type(zeilen) ~= 'table' then if not ok or type(zeilen) ~= 'table' then
print('^1[d4rk_divegear] tauchartikel: adminItemList antwortet nicht - UNGUELTIG, nichts angelegt.^7') sag('^1[d4rk_divegear] tauchartikel: adminItemList antwortet nicht - UNGUELTIG, nichts angelegt.^7')
return return
end end
@@ -140,11 +140,11 @@ RegisterCommand('tauchartikel', function(source, args)
-- GEGENPROBE: eine leere Liste hiesse "d4rk_items kennt kein einziges -- GEGENPROBE: eine leere Liste hiesse "d4rk_items kennt kein einziges
-- Item" - das ist nie wahr, sondern eine kaputte Antwort. -- Item" - das ist nie wahr, sondern eine kaputte Antwort.
if next(da) == nil then if next(da) == nil then
print('^1[d4rk_divegear] tauchartikel: adminItemList lieferte 0 Items - UNGUELTIG, nichts angelegt.^7') sag('^1[d4rk_divegear] tauchartikel: adminItemList lieferte 0 Items - UNGUELTIG, nichts angelegt.^7')
return return
end end
print(('[d4rk_divegear] tauchartikel: %d Items in d4rk_item bekannt.'):format(#zeilen)) sag(('[d4rk_divegear] tauchartikel: %d Items in d4rk_item bekannt.'):format(#zeilen))
for _, it in ipairs(liste()) do for _, it in ipairs(liste()) do
local sollExport = it.patrone and EXPORT or nil local sollExport = it.patrone and EXPORT or nil
@@ -155,9 +155,9 @@ RegisterCommand('tauchartikel', function(source, args)
local passt = tonumber(z.consume) == 0 and istExport == sollExport local passt = tonumber(z.consume) == 0 and istExport == sollExport
if passt then if passt then
print((' %-20s vorhanden, passt'):format(it.name)) sag((' %-20s vorhanden, passt'):format(it.name))
elseif not nachziehen then elseif not nachziehen then
print((' %-20s ^3vorhanden, consume %s / Export %s - soll 0 / %s: tauchartikel nachziehen^7') sag((' %-20s ^3vorhanden, consume %s / Export %s - soll 0 / %s: tauchartikel nachziehen^7')
:format(it.name, tostring(z.consume), tostring(istExport), tostring(sollExport))) :format(it.name, tostring(z.consume), tostring(istExport), tostring(sollExport)))
else else
local w = {} local w = {}
@@ -168,7 +168,7 @@ RegisterCommand('tauchartikel', function(source, args)
local okU, erfolg, grund = pcall(function() return exports[ITEMS]:adminItemUpdate(0, z.id, w) end) local okU, erfolg, grund = pcall(function() return exports[ITEMS]:adminItemUpdate(0, z.id, w) end)
print((' %-20s %s'):format(it.name, sag((' %-20s %s'):format(it.name,
(okU and erfolg == true) and '^2nachgezogen (consume 0)^7' (okU and erfolg == true) and '^2nachgezogen (consume 0)^7'
or ('^1FEHLER: %s^7'):format(okU and tostring(grund) or tostring(erfolg)))) or ('^1FEHLER: %s^7'):format(okU and tostring(grund) or tostring(erfolg))))
end end
@@ -187,16 +187,16 @@ RegisterCommand('tauchartikel', function(source, args)
local okC, erfolg, grund = pcall(function() return exports[ITEMS]:adminItemCreate(0, werte) end) local okC, erfolg, grund = pcall(function() return exports[ITEMS]:adminItemCreate(0, werte) end)
print((' %-20s %s'):format(it.name, sag((' %-20s %s'):format(it.name,
(okC and erfolg == true) and '^2angelegt^7' (okC and erfolg == true) and '^2angelegt^7'
or ('^1FEHLER: %s^7'):format(okC and tostring(grund) or tostring(erfolg)))) or ('^1FEHLER: %s^7'):format(okC and tostring(grund) or tostring(erfolg))))
end end
end end
kleidungAnlegen() kleidungAnlegen()
end, true) end)
--[[ --[[
/tauchstand <id> - WAS LIEGT IN DEN SLOTS? (29.09.2026, nur Serverkonsole) /tauchstand <id> - WAS LIEGT IN DEN SLOTS? (29.09.2026; seit 07.10.2026 auch Admins im Spiel, F8)
Betreiber: "nachdem er durchgelaufen ist sagt er du traegst keine Betreiber: "nachdem er durchgelaufen ist sagt er du traegst keine
taucherflasche". getWorn (server/main.lua) liest rigSlot und maskSlot - taucherflasche". getWorn (server/main.lua) liest rigSlot und maskSlot -
@@ -204,23 +204,22 @@ end, true)
Patrone. Ein `clothing` mit der richtigen Kennung heisst: vor dem Patrone. Ein `clothing` mit der richtigen Kennung heisst: vor dem
/tauchartikel-Eintrag gekauft, die Optik stimmt, das Item nicht. /tauchartikel-Eintrag gekauft, die Optik stimmt, das Item nicht.
]] ]]
RegisterCommand('tauchstand', function(source, args) Diagnosebefehl('tauchstand', { restricted = 'group.admin' }, function(source, args)
if source ~= 0 then return end
local ziel = tonumber(args[1]) local ziel = tonumber(args[1])
if not ziel or not GetPlayerName(ziel) then if not ziel or not GetPlayerName(ziel) then
print('[d4rk_divegear] tauchstand <server-id> - Spieler nicht gefunden.') sag('[d4rk_divegear] tauchstand <server-id> - Spieler nicht gefunden.')
return return
end end
print(('[d4rk_divegear] tauchstand %d:'):format(ziel)) sag(('[d4rk_divegear] tauchstand %d:'):format(ziel))
for _, s in ipairs({ { 'Flasche', shared.rigSlot, shared.rigItem }, { 'Maske', shared.maskSlot, shared.maskItem } }) do for _, s in ipairs({ { 'Flasche', shared.rigSlot, shared.rigItem }, { 'Maske', shared.maskSlot, shared.maskItem } }) do
local slot = exports.d4rk_inventory:GetSlot(ziel, s[2]) local slot = exports.d4rk_inventory:GetSlot(ziel, s[2])
local m = slot and slot.metadata or {} local m = slot and slot.metadata or {}
print((' %-8s Slot %d: %s (soll %s) garment %s patrone %s oxygen %s'):format(s[1], s[2], sag((' %-8s Slot %d: %s (soll %s) garment %s patrone %s oxygen %s'):format(s[1], s[2],
slot and slot.name or '<leer>', s[3], tostring(m.garment), tostring(m.patrone), tostring(m.oxygen))) slot and slot.name or '<leer>', s[3], tostring(m.garment), tostring(m.patrone), tostring(m.oxygen)))
end end
end, true) end)