This commit is contained in:
Lunovox 2024-11-18 16:28:19 -03:00
parent 98702d6780
commit 1ccfe86adf
6 changed files with 70 additions and 13 deletions

12
.gitignore vendored Normal file
View file

@ -0,0 +1,12 @@
# Backup Files
*.~
*.old
*.bkp
*.backup
# Files of POedit
*.mo
# Arquivo de versionamento:
*.diff
*.patch

View file

@ -3,7 +3,7 @@ modComputing = {
modpath = core.get_modpath(core.get_current_modname()),
}
--dofile(modComputing.modpath.."/translate.lua")
dofile(modComputing.modpath.."/translate.lua")
dofile(modComputing.modpath.."/api.lua")
dofile(modComputing.modpath.."/item_smartphone.lua")

View file

@ -1,13 +1,13 @@
modComputing.getTextNowWeekDay3S = function()
local txtWeekDays3S = {
"Sun", --Sunday
"Mon", --Monday
"Tue", --Tuesday
"Wed", --Wednesday
"Thu", --Thursday
"Fri", --Friday
"Sat", --Saturday
modComputing.translate("Sun"), --Sunday
modComputing.translate("Mon"), --Monday
modComputing.translate("Tue"), --Tuesday
modComputing.translate("Wed"), --Wednesday
modComputing.translate("Thu"), --Thursday
modComputing.translate("Fri"), --Friday
modComputing.translate("Sat"), --Saturday
}
local totalDays = core.get_day_count()
local nowRow = math.floor((totalDays-1)/7)+1
@ -27,7 +27,12 @@ modComputing.getTextNowDate = function()
local totalDays = core.get_day_count()
local nowYear = totalDays/(28*4)
local nowMount = (math.floor(totalDays/28)%4)+1
local txtMounts3S = {"SPR", "SUM", "AUT", "WIN"} --SPRING, SUMMER, AUTUMN, WINTER
local txtMounts3S = {
modComputing.translate("SPR"),
modComputing.translate("SUM"),
modComputing.translate("AUT"),
modComputing.translate("WIN"),
} --SPRING, SUMMER, AUTUMN, WINTER
local nowDay = math.floor(totalDays%28)+1
local nowDate = ("%04d-%3s-%02d"):format((nowYear+1), txtMounts3S[nowMount], nowDay)
return nowDate
@ -47,8 +52,7 @@ modComputing.getFormSmartphone = function(player)
.."image[0,0;"..(10*271/484)..",10.0;text_smartphone_271x484.png;true]"
.."style_type[label;font=mono;font_size=11;textcolor=#FFFFFF]"
.."label[0.75,1.975;"..core.formspec_escape(modComputing.getTextClockBar()).."]"
.."button_exit[0.75,2.50;1.5,1.5;btnClose;"..core.formspec_escape("Banana\nPhone").."]"
.."button_exit[0.75,2.50;1.5,1.5;btnClose;"..core.formspec_escape(modComputing.translate("Banana\nStore")).."]"
return formspec
end
@ -59,13 +63,14 @@ end
core.register_craftitem("computing:smartphone", {
description = "SMARTPHONE",
description = modComputing.translate("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 = {
@ -74,6 +79,7 @@ core.register_craft({
{"" ,"" ,""},
}
})
--]]
core.register_alias("smartphone", "computing:smartphone")

View file

@ -1,2 +1,18 @@
name = computing
title = Computing
title = Computing
description = Add multiple computing devices such as: Smartphones and Desktops.
version = 0.1.0
dev_state = ALPHA
license = GNU AGPL-3.0
media_license = CC BY-SA 4.0
supported_games = minetest_game
depends = default,dye
optional_depends =
min_minetest_version = 5.7
max_minetest_version =
author = Lunovox Heavenfinder: [email](mailto:lunovox@disroot.org), [social web](http:qoto.org/@lunovox), [webchat](https://cloud.disroot.org/call/9aa2t7ib), [xmpp](xmpp:lunovox@disroot.org?join), [Mumble](mumble:mumble.disroot.org), [more contacts](https:libreplanet.org/wiki/User:Lunovox)
created = 2024-11-10 10:42:01
update = 2024-11-04 16:27
donate_url = https://liberapay.com/Lunovox/donate
translation_url = https://gitlab.com/lunovox/computing/-/blob/master/locale/README.md
repository = https://gitlab.com/lunovox/computing

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 KiB

23
translate.lua Normal file
View file

@ -0,0 +1,23 @@
local ngettext
--[[
local S = core.get_translator('testmod')
core.register_craftitem('testmod:test', {
description = S('I am a test object'),
inventory_image = 'default_stick.png^[brighten'
})
--]]
if core.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
modComputing.translate, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
modComputing.translate = intllib.Getter()
end
elseif core.get_translator ~= nil and core.get_current_modname ~= nil and core.get_modpath(core.get_current_modname()) then
modComputing.translate = core.get_translator(core.get_current_modname())
else
modComputing.translate = function(s) return s end
end