ed
This commit is contained in:
parent
fdc046e4af
commit
a82f87f961
2 changed files with 48 additions and 34 deletions
|
|
@ -72,32 +72,46 @@ local function SelectBait()
|
|||
return availableBaits[1]
|
||||
end
|
||||
|
||||
-- Create a menu for bait selection
|
||||
-- Create a menu for bait selection using lib.registerMenu instead
|
||||
local options = {}
|
||||
for _, bait in pairs(availableBaits) do
|
||||
table.insert(options, {
|
||||
title = bait.label,
|
||||
description = 'Use as fishing bait',
|
||||
metadata = {
|
||||
{label = 'Catch Bonus', value = '+' .. bait.catchBonus .. '%'},
|
||||
{label = 'Loss Chance', value = bait.loseChance .. '%'}
|
||||
}
|
||||
description = 'Catch Bonus: +' .. bait.catchBonus .. '% | Loss Chance: ' .. bait.loseChance .. '%'
|
||||
})
|
||||
end
|
||||
|
||||
local selectedIndex = lib.showContext('bait_selection_menu', {
|
||||
local selectedBait = nil
|
||||
|
||||
lib.registerMenu({
|
||||
id = 'bait_selection_menu',
|
||||
title = 'Select Fishing Bait',
|
||||
options = options
|
||||
position = 'top-right',
|
||||
options = options,
|
||||
onSelect = function(selected)
|
||||
selectedBait = availableBaits[selected]
|
||||
end,
|
||||
onClose = function()
|
||||
-- Do nothing, selectedBait will remain nil
|
||||
end
|
||||
})
|
||||
|
||||
if selectedIndex then
|
||||
return availableBaits[selectedIndex]
|
||||
else
|
||||
return nil
|
||||
lib.showMenu('bait_selection_menu')
|
||||
|
||||
-- Wait for selection with a timeout
|
||||
local startTime = GetGameTimer()
|
||||
while selectedBait == nil do
|
||||
Wait(100)
|
||||
-- Timeout after 15 seconds
|
||||
if GetGameTimer() - startTime > 15000 then
|
||||
return availableBaits[1] -- Default to first bait if no selection
|
||||
end
|
||||
end
|
||||
|
||||
return selectedBait
|
||||
end
|
||||
|
||||
|
||||
-- Function to handle the fishing process
|
||||
local function StartFishingProcess(selectedBait, waterLoc)
|
||||
fishing = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue