This repository was archived by the owner on Sep 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfloppy.lua
More file actions
133 lines (97 loc) · 3.39 KB
/
Copy pathfloppy.lua
File metadata and controls
133 lines (97 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
local lwcomp = ...
local S = lwcomp.S
local function on_use (itemstack, user, pointed_thing)
if itemstack and user and user:is_player () then
local meta = itemstack:get_meta()
if meta then
local id = meta:get_int ("lwcomputer_id")
local label = meta:get_string ("label")
local sid = "ID:<not used>"
if id > 0 then
sid = "ID:"..tostring (id)
end
if label == "" then
label = "Label:<no label>"
else
label = "Label:"..label
end
local formspec =
"formspec_version[3]\n"..
"size[6.0,4.0]\n"..
"label[2.25,0.8;"..minetest.formspec_escape (sid).."]\n"..
"label[2.0,1.8;"..minetest.formspec_escape (label).."]\n"..
"button_exit[2.0,2.5;2.0,1.0;close;Close]"
minetest.show_formspec (user:get_player_name (), "lwcomputers:floppy", formspec)
end
end
return nil
end
lwcomputers.register_floppy_disk ("lwcomputers:floppy_black", nil, {
description = S("Floppy disk"),
short_description = S("Floppy disk"),
inventory_image = "lwcomputers_floppy_black.png",
on_use = on_use,
groups = { floppy_disk = 1 }
})
lwcomputers.register_floppy_disk ("lwcomputers:floppy_blue", nil, {
description = S("Floppy disk"),
short_description = S("Floppy disk"),
inventory_image = "lwcomputers_floppy_blue.png",
on_use = on_use,
groups = { floppy_disk = 1 }
})
lwcomputers.register_floppy_disk ("lwcomputers:floppy_red", nil, {
description = S("Floppy disk"),
short_description = S("Floppy disk"),
inventory_image = "lwcomputers_floppy_red.png",
on_use = on_use,
groups = { floppy_disk = 1 }
})
lwcomputers.register_floppy_disk ("lwcomputers:floppy_green", nil, {
description = S("Floppy disk"),
short_description = S("Floppy disk"),
inventory_image = "lwcomputers_floppy_green.png",
on_use = on_use,
groups = { floppy_disk = 1 }
})
lwcomputers.register_floppy_disk ("lwcomputers:floppy_yellow", nil, {
description = S("Floppy disk"),
short_description = S("Floppy disk"),
inventory_image = "lwcomputers_floppy_yellow.png",
on_use = on_use,
groups = { floppy_disk = 1 }
})
lwcomputers.register_floppy_disk ("lwcomputers:floppy_white", nil, {
description = S("Floppy disk"),
short_description = S("Floppy disk"),
inventory_image = "lwcomputers_floppy_white.png",
on_use = on_use,
groups = { floppy_disk = 1 }
})
lwcomputers.register_floppy_disk ("lwcomputers:floppy_lua", "lua_disk", {
description = S("Lua disk"),
short_description = S("Lua disk"),
inventory_image = "lwcomputers_floppy_lua.png",
on_use = on_use,
groups = { floppy_disk = 1 },
diskfiles = {
{ source = lwcomp.modpath.."/res/lua_boot", target = "/boot" }
}
})
lwcomputers.register_floppy_disk ("lwcomputers:floppy_los", "los_disk", {
description = S("Los disk"),
short_description = S("Los disk"),
inventory_image = "lwcomputers_floppy_los.png",
on_use = on_use,
groups = { floppy_disk = 1 },
diskfiles = {
{ source = lwcomp.modpath.."/res/los_boot", target = "/boot" },
{ source = lwcomp.modpath.."/res/los_startup", target = "/startup" },
{ source = lwcomp.modpath.."/res/los_lua", target = "/progs/lua" },
{ source = lwcomp.modpath.."/res/los_edit", target = "/progs/edit" },
{ source = lwcomp.modpath.."/res/los_edit.man", target = "/progs/edit.man" },
{ source = lwcomp.modpath.."/res/los_print", target = "/progs/print" },
{ source = lwcomp.modpath.."/res/los_install", target = "/progs/install" }
}
})
--