From 90c21db8c0e1c33da10f216df268fdec83e45f91 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Sat, 24 Aug 2019 10:54:20 +0200 Subject: [PATCH] nodes renamed --- logic/button.lua | 16 ++++++++-------- logic/detector.lua | 18 +++++++++--------- logic/repeater.lua | 10 +++++----- tools/repairkit.lua | 21 +++++++++++++++++++-- 4 files changed, 41 insertions(+), 24 deletions(-) diff --git a/logic/button.lua b/logic/button.lua index e4d5907..30af6ac 100644 --- a/logic/button.lua +++ b/logic/button.lua @@ -20,7 +20,7 @@ local logic = techage.logic local function switch_on(pos) local cycle_time = M(pos):get_int("cycle_time") - logic.swap_node(pos, "techage:button_on") + logic.swap_node(pos, "techage:ta3_button_on") logic.send_on(pos, M(pos), cycle_time) minetest.sound_play("techage_button", { pos = pos, @@ -30,7 +30,7 @@ local function switch_on(pos) end local function switch_off(pos) - logic.swap_node(pos, "techage:button_off") + logic.swap_node(pos, "techage:ta3_button_off") logic.send_off(pos, M(pos)) end @@ -45,7 +45,7 @@ local function formspec(meta) "button_exit[2,4;3,1;exit;"..S("Save").."]" end -minetest.register_node("techage:button_off", { +minetest.register_node("techage:ta3_button_off", { description = S("TA3 Button/Switch"), tiles = { -- up, down, right, left, back, front @@ -59,7 +59,7 @@ minetest.register_node("techage:button_off", { after_place_node = function(pos, placer) local meta = M(pos) - logic.after_place_node(pos, placer, "techage:button_off", S("TA3 Button/Switch")) + logic.after_place_node(pos, placer, "techage:ta3_button_off", S("TA3 Button/Switch")) logic.infotext(meta, S("TA3 Button/Switch")) meta:set_string("formspec", formspec(meta)) meta:set_string("public", "false") @@ -141,7 +141,7 @@ minetest.register_node("techage:button_off", { }) -minetest.register_node("techage:button_on", { +minetest.register_node("techage:ta3_button_on", { description = ("TA3 Button/Switch"), tiles = { -- up, down, right, left, back, front @@ -182,11 +182,11 @@ minetest.register_node("techage:button_on", { groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1}, is_ground_content = false, sounds = default.node_sound_wood_defaults(), - drop = "techage:button_off", + drop = "techage:ta3_button_off", }) minetest.register_craft({ - output = "techage:button_off", + output = "techage:ta3_button_off", recipe = { {"", "group:wood", ""}, {"default:glass", "techage:vacuum_tube", ""}, @@ -198,4 +198,4 @@ techage.register_entry_page("ta3l", "button", S("TA3 Button/Switch"), S("The Button/Switch is used to send on/off commands to machines/nodes.@n".. "It can be configured as switch or as button with configurable cycle time from 2 to 32s)"), - "techage:button_on") + "techage:ta3_button_on") diff --git a/logic/detector.lua b/logic/detector.lua index cfd60c1..b395a5c 100644 --- a/logic/detector.lua +++ b/logic/detector.lua @@ -23,14 +23,14 @@ local function switch_on(pos) local mem = tubelib2.get_mem(pos) local t = minetest.get_gametime() if t > (mem.time or 0) then - logic.swap_node(pos, "techage:detector_on") + logic.swap_node(pos, "techage:ta3_detector_on") logic.send_on(pos, M(pos), 1) mem.time = t + BLOCKING_TIME end end local function switch_off(pos) - logic.swap_node(pos, "techage:detector_off") + logic.swap_node(pos, "techage:ta3_detector_off") logic.send_off(pos, M(pos)) end @@ -41,7 +41,7 @@ local function formspec(meta) "button_exit[2,2;3,1;exit;"..S("Save").."]" end -minetest.register_node("techage:detector_off", { +minetest.register_node("techage:ta3_detector_off", { description = S("TA3 Detector"), tiles = { -- up, down, right, left, back, front @@ -55,7 +55,7 @@ minetest.register_node("techage:detector_off", { after_place_node = function(pos, placer) local meta = M(pos) - logic.after_place_node(pos, placer, "techage:detector_off", S("TA3 Detector")) + logic.after_place_node(pos, placer, "techage:ta3_detector_off", S("TA3 Detector")) logic.infotext(meta, S("TA3 Detector")) meta:set_string("formspec", formspec(meta)) end, @@ -90,7 +90,7 @@ minetest.register_node("techage:detector_off", { }) -minetest.register_node("techage:detector_on", { +minetest.register_node("techage:ta3_detector_on", { description = S("TA3 Detector"), tiles = { -- up, down, right, left, back, front @@ -120,11 +120,11 @@ minetest.register_node("techage:detector_on", { groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1}, is_ground_content = false, sounds = default.node_sound_wood_defaults(), - drop = "techage:detector_off", + drop = "techage:ta3_detector_off", }) minetest.register_craft({ - output = "techage:detector_off", + output = "techage:ta3_detector_off", recipe = { {"", "group:wood", ""}, {"techage:tubeS", "techage:vacuum_tube", "techage:tubeS"}, @@ -133,7 +133,7 @@ minetest.register_craft({ }) -techage.register_node({"techage:detector_off", "techage:detector_on"}, { +techage.register_node({"techage:ta3_detector_off", "techage:ta3_detector_on"}, { on_push_item = function(pos, in_dir, stack) if techage.push_items(pos, in_dir, stack) then switch_on(pos) @@ -151,4 +151,4 @@ techage.register_entry_page("ta3l", "detector", "It sends an 'on' when an item goes through,@n".. "followed by an 'off' event one second later.@n".. "After that it blocks further events for 8 seconds."), - "techage:detector_on") + "techage:ta3_detector_on") diff --git a/logic/repeater.lua b/logic/repeater.lua index 422c273..424966e 100644 --- a/logic/repeater.lua +++ b/logic/repeater.lua @@ -27,7 +27,7 @@ local function formspec(meta) "button_exit[2,2;3,1;exit;"..S("Save").."]" end -minetest.register_node("techage:repeater", { +minetest.register_node("techage:ta3_repeater", { description = S("TA3 Repeater"), tiles = { -- up, down, right, left, back, front @@ -39,7 +39,7 @@ minetest.register_node("techage:repeater", { after_place_node = function(pos, placer) local meta = M(pos) local mem = tubelib2.get_mem(pos) - logic.after_place_node(pos, placer, "techage:repeater", S("TA3 Repeater")) + logic.after_place_node(pos, placer, "techage:ta3_repeater", S("TA3 Repeater")) logic.infotext(meta, S("TA3 Repeater")) meta:set_string("formspec", formspec(meta)) mem.overload_cnt = 0 @@ -82,7 +82,7 @@ minetest.register_node("techage:repeater", { minetest.register_craft({ - output = "techage:repeater", + output = "techage:ta3_repeater", recipe = { {"", "group:wood", ""}, {"techage:vacuum_tube", "", "techage:vacuum_tube"}, @@ -90,7 +90,7 @@ minetest.register_craft({ }, }) -techage.register_node({"techage:repeater"}, { +techage.register_node({"techage:ta3_repeater"}, { on_recv_message = function(pos, topic, payload) local mem = tubelib2.get_mem(pos) mem.overload_cnt = (mem.overload_cnt or 0) + 1 @@ -114,5 +114,5 @@ techage.register_entry_page("ta3l", "repeater", "to all connected blocks. The list of destination block numbers@n".. "has to be configured, but can easily programmed@n".. "by means of the Programmer."), - "techage:repeater") + "techage:ta3_repeater") diff --git a/tools/repairkit.lua b/tools/repairkit.lua index 8ab3481..a9a8b55 100644 --- a/tools/repairkit.lua +++ b/tools/repairkit.lua @@ -15,15 +15,32 @@ local M = minetest.get_meta local S = techage.S +local Nodes2Convert = { + ["techage:detector_off"] = "techage:ta3_detector_off", + ["techage:detector_on"] = "techage:ta3_detector_on", + ["techage:repeater"] = "techage:ta3_repeater", + ["techage:button_off"] = "techage:ta3_button_off", + ["techage:button_on"] = "techage:ta3_button_on", +} + local function read_state(itemstack, user, pointed_thing) local pos = pointed_thing.under if pos and user then local data = minetest.get_biome_data(pos) if data then - minetest.chat_send_player(user:get_player_name(), S("Position temperature")..": "..math.floor(data.heat).." ") + minetest.chat_send_player(user:get_player_name(), S("Biome")..": "..data.biome..", "..S("Position temperature")..": "..math.floor(data.heat).." ") end local number = techage.get_node_number(pos) - local ndef = minetest.registered_nodes[minetest.get_node(pos).name] + local node = minetest.get_node(pos) + if Nodes2Convert[node.name] then + if minetest.is_protected(pos, user:get_player_name()) then + return + end + node.name = Nodes2Convert[node.name] + minetest.swap_node(pos, node) + return + end + local ndef = minetest.registered_nodes[node.name] if number then if ndef and ndef.description then local info = techage.send_single(number, "info", nil)