diff --git a/api.lua b/api.lua index 4aa252e..000a9f5 100644 --- a/api.lua +++ b/api.lua @@ -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 diff --git a/init.lua b/init.lua index 32e49a3..4672ca8 100644 --- a/init.lua +++ b/init.lua @@ -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") diff --git a/item_smartphone.lua b/item_smartphone.lua index f03ced5..65ff7ba 100644 --- a/item_smartphone.lua +++ b/item_smartphone.lua @@ -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", diff --git a/textures/text_smartphone.png b/textures/text_smartphone_271x484.png similarity index 100% rename from textures/text_smartphone.png rename to textures/text_smartphone_271x484.png