Add files via upload

This commit is contained in:
Gerold55 2017-12-12 20:56:27 -05:00 committed by GitHub
parent 179cf2e6a0
commit db8886ef3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 72 additions and 5 deletions

View File

@ -96,9 +96,9 @@ laptop.register_app("mail", {
"image_button[5.7,9;1,1;"..mtos.theme.minor_button.."^laptop_email_trash.png;delete;]tooltip[delete;Delete]"
if account.selected_box == "inbox" then
if not account.selectedmessage.is_read then
formspec = formspec .. "image_button[6.7,9;1,1;"..mtos.theme.minor_button.."^laptop_mail_read.png;markread;]tooltip[markread;Mark message as read]"
formspec = formspec .. "image_button[6.7,9;1,1;"..mtos.theme.minor_button.."^laptop_mail_read_button.png;markread;]tooltip[markread;Mark message as read]"
else
formspec = formspec .. "image_button[6.7,9;1,1;"..mtos.theme.minor_button.."^laptop_mail.png;markunread;]tooltip[markunread;Mark message as unread]"
formspec = formspec .. "image_button[6.7,9;1,1;"..mtos.theme.minor_button.."^laptop_mail_button.png;markunread;]tooltip[markunread;Mark message as unread]"
end
end
if account.selected_box == "inbox" then
@ -113,7 +113,7 @@ laptop.register_app("mail", {
end
return formspec
end,
receive_fields_func = function(app, mtos, fields, sender)
receive_fields_func = function(app, mtos, sender, fields)
if sender:get_player_name() ~= mtos.appdata.os.last_player then
mtos:set_app() -- wrong player. Back to launcher
return
@ -185,7 +185,7 @@ laptop.register_view("mail:newplayer", {
return mtos.theme:get_label('1,3', "No mail account for player "..mtos.appdata.os.last_player.. " found. Do you like to create a new account?")..
mtos.theme:get_button('1,4;3,1', 'major', 'create', 'Create account')
end,
receive_fields_func = function(app, mtos, fields, sender)
receive_fields_func = function(app, mtos, sender, fields)
if sender:get_player_name() ~= mtos.appdata.os.last_player then
mtos:set_app() -- wrong player. Back to launcher
return
@ -222,7 +222,7 @@ laptop.register_view("mail:compose", {
end
return formspec
end,
receive_fields_func = function(app, mtos, fields, sender)
receive_fields_func = function(app, mtos, sender, fields)
if sender:get_player_name() ~= mtos.appdata.os.last_player then
mtos:set_app() -- wrong player. Back to launcher
return

67
apps/removable_app.lua Normal file
View File

@ -0,0 +1,67 @@
laptop.register_app("removable", {
app_name = "Removable storage",
app_icon = "laptop_hard_drive.png",
app_info = "Work with removable media",
formspec_func = function(app, mtos)
local formspec =
"list[nodemeta:"..mtos.pos.x..','..mtos.pos.y..','..mtos.pos.z..";main;0,0.3;1,1;]" ..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"listring[nodemeta:"..mtos.pos.x..','..mtos.pos.y..','..mtos.pos.z..";main]" ..
"listring[current_player;main]"
local idata = mtos:get_removable_data()
if idata then
-- change label
formspec = formspec .. mtos.theme:get_label('0,1.2', idata.def.description).."field[2,0.7;4,1;label;Label:;"..idata.label.."]"..
mtos.theme:get_button('5.7,0.55;1.5,0.7', 'minor', 'set_label', 'Rename', 'Rename the '..idata.def.description)..
mtos.theme:get_label('0,1.7', "Format: "..idata.os_format).. -- format state
-- buttons
mtos.theme:get_button('0,3;1.5,0.7', 'minor', 'format', 'wipe', 'Wipe all data from disk')..
mtos.theme:get_button('0,4;1.5,0.7', 'minor', 'format', 'data', 'Format disk to store data')
if idata.def.groups.laptop_removable_usb then
formspec = formspec .. mtos.theme:get_button('2,3;1.5,0.7', 'minor', 'format', 'backup', 'Store backup to disk')
end
if idata.os_format == "backup" then
formspec = formspec .. mtos.theme:get_button('2,4;1.5,0.7', 'minor', 'restore', 'restore', 'Restore from backup disk')
end
-- format oldos
if idata.def.groups.laptop_removable_floppy then
formspec = formspec .. mtos.theme:get_button('4,3;1.5,0.7', 'minor', 'format', 'OldOS', 'Format disk to boot OldOS ')
end
end
return formspec
end,
receive_fields_func = function(app, mtos, sender, fields)
local idata = mtos:get_removable_data()
if idata then
if fields.set_label then
idata.label = fields.label
elseif fields.format then
fields.format = minetest.strip_colors(fields.format)
idata.stack = ItemStack(idata.def.name)
idata.meta = idata.stack:get_meta()
if fields.format == 'wipe' then
idata.label = "" -- reset label on wipe
elseif fields.format == "data" then
idata.meta:set_string("os_format", "data")
elseif fields.format == "backup" then
idata.meta:set_string("os_format", "backup")
idata.meta:set_string("backup_data", mtos.meta:get_string('laptop_appdata'))
elseif fields.format == "OldOS" then
idata.meta:set_string("os_format", "OldOS")
end
elseif fields.restore then
mtos.appdata = minetest.deserialize(idata.meta:get_string("backup_data")) or {}
mtos.appdata.os.current_app = nil
mtos:save()
laptop.os_get(mtos.pos):power_on() --reboot
end
mtos:set_removable_data()
end
end,
})