diff options
-rw-r--r-- | digilines/internal.lua | 6 | ||||
-rw-r--r-- | digilines/wires_common.lua | 4 | ||||
-rw-r--r-- | digilines_lcd/init.lua | 33 | ||||
-rw-r--r-- | digilines_lightsensor/init.lua | 8 | ||||
-rw-r--r-- | digilines_rtc/init.lua | 8 |
5 files changed, 31 insertions, 28 deletions
diff --git a/digilines/internal.lua b/digilines/internal.lua index 9a4780c..4953fe9 100644 --- a/digilines/internal.lua +++ b/digilines/internal.lua @@ -14,7 +14,7 @@ function digiline:importrules(spec, node) end function digiline:getAnyInputRules(pos) - local node = minetest.env:get_node(pos) + local node = minetest.get_node(pos) spec = digiline:getspec(node) if not spec then return end @@ -29,7 +29,7 @@ function digiline:getAnyInputRules(pos) end function digiline:getAnyOutputRules(pos) - local node = minetest.env:get_node(pos) + local node = minetest.get_node(pos) spec = digiline:getspec(node) if not spec then return end @@ -70,7 +70,7 @@ function digiline:transmit(pos, channel, msg, checked) if checked[checkedid] then return end checked[checkedid] = true - local node = minetest.env:get_node(pos) + local node = minetest.get_node(pos) local spec = digiline:getspec(node) if not spec then return end diff --git a/digilines/wires_common.lua b/digilines/wires_common.lua index 4370241..eac28d9 100644 --- a/digilines/wires_common.lua +++ b/digilines/wires_common.lua @@ -42,7 +42,7 @@ function digiline:update_autoconnect(pos, secondcall) digiline:update_autoconnect(zmympos, true) end - local digilinespec = minetest.registered_nodes[minetest.env:get_node(pos).name].digiline + local digilinespec = minetest.registered_nodes[minetest.get_node(pos).name].digiline if not digilinespec then return nil end if not digilinespec.wire then return nil end @@ -80,5 +80,5 @@ function digiline:update_autoconnect(pos, secondcall) tostring(xpy)..tostring(zpy)..tostring(xmy)..tostring(zmy) - minetest.env:set_node(pos, {name = digilinespec.wire.basename..nodeid}) + minetest.set_node(pos, {name = digilinespec.wire.basename..nodeid}) end diff --git a/digilines_lcd/init.lua b/digilines_lcd/init.lua index 447f01f..bcd9e47 100644 --- a/digilines_lcd/init.lua +++ b/digilines_lcd/init.lua @@ -33,11 +33,11 @@ local lcds = { } local reset_meta = function(pos) - minetest.env:get_meta(pos):set_string("formspec", "field[channel;Channel;${channel}]") + minetest.get_meta(pos):set_string("formspec", "field[channel;Channel;${channel}]") end local clearscreen = function(pos) - local objects = minetest.env:get_objects_inside_radius(pos, 0.5) + local objects = minetest.get_objects_inside_radius(pos, 0.5) for _, o in ipairs(objects) do if o:get_entity_name() == "digilines_lcd:text" then o:remove() @@ -45,30 +45,33 @@ local clearscreen = function(pos) end end -local prepare_writing = function (pos) - lcd_info = lcds[minetest.env:get_node(pos).param2] +local prepare_writing = function(pos) + lcd_info = lcds[minetest.get_node(pos).param2] if lcd_info == nil then return end - local text = minetest.env:add_entity( + local text = minetest.add_entity( {x = pos.x + lcd_info.delta.x, y = pos.y + lcd_info.delta.y, z = pos.z + lcd_info.delta.z}, "digilines_lcd:text") - text:setyaw (lcd_info.yaw or 0) + text:setyaw(lcd_info.yaw or 0) --* text:setpitch(lcd_info.yaw or 0) return text end local on_digiline_receive = function(pos, node, channel, msg) - local setchan = minetest.env:get_meta(pos):get_string("channel") + local meta = minetest.get_meta(pos) + local setchan = meta:get_string("channel") if setchan ~= channel then return end + meta:set_string("text", msg) clearscreen(pos) - local text = prepare_writing (pos) - text:set_properties({textures={generate_texture(create_lines(msg))}}) + if msg ~= "" then + prepare_writing(pos) + end end local lcd_box = { type = "wallmounted", - wall_top = {-8/16, 7/16, -8/16, 8/16, 8/16, 8/16} + wall_top = {-8/16, 7/16, -8/16, 8/16, 8/16, 8/16} } minetest.register_node("digilines_lcd:lcd", { @@ -83,12 +86,12 @@ minetest.register_node("digilines_lcd:lcd", { paramtype2 = "wallmounted", node_box = lcd_box, selection_box = lcd_box, - groups = {choppy = 3, dig_immediate = 2}, + groups = {choppy = 3, dig_immediate = 2}, after_place_node = function (pos, placer, itemstack) - local param2 = minetest.env:get_node(pos).param2 + local param2 = minetest.get_node(pos).param2 if param2 == 0 or param2 == 1 then - minetest.env:add_node(pos, {name = "digilines_lcd:lcd", param2 = 3}) + minetest.add_node(pos, {name = "digilines_lcd:lcd", param2 = 3}) end prepare_writing (pos) end, @@ -102,7 +105,7 @@ minetest.register_node("digilines_lcd:lcd", { end, on_receive_fields = function(pos, formname, fields, sender) - minetest.env:get_meta(pos):set_string("channel", fields.channel) + minetest.get_meta(pos):set_string("channel", fields.channel) end, digiline = @@ -122,7 +125,7 @@ minetest.register_entity("digilines_lcd:text", { textures = {}, on_activate = function(self) - local meta = minetest.env:get_meta(self.object:getpos()) + local meta = minetest.get_meta(self.object:getpos()) local text = meta:get_string("text") self.object:set_properties({textures={generate_texture(create_lines(text))}}) end diff --git a/digilines_lightsensor/init.lua b/digilines_lightsensor/init.lua index 8db748e..2bbbc27 100644 --- a/digilines_lightsensor/init.lua +++ b/digilines_lightsensor/init.lua @@ -22,9 +22,9 @@ local lsensor_selbox = } local on_digiline_receive = function (pos, node, channel, msg) - local setchan = minetest.env:get_meta(pos):get_string("channel") + local setchan = minetest.get_meta(pos):get_string("channel") if channel == setchan and msg == GET_COMMAND then - local lightval = minetest.env:get_node_light(pos) + local lightval = minetest.get_node_light(pos) digiline:receptor_send(pos, digiline.rules.default, channel, lightval) end end @@ -46,11 +46,11 @@ minetest.register_node("digilines_lightsensor:lightsensor", { }, }, on_construct = function(pos) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) meta:set_string("formspec", "field[channel;Channel;${channel}]") end, on_receive_fields = function(pos, formname, fields, sender) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) fields.channel = fields.channel or "" meta:set_string("channel", fields.channel) end, diff --git a/digilines_rtc/init.lua b/digilines_rtc/init.lua index b2b21ec..40e84d0 100644 --- a/digilines_rtc/init.lua +++ b/digilines_rtc/init.lua @@ -17,9 +17,9 @@ local rtc_selbox = } local on_digiline_receive = function (pos, node, channel, msg) - local setchan = minetest.env:get_meta(pos):get_string("channel") + local setchan = minetest.get_meta(pos):get_string("channel") if channel == setchan and msg == GET_COMMAND then - local timeofday = minetest.env:get_timeofday() + local timeofday = minetest.get_timeofday() digiline:receptor_send(pos, digiline.rules.default, channel, timeofday) end end @@ -42,11 +42,11 @@ minetest.register_node("digilines_rtc:rtc", { }, }, on_construct = function(pos) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) meta:set_string("formspec", "field[channel;Channel;${channel}]") end, on_receive_fields = function(pos, formname, fields, sender) - local meta = minetest.env:get_meta(pos) + local meta = minetest.get_meta(pos) fields.channel = fields.channel or "" meta:set_string("channel", fields.channel) end, |