#include "ui/ui_helpers.lua"
#include "ui/ui_extensions.lua"

function init()
	lamp = FindBody()
	tutorialtimer = 3
	hintimageInputOffsetX = 164
	curinput = GetString("game.input.curdevice")
	isGet = false
	layout = "keyboard"
end

function tick(dt)
	if not isGet then
		if LastInputDevice() == UI_DEVICE_GAMEPAD then
			layout = "gamepad"
		else
			layout = "keyboard"
		end
		
		if not IsHandleValid(lamp) then
			if not GetBool("game.mod.lamp") then
				SetBool("game.mod.lamp", true)
				local getBind = GetString("game.input.flashlight")
				local inputKey = string.upper(getBind)
				if layout == "gamepad" then
					inputKey = "[[" .. "flashlight" .. ";iconsize=42]]"
				end
				SetString("hud.notification",  GetTranslatedStringByKey("UI_HUD_LANTERN," .. inputKey))
			end
			isGet = true
		end
	end
end
