Skip to content

Commit

Permalink
Revert "fix(textui): dynamic importing textui if we using it"
Browse files Browse the repository at this point in the history
This reverts commit 6a8d7d3.
  • Loading branch information
Frowmza committed Aug 14, 2024
1 parent 6a8d7d3 commit 8897bed
Showing 1 changed file with 39 additions and 34 deletions.
73 changes: 39 additions & 34 deletions data/zones.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,55 +127,61 @@ local stores = {
}

local key = Config.openControl
local usingTextUi = Config.usingTextUi
local textUi = Config.textUi
local control = Config.openControl
local textui = exports.bl_bridge:textui()
local currentZone = nil
local sprites = {}

local function setupZones()
if not textUi and GetResourceState('bl_sprites') == 'missing' then
return
end

for _, v in pairs(stores) do

if usingTextUi then
local textui = exports.bl_bridge:textui()
local point = lib.points.new({
coords = v.coords,
distance = 3.0,
})
local point = lib.points.new({
coords = v.coords,
distance = 3.0,
})

function point:onEnter()
currentZone = v
function point:onEnter()
currentZone = v
if textUi then
local prefix = "[" .. control .. "] - "
local displayText = ""
if currentZone.type == 'barber' then
textui.showTextUI(prefix .. "Barber Shop", 'left')
displayText = "Barber Shop"
elseif currentZone.type == 'tattoos' then
textui.showTextUI(prefix .. "Tattoo Parlor", 'left')
displayText = "Tattoo Parlor"
elseif currentZone.type == 'clothing' then
textui.showTextUI(prefix .. "Clothing Store", 'left')
displayText = "Clothing Store"
elseif currentZone.type == 'surgeon' then
textui.showTextUI(prefix .. "Surgeon", 'left')
displayText = "Surgeon"
end
textui.showTextUI(prefix .. displayText, 'left')
end
end

function point:onExit()
currentZone = nil
function point:onExit()
currentZone = nil
if textUi then
textui.hideTextUI()
end
else
if GetResourceState('bl_sprites') == 'missing' then return end
for _, v in pairs(stores) do
sprites[#sprites+1] = exports.bl_sprites:sprite({
coords = v.coords,
shape = 'hex',
key = key,
distance = 3.0,
onEnter = function()
currentZone = v
end,
onExit = function()
currentZone = nil
end
})
end
end

if not textUi then
sprites[#sprites+1] = exports.bl_sprites:sprite({
coords = v.coords,
shape = 'hex',
key = key,
distance = 3.0,
onEnter = function()
currentZone = v
end,
onExit = function()
currentZone = nil
end
})
end
end
end
Expand Down Expand Up @@ -225,14 +231,13 @@ AddEventHandler('onResourceStop', function(resource)
RemoveBlip(blip)
end

if not usingTextUi then
if not textUi then
for _, sprite in pairs(sprites) do
sprite:removeSprite()
end
end
end
end)


RegisterCommand('+openAppearance', function()
if not currentZone then return end
Expand Down

0 comments on commit 8897bed

Please sign in to comment.