This commit is contained in:
Lunovox 2024-11-19 13:14:58 -03:00
parent 39b03a41fa
commit c5b1272dd5
3 changed files with 62 additions and 37 deletions

59
api.lua
View file

@ -95,18 +95,53 @@ modComputing.add_app = function(appname, def)
end
end
modComputing.add_app_test = function(buttoname)
modComputing.add_app(buttoname, {
icon_name = buttoname,
icon_type = "button_exit", --types: button/button_exit
icon_title = buttoname,
icon_descryption = "Exemplo de botão!",
icon_image = "icon_smartphone_128x128.png",
--on_iconclick = modComputing.show_smartphone_config,
on_iconclick = function()
core.chat_send_all("Button '"..icon_title.."' pressed!")
end,
})
modComputing.add_test_apps = function()
if core.settings:get_bool(modComputing.modname..".debug") then
modComputing.add_app("computing:btnMinetest", {
icon_name = "btnMinetest",
icon_type = "button", --types: button/button_exit
icon_title = "MINETEST",
icon_descryption = "Jogo de Voxel muito legal.",
icon_image = "icon_smartphone_128x128.png",
--on_iconclick = modComputing.show_smartphone_config,
on_iconclick = function()
core.chat_send_all("Button 'btnMinetest' pressed!")
end,
})
modComputing.add_app("computing:btnDoom", {
icon_name = "btnDoom",
icon_type = "button", --types: button/button_exit
icon_title = "DOOM",
icon_descryption = "Jogo de tiro em primeira pessoa.",
icon_image = "icon_smartphone_128x128.png",
--on_iconclick = modComputing.show_smartphone_config,
on_iconclick = function()
core.chat_send_all("Button 'btnDoom' pressed!")
end,
})
modComputing.add_app("computing:btnMastodon", {
icon_name = "btnMastodon",
icon_type = "button", --types: button/button_exit
icon_title = "MASTODON",
icon_descryption = "Uma rede social muito legal.",
icon_image = "icon_smartphone_128x128.png",
--on_iconclick = modComputing.show_smartphone_config,
on_iconclick = function()
core.chat_send_all("Button 'btnMastodon' pressed!")
end,
})
modComputing.add_app("computing:btnLockPhone", {
icon_name = "btnLockPhone",
icon_type = "button_exit", --types: button/button_exit
icon_title = "LOCK",
icon_descryption = "Bloqueia tela do Smartphone.",
icon_image = "icon_smartphone_128x128.png",
--on_iconclick = modComputing.show_smartphone_config,
on_iconclick = function()
core.chat_send_all("Button 'btnMastodon' pressed!")
end,
})
end
end
modComputing.get_appnames = function()

View file

@ -9,22 +9,6 @@ dofile(modComputing.modpath.."/functions.lua")
dofile(modComputing.modpath.."/item_smartphone.lua")
--[[
local timeCount = 0
core.register_globalstep(function(dtime)
timeCount = timeCount + dtime
--modComputing.debug("[debug] core.register_globalstep() timeCount = "..timeCount)
if timeCount >= 5 then
timeCount = 0
--modComputing.debug("[debug] core.register_globalstep()")
modComputing.add_app_test()
end
end)
--]]
modComputing.add_app_test("CAFÉ")
modComputing.add_app_test("LEITE")
modComputing.add_app_test("SUCO")
modComputing.add_app_test("AÇUCAR")
modComputing.add_test_apps()
core.log('action',"[MOD] "..modComputing.modname.." loaded!")

View file

@ -16,9 +16,9 @@ modComputing.getFormSmartphone = function(player)
.."size["..(10*271/484)..",10.0,true]"
.."no_prepend[]"
.."bgcolor[#08080844;true]" --Padrão: #080808BB | true = 100% transparente
.."style_type[label;font=mono;font_size=11;textcolor=#FFFFFF]"
.."style_type[image_button;font=normal;font_size=14;textcolor=#FFFFFF]"
.."style_type[image_button_exit;font=normal;font_size=14;textcolor=#FFFFFF]"
.."style_type[label;font=mono;font_size=10;textcolor=#FFFFFF]"
.."style_type[image_button;font=normal;font_size=11;textcolor=#FFFFFF]"
.."style_type[image_button_exit;font=normal;font_size=11;textcolor=#FFFFFF]"
--.."background[-0.75,-2.00;"..(10*271/484)..",10.0;text_smartphone_271x484.png;true]"
.."image[0,0;"..(10*271/484)..",10.0;text_smartphone_271x484.png;true]"
.."label[0.75,1.975;"..core.formspec_escape(modComputing.getTextClockBar()).."]"
@ -57,7 +57,13 @@ modComputing.getFormSmartphone = function(player)
--SAMPLE: image_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>;<noclip>;<drawborder>;<pressed texture name>]
--SAMPLE: image_button_exit[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]
local newToolTip = "tooltip["..core.formspec_escape("btn_"..icon_name)..";"..core.formspec_escape(icon_title.."\n * "..icon_descryption)..";#008800;#FFFFFF]"
local newToolTip = "tooltip["..core.formspec_escape("btn_"..icon_name)..";"
..core.formspec_escape(
core.colorize("#00FF00", icon_title).."\n"
.."* "..icon_descryption
)
..";#004400;#FFFFFF"
.."]"
local newButton = core.formspec_escape("image_"..icon_type).."["
..(offSetX + (iconCol * sizeButtonX))..","
@ -65,11 +71,11 @@ modComputing.getFormSmartphone = function(player)
..";1.5,1.5;"
..core.formspec_escape(icon_image)..";" --texture name
..core.formspec_escape("btn_"..icon_name)..";" --button name
--..";" --label empty
--..core.formspec_escape(appname).." "..iconRow.."/"..iconCol.."\n"..core.formspec_escape("page:"..page.."\ninpg:"..iconInPage)..";" --label
--..core.formspec_escape(icon_title)..";" --label
..";" --label empty
.."false;" --NOCLIP
.."true;" --drawborder
..core.formspec_escape(icon_title)..";" --label
.."true;" --NOCLIP
.."false;" --drawborder
..core.formspec_escape(icon_image.."^[invert:rgb") --pressed texture name
.."]"