Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. minetest.register_node("computer:monitor", {
  2. description = "Monitor and keyboard",
  3. tiles = {"computer_monitor_t_off.png","computer_monitor_bt.png","computer_monitor_l.png","computer_monitor_r.png","computer_monitor_b.png","computer_monitor_f_off.png"},
  4. --inventory_image =
  5. paramtype = "light",
  6. light_source = 4,
  7. paramtype2 = "facedir",
  8. walkable = false,
  9. is_ground_content = true,
  10. groups = {crumbly=3},
  11. --sounds = default.node_sound_dirt_defaults(),
  12. drawtype = "nodebox",
  13. node_box = {
  14. type = "fixed",
  15. fixed = {
  16. {-0.5, -0.3125, 0.1875, 0.5, 0.375, 0.223116},
  17. {-0.25, -0.5, 0.125, 0.25, -0.466981, 0.5},
  18. {-0.125, -0.5, 0.3125, 0.125, 0.0283019, 0.346698},
  19. {-0.375, -0.3125, 0.208965, 0.375, 0.240566, 0.3125},
  20. {-0.4375, -0.5, -0.4375, 0.4375, -0.4375, -0.125},
  21. {-0.1875, -0.5, 0.25, 0.1875, -0.410377, 0.375},
  22. },
  23. },
  24. selection_box = {
  25. type = "fixed",
  26. fixed = {
  27. {-0.5, -0.3125, 0.1875, 0.5, 0.375, 0.223116},
  28. {-0.25, -0.5, 0.125, 0.25, -0.466981, 0.5},
  29. {-0.125, -0.5, 0.3125, 0.125, 0.0283019, 0.346698},
  30. {-0.375, -0.3125, 0.208965, 0.375, 0.240566, 0.3125},
  31. {-0.4375, -0.5, -0.4375, 0.4375, -0.4375, -0.125},
  32. {-0.1875, -0.5, 0.25, 0.1875, -0.410377, 0.375},
  33. },
  34. },
  35. drop = 'computer:monitor' ,
  36. after_place_node = function(pos, placer)
  37. -- This function is run when the chest node is placed.
  38. -- The following code sets the formspec for chest.
  39. -- Meta is a way of storing data onto a node.
  40. local meta = minetest.get_meta(pos)
  41. local text = "00:0a:95:9d:68:16"
  42. meta:set_string("formspec",
  43. "size[8,9]"..
  44. "label[0,0;Computer 1]"..
  45. "label[3,3;Hello World!]"..
  46. "label[0.2,7;Current Mac Address: "..text.."]"..
  47. "field[0.5,8;3,1;x;Update Mac Address:;"..text.."]"
  48. )
  49. end,
  50. on_receive_fields = function(pos, formname, fields, player)
  51. if(fields.quit) then
  52. return
  53. end
  54. local meta = minetest.get_meta(pos)
  55. if not meta then
  56. return
  57. end
  58. meta:set_string("value", fields.x)
  59. end
  60. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement