computers.lua 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. local S = minetest.get_translator("computer")
  2. -- Amiga 500 lookalike
  3. computer.register("computer:shefriendSOO", {
  4. description = S("SheFriendSOO"),
  5. tiles_off = { front=true },
  6. node_box = computer.pixelnodebox(32, {
  7. -- X Y Z W H L
  8. { 0, 0, 17, 32, 32, 12 }, -- Monitor Screen
  9. { 3, 3, 29, 26, 26, 3 }, -- Monitor Tube
  10. { 0, 0, 0, 32, 4, 17 } -- Keyboard
  11. })
  12. })
  13. -- Some generic laptop
  14. minetest.register_node("computer:vanio", {
  15. drawtype = "mesh",
  16. mesh = "computer_laptop.obj",
  17. description = S("Pony Vanio"),
  18. inventory_image = "computer_laptop_inv.png",
  19. tiles = {"computer_laptop.png"},
  20. paramtype = "light",
  21. paramtype2 = "facedir",
  22. light_source = 4,
  23. groups = {snappy=3},
  24. walkable = false,
  25. selection_box = {
  26. type = "fixed",
  27. fixed = {-0.35, -0.5, -0.35, 0.35, 0.05, 0.35},
  28. },
  29. on_rightclick = function(pos, node, clicker, itemstack)
  30. node.name = "computer:vanio_off"
  31. minetest.set_node(pos, node)
  32. return itemstack
  33. end
  34. })
  35. minetest.register_node("computer:vanio_off", {
  36. drawtype = "mesh",
  37. mesh = "computer_laptop_closed.obj",
  38. tiles = {"computer_laptop.png"},
  39. paramtype = "light",
  40. paramtype2 = "facedir",
  41. groups = {snappy=3, not_in_creative_inventory=1},
  42. walkable = false,
  43. selection_box = {
  44. type = "fixed",
  45. fixed = {-0.35, -0.5, -0.35, 0.35, -0.4, 0.25},
  46. },
  47. drop = "computer:vanio",
  48. on_rightclick = function(pos, node, clicker, itemstack)
  49. node.name = "computer:vanio"
  50. minetest.set_node(pos, node)
  51. return itemstack
  52. end
  53. })
  54. -- Sony PlayStation lookalike
  55. computer.register("computer:slaystation", {
  56. description = S("Pony SlayStation"),
  57. inventory_image = "computer_ps1_inv.png",
  58. tiles_off = { top=true },
  59. node_box = computer.pixelnodebox(32, {
  60. -- X Y Z W H L
  61. { 0, 0, 11, 32, 6, 21 }, -- Console
  62. { 1, 0, 1, 4, 2, 9 }, -- Controller 1 L Grip
  63. { 10, 0, 1, 4, 2, 9 }, -- Controller 1 R Grip
  64. { 5, 0, 4, 5, 2, 5 }, -- Controller 1 Center
  65. { 18, 0, 1, 4, 2, 9 }, -- Controller 2 L Grip
  66. { 27, 0, 1, 4, 2, 9 }, -- Controller 2 R Grip
  67. { 22, 0, 4, 5, 2, 5 } -- Controller 2 Center
  68. })
  69. })
  70. -- Sony PlayStation 2 lookalike
  71. computer.register("computer:slaystation2", {
  72. description = S("Pony SlayStation 2"),
  73. inventory_image = "computer_ps2_inv.png",
  74. tiles_off = { front=true },
  75. node_box = computer.pixelnodebox(32, {
  76. -- X Y Z W H L
  77. { 2, 2, 11, 28, 3, 19 }, -- Console (Upper part)
  78. { 2, 0, 11, 26, 2, 19 }, -- Console (Lower part)
  79. { 1, 0, 1, 4, 2, 9 }, -- Controller 1 L Grip
  80. { 10, 0, 1, 4, 2, 9 }, -- Controller 1 R Grip
  81. { 5, 0, 1, 5, 2, 8 }, -- Controller 1 Center
  82. { 18, 0, 1, 4, 2, 9 }, -- Controller 2 L Grip
  83. { 27, 0, 1, 4, 2, 9 }, -- Controller 2 R Grip
  84. { 22, 0, 1, 5, 2, 8 } -- Controller 2 Center
  85. })
  86. })
  87. -- Sinclair ZX Spectrum lookalike
  88. computer.register("computer:specter", {
  89. description = S("SX Specter"),
  90. inventory_image = "computer_specter_inv.png",
  91. tiles_off = { },
  92. node_box = computer.pixelnodebox(32, {
  93. -- X Y Z W H L
  94. { 3, 0, 0, 26, 4, 17 }, -- Keyboard
  95. { 18, 0, 18, 12, 6, 14 } -- Tape Player
  96. })
  97. })
  98. -- Nintendo Wii lookalike
  99. computer.register("computer:wee", {
  100. description = S("Nientiendo Wee"),
  101. inventory_image = "computer_wii_inv.png",
  102. tiles_off = { front=true },
  103. node_box = computer.pixelnodebox(32, {
  104. -- X Y Z W H L
  105. { 11, 0, 3, 10, 6, 26 }, -- Base
  106. { 12, 6, 4, 8, 22, 24 } -- Top
  107. })
  108. })
  109. -- Apple iPad lookalike
  110. minetest.register_node("computer:piepad", {
  111. description = S("Snapple Piepad"),
  112. drawtype = "signlike",
  113. tiles = {"computer_piepad_inv.png"},
  114. inventory_image = "computer_piepad_inv.png",
  115. wield_image = "computer_piepad_inv.png",
  116. paramtype = "light",
  117. paramtype2 = "wallmounted",
  118. light_source = 8,
  119. walkable = false,
  120. groups = {oddly_breakable_by_hand=2},
  121. selection_box = {type = "wallmounted"},
  122. sounds = default.node_sound_wood_defaults()
  123. })
  124. -- Commodore 64 lookalike
  125. computer.register("computer:admiral64", {
  126. description = S("Admiral64"),
  127. inventory_image = "computer_ad64_inv.png",
  128. tiles_off = { },
  129. node_box = computer.pixelnodebox(32, {
  130. -- X Y Z W H L
  131. { 0, 0, 0, 32, 4, 18 } -- Keyboard
  132. })
  133. })
  134. -- Commodore 128 lookalike
  135. computer.register("computer:admiral128", {
  136. description = S("Admiral128"),
  137. inventory_image = "computer_ad128_inv.png",
  138. tiles_off = { },
  139. node_box = computer.pixelnodebox(32, {
  140. -- X Y Z W H L
  141. { 0, 0, 0, 32, 4, 27 } -- Keyboard
  142. })
  143. })
  144. -- XBox lookalike
  145. computer.register("computer:hueg_box", {
  146. description = S("HUEG Box"),
  147. tiles_off = { },
  148. node_box = computer.pixelnodebox(16, {
  149. -- X Y Z W H L
  150. { 0, 0, 7, 16, 6, 9 }, -- Console
  151. { 2, 0, 1, 11, 3, 6 }, -- Controller
  152. { 2, 0, 0, 2, 3, 1 },
  153. { 11, 0, 0, 2, 3, 1 },
  154. })
  155. })
  156. -- Generic Flat Screen LCD (16x9) with keyboard
  157. local mo_sbox = {
  158. type = "fixed",
  159. fixed = { -0.5, -0.5, -0.43, 0.5, 0.2, 0.25 }
  160. }
  161. minetest.register_node("computer:monitor", {
  162. description = S("Monitor and keyboard"),
  163. inventory_image = "computer_monitor_inv.png",
  164. drawtype = "mesh",
  165. mesh = "computer_monitor.obj",
  166. tiles = {"computer_black.png", "monitor_plastic.png", "computer_black.png", "monitor_plastic.png"},
  167. paramtype = "light",
  168. paramtype2 = "facedir",
  169. walkable = false,
  170. groups = {snappy=3},
  171. selection_box = mo_sbox,
  172. on_rightclick = function(pos, node, clicker, itemstack)
  173. node.name = "computer:monitor_on"
  174. minetest.set_node(pos, node)
  175. return itemstack
  176. end
  177. })
  178. minetest.register_node("computer:monitor_on", {
  179. drawtype = "mesh",
  180. mesh = "computer_monitor.obj",
  181. tiles = {"monitor_display.png^[transformFX", "monitor_plastic.png", "computer_black.png", "monitor_plastic.png"},
  182. paramtype = "light",
  183. paramtype2 = "facedir",
  184. light_source = 9,
  185. walkable = false,
  186. groups = {snappy=3, not_in_creative_inventory=1},
  187. selection_box = mo_sbox,
  188. drop = "computer:monitor",
  189. on_rightclick = function(pos, node, clicker, itemstack)
  190. node.name = "computer:monitor"
  191. minetest.set_node(pos, node)
  192. return itemstack
  193. end
  194. })
  195. minetest.register_alias("computer:monitor_bios", "computer:monitor")
  196. minetest.register_alias("computer:monitor_loading", "computer:monitor")
  197. minetest.register_alias("computer:monitor_login", "computer:monitor")
  198. minetest.register_alias("computer:monitor_desktop", "computer:monitor")
  199. --WIFI Router (linksys look-a-like)
  200. minetest.register_node("computer:router", {
  201. description = S("WIFI Router"),
  202. inventory_image = "computer_router_inv.png",
  203. tiles = {
  204. "computer_router_t.png",
  205. "computer_router_bt.png",
  206. "computer_router_l.png",
  207. "computer_router_r.png",
  208. "computer_router_b.png",
  209. {
  210. name = "computer_router_f_animated.png",
  211. animation = {type="vertical_frames", aspect_w=32, aspect_h=32, length=1.0}
  212. },
  213. }, --"computer_router_f.png"},
  214. paramtype = "light",
  215. paramtype2 = "facedir",
  216. walkable = false,
  217. groups = {snappy=3},
  218. sound = default.node_sound_wood_defaults(),
  219. drawtype = "nodebox",
  220. node_box = {
  221. type = "fixed",
  222. fixed = {
  223. {-0.25, -0.5, -0.0625, 0.25, -0.375, 0.3125},
  224. {-0.1875, -0.4375, 0.3125, -0.125, -0.1875, 0.375},
  225. {0.125, -0.4375, 0.3125, 0.1875, -0.1875, 0.375},
  226. {-0.0625, -0.4375, 0.3125, 0.0625, -0.25, 0.375}
  227. }
  228. }
  229. })
  230. local pct_cbox = {
  231. type = "fixed",
  232. fixed = { -0.1875, -0.5, -0.36, 0.1875, 0.34, 0.46 }
  233. }
  234. --Modern PC Tower
  235. minetest.register_node("computer:tower", {
  236. description = S("Computer Tower"),
  237. inventory_image = "computer_tower_inv.png",
  238. drawtype = "mesh",
  239. mesh = "computer_tower.obj",
  240. tiles = {"computer_tower.png"},
  241. paramtype = "light",
  242. paramtype2 = "facedir",
  243. groups = {snappy=3},
  244. sound = default.node_sound_wood_defaults(),
  245. selection_box = pct_cbox,
  246. collision_box = pct_cbox
  247. })
  248. minetest.register_alias("computer:tower_on", "computer:tower")
  249. --Rack Server
  250. minetest.register_node("computer:server", {
  251. drawtype = "nodebox",
  252. description = S("Rack Server"),
  253. tiles = {
  254. 'computer_server_t.png',
  255. 'computer_server_bt.png',
  256. 'computer_server_l.png',
  257. 'computer_server_r.png',
  258. 'computer_server_bt.png',
  259. 'computer_server_f_off.png'
  260. },
  261. inventory_image = "computer_server_inv.png",
  262. paramtype = "light",
  263. paramtype2 = "facedir",
  264. groups = {snappy=3},
  265. selection_box = {
  266. type = "fixed",
  267. fixed = {-0.5, -0.5, -0.25, 0.5, 1.125, 0.4375}
  268. },
  269. node_box = {
  270. type = "fixed",
  271. fixed = {-0.5, -0.5, -0.25, 0.5, 1.125, 0.4375}
  272. },
  273. sounds = default.node_sound_wood_defaults(),
  274. on_rightclick = function(pos, node, clicker, itemstack)
  275. node.name = "computer:server_on"
  276. minetest.set_node(pos, node)
  277. return itemstack
  278. end,
  279. on_place = function(itemstack, placer, pointed_thing)
  280. local pos = pointed_thing.above
  281. if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then
  282. minetest.chat_send_player( placer:get_player_name(),
  283. S("Not enough vertical space to place a server!" ))
  284. return itemstack
  285. end
  286. return minetest.item_place(itemstack, placer, pointed_thing)
  287. end
  288. })
  289. minetest.register_node("computer:server_on", {
  290. drawtype = "nodebox",
  291. tiles = {
  292. 'computer_server_t.png',
  293. 'computer_server_bt.png',
  294. 'computer_server_l.png',
  295. 'computer_server_r.png',
  296. 'computer_server_bt.png',
  297. 'computer_server_f_on.png',
  298. },
  299. inventory_image = "computer_server_inv.png",
  300. paramtype = "light",
  301. paramtype2 = "facedir",
  302. groups = {snappy=3,not_in_creative_inventory=1},
  303. selection_box = {
  304. type = "fixed",
  305. fixed = {-0.5, -0.5, -0.25, 0.5, 1.125, 0.4375}
  306. },
  307. node_box = {
  308. type = "fixed",
  309. fixed = {-0.5, -0.5, -0.25, 0.5, 1.125, 0.4375}
  310. },
  311. sounds = default.node_sound_wood_defaults(),
  312. drop = 'computer:server',
  313. on_rightclick = function(pos, node, clicker, itemstack)
  314. node.name = "computer:server"
  315. minetest.set_node(pos, node)
  316. return itemstack
  317. end
  318. })