Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- minetest.register_node("computer:monitor", {
- description = "Monitor and keyboard",
- 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"},
- --inventory_image =
- paramtype = "light",
- light_source = 4,
- paramtype2 = "facedir",
- walkable = false,
- is_ground_content = true,
- groups = {crumbly=3},
- --sounds = default.node_sound_dirt_defaults(),
- drawtype = "nodebox",
- node_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.3125, 0.1875, 0.5, 0.375, 0.223116},
- {-0.25, -0.5, 0.125, 0.25, -0.466981, 0.5},
- {-0.125, -0.5, 0.3125, 0.125, 0.0283019, 0.346698},
- {-0.375, -0.3125, 0.208965, 0.375, 0.240566, 0.3125},
- {-0.4375, -0.5, -0.4375, 0.4375, -0.4375, -0.125},
- {-0.1875, -0.5, 0.25, 0.1875, -0.410377, 0.375},
- },
- },
- selection_box = {
- type = "fixed",
- fixed = {
- {-0.5, -0.3125, 0.1875, 0.5, 0.375, 0.223116},
- {-0.25, -0.5, 0.125, 0.25, -0.466981, 0.5},
- {-0.125, -0.5, 0.3125, 0.125, 0.0283019, 0.346698},
- {-0.375, -0.3125, 0.208965, 0.375, 0.240566, 0.3125},
- {-0.4375, -0.5, -0.4375, 0.4375, -0.4375, -0.125},
- {-0.1875, -0.5, 0.25, 0.1875, -0.410377, 0.375},
- },
- },
- drop = 'computer:monitor' ,
- after_place_node = function(pos, placer)
- -- This function is run when the chest node is placed.
- -- The following code sets the formspec for chest.
- -- Meta is a way of storing data onto a node.
- local meta = minetest.get_meta(pos)
- local text = "00:0a:95:9d:68:16"
- meta:set_string("formspec",
- "size[8,9]"..
- "label[0,0;Computer 1]"..
- "label[3,3;Hello World!]"..
- "label[0.2,7;Current Mac Address: "..text.."]"..
- "field[0.5,8;3,1;x;Update Mac Address:;"..text.."]"
- )
- end,
- on_receive_fields = function(pos, formname, fields, player)
- if(fields.quit) then
- return
- end
- local meta = minetest.get_meta(pos)
- if not meta then
- return
- end
- meta:set_string("value", fields.x)
- end
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement