[add] Added item smartphone without any app.

This commit is contained in:
Lunovox 2024-11-18 11:30:33 -03:00
parent c7dce4856b
commit dc2c8c290d
4 changed files with 45 additions and 7 deletions

View file

@ -33,7 +33,7 @@ modComputing.debug = function(text, playername)
end
end
modComputing.log() = function(text)
modComputing.log = function(text)
local sufix = "["..modComputing.modname:upper()..":ERRO] "
core.chat_send_all(sufix..text)
core.log('action',sufix..text)
@ -42,7 +42,7 @@ end
modComputing.add_app = function(appname, def)
if type(appname)=="string" and appname~="" then
if type(modComputing.apps[appname])!="table" then
if type(modComputing.apps[appname])~="table" then
if type(def.iconname)=="string" and def.iconname~="" then
if type(def.iconimage)=="string" and def.iconimage~="" then
if type(def.on_iconclick)=="string" and def.on_iconclick~="" then
@ -72,7 +72,7 @@ modComputing.add_app = function(appname, def)
end
modComputing.get_appnames = function()
local appnames = []
local appnames = {}
for k,v in pairs(modComputing.apps) do
table.insert(appnames, k)
end

View file

@ -5,7 +5,7 @@ modComputing = {
--dofile(modComputing.modpath.."/translate.lua")
dofile(modComputing.modpath.."/api.lua")
--dofile(modComputing.modpath.."/item_smartphone.lua")
dofile(modComputing.modpath.."/item_smartphone.lua")

View file

@ -1,11 +1,49 @@
modComputing.getFormSmartphone = function(player)
local formspec = ""
.."formspec_version[6]"
.."size[5.6,10.0,true]"
.."no_prepend[]"
.."bgcolor[#08080844;true]" --Padrão: #080808BB
modComputing.show_smartphone = function(playername)
--.."bgcolor[#636D76FF;false]"
--..default.gui_bg
--..default.gui_bg_img
--..default.gui_slots
.."background[-0.75,-2.00;8.4,15.0;text_smartphone_271x484.png;true]"
.."button_exit[2.0,4.0;2.0,0.5;btnClose;"..core.formspec_escape("Close Button").."]"
return formspec
end
modComputing.show_smartphone = function(player)
local playername = player:get_player_name()
core.show_formspec(playername, "frmSmartphone", modComputing.getFormSmartphone(player))
end
core.register_craftitem("computing:smartphone", {
description = "SMARTPHONE",
inventory_image = "icon_smartphone_128x128.png",
on_use = function(itemstack, player, pointed_thing)
modComputing.show_smartphone(player)
end,
})
core.register_craft({
output = 'computing:smartphone',
recipe = {
{"default:paper" ,"" ,""},
{"" ,"" ,""},
{"" ,"" ,""},
}
})
core.register_alias("smartphone", "computing:smartphone")
--[[
modComputing.add_app("lib_computing:smartphone", {
iconname = "SMARTPHONE",

View file

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB