From 5733785f3f467b4e279296357e536e8fb267e228 Mon Sep 17 00:00:00 2001 From: cheapie Date: Fri, 5 Feb 2021 14:08:39 -0600 Subject: Add conducting rails --- init.lua | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 324e451..fae5faf 100644 --- a/init.lua +++ b/init.lua @@ -10,6 +10,45 @@ local mesecons_rules = { {x = 0,y = -1,z = 0,}, } +carts:register_rail("mesecons_carts:mese_cond_rail_off", { + description = "Mesecons Conducting Rail", + tiles = { + "mesecons_carts_mese_cond_off_straight.png", + "mesecons_carts_mese_cond_off_curve.png", + "mesecons_carts_mese_cond_off_tjunction.png", + "mesecons_carts_mese_cond_off_crossing.png", + }, + groups = carts:get_rail_groups(), + mesecons = { + conductor = { + rules = mesecons_rules, + state = mesecon.state.off, + onstate = "mesecons_carts:mese_cond_rail_on", + offstate = "mesecons_carts:mese_cond_rail_off", + }, + }, +}, {}) + +carts:register_rail("mesecons_carts:mese_cond_rail_on", { + description = "Mesecons Conducting Rail (on state - you hacker you!)", + tiles = { + "mesecons_carts_mese_cond_on_straight.png", + "mesecons_carts_mese_cond_on_curve.png", + "mesecons_carts_mese_cond_on_tjunction.png", + "mesecons_carts_mese_cond_on_crossing.png", + }, + drop = "mesecons_carts:mese_cond_rail_off", + groups = carts:get_rail_groups({not_in_creative_inventory = 1,}), + mesecons = { + conductor = { + rules = mesecons_rules, + state = mesecon.state.on, + onstate = "mesecons_carts:mese_cond_rail_on", + offstate = "mesecons_carts:mese_cond_rail_off", + }, + }, +}, {}) + carts:register_rail("mesecons_carts:power_rail_off", { description = "Mesecons-Controlled Powered Rail", tiles = { @@ -361,6 +400,15 @@ minetest.register_craft({ }, }) +minetest.register_craft({ + output = "mesecons_carts:mese_cond_rail_off 6", + recipe = { + {"carts:rail","mesecons:wire_00000000_off","carts:rail",}, + {"carts:rail","mesecons:wire_00000000_off","carts:rail",}, + {"carts:rail","mesecons:wire_00000000_off","carts:rail",}, + }, +}) + if minetest.get_modpath("digilines") then local digilines_rules = { {x = 1,y = 0,z = 0,}, @@ -379,6 +427,71 @@ if minetest.get_modpath("digilines") then {x = 0,y = 1,z = 0,}, } + carts:register_rail("mesecons_carts:mese_digi_cond_rail_off", { + description = "Mesecons and Digilines Conducting Rail", + tiles = { + "mesecons_carts_mese_digi_cond_off_straight.png", + "mesecons_carts_mese_digi_cond_off_curve.png", + "mesecons_carts_mese_digi_cond_off_tjunction.png", + "mesecons_carts_mese_digi_cond_off_crossing.png", + }, + groups = carts:get_rail_groups(), + mesecons = { + conductor = { + rules = mesecons_rules, + state = mesecon.state.off, + onstate = "mesecons_carts:mese_digi_cond_rail_on", + offstate = "mesecons_carts:mese_digi_cond_rail_off", + }, + }, + digiline = { + wire = { + rules = digilines_rules, + }, + }, + }, {}) + + carts:register_rail("mesecons_carts:mese_digi_cond_rail_on", { + description = "Mesecons and Digilines Conducting Rail (on state - you hacker you!)", + tiles = { + "mesecons_carts_mese_digi_cond_on_straight.png", + "mesecons_carts_mese_digi_cond_on_curve.png", + "mesecons_carts_mese_digi_cond_on_tjunction.png", + "mesecons_carts_mese_digi_cond_on_crossing.png", + }, + drop = "mesecons_carts:mese_digi_cond_rail_off", + groups = carts:get_rail_groups({not_in_creative_inventory = 1,}), + mesecons = { + conductor = { + rules = mesecons_rules, + state = mesecon.state.on, + onstate = "mesecons_carts:mese_digi_cond_rail_on", + offstate = "mesecons_carts:mese_digi_cond_rail_off", + }, + }, + digiline = { + wire = { + rules = digilines_rules, + }, + }, + }, {}) + + carts:register_rail("mesecons_carts:digi_cond_rail", { + description = "Digilines Conducting Rail", + tiles = { + "mesecons_carts_digi_cond_straight.png", + "mesecons_carts_digi_cond_curve.png", + "mesecons_carts_digi_cond_tjunction.png", + "mesecons_carts_digi_cond_crossing.png", + }, + groups = carts:get_rail_groups(), + digiline = { + wire = { + rules = digilines_rules, + }, + }, + }, {}) + local function digilinesrail_onstep(cart,dtime) local cartpos = cart.object:get_pos() local trackpos = {} @@ -560,4 +673,22 @@ if minetest.get_modpath("digilines") then {"carts:rail","default:sand","",}, }, }) + minetest.register_craft({ + output = "mesecons_carts:digi_cond_rail 6", + recipe = { + {"carts:rail","digilines:wire_std_00000000","carts:rail",}, + {"carts:rail","digilines:wire_std_00000000","carts:rail",}, + {"carts:rail","digilines:wire_std_00000000","carts:rail",}, + }, + }) + minetest.register_craft({ + output = "mesecons_carts:mese_digi_cond_rail_off", + type = "shapeless", + recipe = {"mesecons_carts:mese_cond_rail_off","digilines:wire_std_00000000",}, + }) + minetest.register_craft({ + output = "mesecons_carts:mese_digi_cond_rail_off", + type = "shapeless", + recipe = {"mesecons_carts:digi_cond_rail","mesecons:wire_00000000_off",}, + }) end -- cgit v1.2.3