Add conducting rails

This commit is contained in:
cheapie 2021-02-05 14:08:39 -06:00
parent 5283abb6f3
commit 5733785f3f
22 changed files with 140 additions and 0 deletions

9
README

@ -28,6 +28,9 @@ This mod adds several types of rails for use with the existing carts from minete
-- When powered via mesecons while the cart is still stopped on it, causes the cart to resume moving with its previous speed.
-- If left powered, acts as a normal rail.
* Mesecons Conducting Rail
-- Acts as a normal rail (does not specially affect the cart) but conducts mesecons signals.
* Digilines Controlled Rail (available only if digilines is installed)
-- Sends a table on its set channel when passed over by a cart, including the following elements:
---- pos: Exact position of the cart
@ -39,3 +42,9 @@ This mod adds several types of rails for use with the existing carts from minete
---- "power1" through "power15": Causes the rail to act as a powered rail. The power of a normal powered rail is 5.
---- "brake1" through "brake15": Causes the rail to act as a brake rail. The power of a normal brake rail is 5.
---- "idle" (also "power0" or "brake0"): Causes the rail to act as a normal rail, applying no power or braking force.
* Digilines Conducting Rail (available only if digilines is installed)
-- Acts as a normal rail (does not specially affect the cart) but conducts digilines signals.
* Mesecons and Digilines Conducting Rail (available only if digilines is installed)
-- Acts as a normal rail (does not specially affect the cart) but conducts both mesecons and digilines signals.

131
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB