2024-05-04 06:52:48 +02:00
local modname = minetest.get_current_modname ( )
local mod = mcl_minecarts
local S = minetest.get_translator ( modname )
local rail_rules_short = mesecon.rules . pplate
-- Detector rail (off)
2024-11-09 22:14:57 +01:00
mod.register_curves_rail ( " mcl_minecarts:detector_rail_v2 " , {
" mcl_minecarts_rail_detector.png " ,
" mcl_minecarts_rail_detector_curved.png " ,
" mcl_minecarts_rail_detector_t_junction.png " ,
" mcl_minecarts_rail_detector_t_junction.png " ,
" mcl_minecarts_rail_detector_crossing.png "
} , {
2024-05-04 06:52:48 +02:00
description = S ( " Detector Rail " ) ,
_tt_help = S ( " Track for minecarts " ) .. " \n " .. S ( " Emits redstone power when a minecart is detected " ) ,
_doc_items_longdesc = S ( " Rails can be used to build transport tracks for minecarts. A detector rail is able to detect a minecart above it and powers redstone mechanisms. " ) ,
_doc_items_usagehelp = mod.text . railuse .. " \n " .. S ( " To detect a minecart and provide redstone power, connect it to redstone trails or redstone mechanisms and send any minecart over the rail. " ) ,
mesecons = {
receptor = {
state = mesecon.state . off ,
rules = rail_rules_short ,
} ,
} ,
_mcl_minecarts_on_enter = function ( pos , cart )
local node = minetest.get_node ( pos )
2024-11-09 22:14:57 +01:00
local node_def = minetest.registered_nodes [ node.name ]
node.name = " mcl_minecarts:detector_rail_v2_on " .. node_def._mcl_minecarts . suffix
2024-11-09 19:33:39 +01:00
minetest.set_node ( pos , node )
2024-05-04 06:52:48 +02:00
mesecon.receptor_on ( pos )
end ,
craft = {
output = " mcl_minecarts:detector_rail_v2 6 " ,
recipe = {
{ " mcl_core:iron_ingot " , " " , " mcl_core:iron_ingot " } ,
{ " mcl_core:iron_ingot " , " mesecons_pressureplates:pressure_plate_stone_off " , " mcl_core:iron_ingot " } ,
{ " mcl_core:iron_ingot " , " mesecons:redstone " , " mcl_core:iron_ingot " } ,
}
}
} )
-- Detector rail (on)
2024-11-09 22:14:57 +01:00
mod.register_curves_rail ( " mcl_minecarts:detector_rail_v2_on " , {
" mcl_minecarts_rail_detector_powered.png " ,
" mcl_minecarts_rail_detector_curved_powered.png " ,
" mcl_minecarts_rail_detector_t_junction_powered.png " ,
" mcl_minecarts_rail_detector_t_junction_powered.png " ,
" mcl_minecarts_rail_detector_crossing_powered.png "
} , {
2024-12-31 01:21:39 +01:00
description = S ( " Detector Rail " ) ,
2024-05-04 06:52:48 +02:00
groups = {
not_in_creative_inventory = 1 ,
} ,
_doc_items_create_entry = false ,
mesecons = {
receptor = {
state = mesecon.state . on ,
rules = rail_rules_short ,
} ,
} ,
_mcl_minecarts_on_leave = function ( pos , cart )
local node = minetest.get_node ( pos )
2024-11-09 22:14:57 +01:00
local node_def = minetest.registered_nodes [ node.name ]
node.name = " mcl_minecarts:detector_rail_v2 " .. node_def._mcl_minecarts . suffix
2024-11-09 19:33:39 +01:00
minetest.set_node ( pos , node )
2024-05-04 06:52:48 +02:00
mesecon.receptor_off ( pos )
end ,
drop = " mcl_minecarts:detector_rail_v2 " ,
} )