mirror of
https://gitlab.com/lunovox/components.git
synced 2025-03-15 08:01:22 +00:00
[code][notested] Code of Smartphone. (talvés será transferido para outro mod)
This commit is contained in:
parent
ed6d2f9705
commit
ebfeb13fc7
1 changed files with 87 additions and 4 deletions
|
@ -1,13 +1,96 @@
|
||||||
|
|
||||||
modComponents.apps = {
|
modComponents.apps = {
|
||||||
installeds = {"appSettings"},
|
installeds = [
|
||||||
repository = [
|
--"appSettings"
|
||||||
|
],
|
||||||
|
repository = {
|
||||||
|
--[[
|
||||||
["appSettings"]={
|
["appSettings"]={
|
||||||
title=modComponents.translate("Settings"),
|
title=modComponents.translate("Settings"),
|
||||||
icon="icon_settings.png"
|
icon="icon_settings.png"
|
||||||
|
to_all_player = true,
|
||||||
on_play = Function(player)
|
on_play = Function(player)
|
||||||
--qual janela irá abrir!
|
--qual janela irá abrir!
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
],
|
--]]
|
||||||
|
},
|
||||||
|
register_app = function(appname, def)
|
||||||
|
if type(appname)=="string" and appname~="" then
|
||||||
|
if type(def)=="table"
|
||||||
|
and type(def.title)=="string" and def.title~=""
|
||||||
|
and type(def.icon)=="string" and def.icon~=""
|
||||||
|
and type(def.to_all_player)=="boolean"
|
||||||
|
and type(def.on_play)=="function"
|
||||||
|
then
|
||||||
|
if type(modComponents.apps.repository[appname])~="table" then
|
||||||
|
modComponents.apps.repository[appname].title = def.title
|
||||||
|
modComponents.apps.repository[appname].icon = def.icon.."^[resize:32x32"
|
||||||
|
modComponents.apps.repository[appname].to_all_player = def.to_all_player
|
||||||
|
modComponents.apps.repository[appname].on_play = def.on_play
|
||||||
|
if def.to_all_player == true then
|
||||||
|
table.insert(
|
||||||
|
modComponents.apps.installeds,
|
||||||
|
appname
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false, "[COMPONENTES:SMARTPHONE:ERROR] Não é possível instalar um app com mesmo nome."
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return false, "[COMPONENTES:SMARTPHONE:ERROR] Definição inválida."
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return false, "[COMPONENTES:SMARTPHONE:ERROR] Nome de App inválido!"
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
modComponents.apps.register_app("appSettings", {
|
||||||
|
title=modComponents.translate("Settings"),
|
||||||
|
icon="icon_settings.png"
|
||||||
|
to_all_player = true,
|
||||||
|
on_play = Function(player)
|
||||||
|
minetest.chat_send_player(
|
||||||
|
player:get_player_name(),
|
||||||
|
minetest.colorize("#FF0000", "[COMPONENTES:SMARTPHONE:ERROR] ")
|
||||||
|
..modCorreio.translate("Function not implemented yet!")
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
if minetest.get_modpath("correio")
|
||||||
|
and minetest.global_exists("modCorreio")
|
||||||
|
and type(modCorreio.openinbox)=="function"
|
||||||
|
then
|
||||||
|
modComponents.apps.register_app("appMail", {
|
||||||
|
title=modComponents.translate("Mails"),
|
||||||
|
icon="icon_mail2.png"
|
||||||
|
to_all_player = true,
|
||||||
|
on_play = Function(player)
|
||||||
|
modCorreio.openinbox(player:get_player_name())
|
||||||
|
--qual janela irá abrir!
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if minetest.get_modpath("minertrade")
|
||||||
|
and minetest.global_exists("modMinerTrade")
|
||||||
|
and type(modMinerTrade.showAccountBank)=="table"
|
||||||
|
and type(modMinerTrade.showAccountBank.inCreditCard)=="function"
|
||||||
|
then
|
||||||
|
modComponents.apps.register_app("appBank", {
|
||||||
|
title=modComponents.translate("Bank"),
|
||||||
|
icon="obj_piggy_bank.png"
|
||||||
|
to_all_player = true,
|
||||||
|
on_play = Function(player)
|
||||||
|
local playername = player:get_player_name()
|
||||||
|
modMinerTrade.showAccountBank.inCreditCard(playername, playername)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue