2020-01-26 01:22:06 +03:00
|
|
|
--[[
|
|
|
|
|
|
|
|
TechAge
|
|
|
|
=======
|
|
|
|
|
|
|
|
Copyright (C) 2019-2020 Joachim Stolberg
|
|
|
|
|
2020-10-19 20:09:17 +03:00
|
|
|
AGPL v3
|
2020-01-26 01:22:06 +03:00
|
|
|
See LICENSE.txt for more information
|
|
|
|
|
|
|
|
TA3 Power Switch Box
|
|
|
|
]]--
|
|
|
|
|
|
|
|
-- for lazy programmers
|
|
|
|
local S2P = minetest.string_to_pos
|
|
|
|
local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
|
|
local M = minetest.get_meta
|
|
|
|
local N = function(pos) return minetest.get_node(pos).name end
|
|
|
|
local S = techage.S
|
|
|
|
|
|
|
|
local Cable = techage.ElectricCable
|
|
|
|
|
2020-01-26 22:15:40 +03:00
|
|
|
-- primary power node
|
2020-01-26 01:22:06 +03:00
|
|
|
minetest.register_node("techage:powerswitch_box", {
|
|
|
|
description = S("TA Power Switch Box"),
|
|
|
|
tiles = {
|
|
|
|
-- up, down, right, left, back, front
|
2020-01-26 22:15:40 +03:00
|
|
|
'techage_electric_switch.png^[transformR90',
|
|
|
|
'techage_electric_switch.png^[transformR90',
|
2020-01-26 01:22:06 +03:00
|
|
|
'techage_electric_switch.png',
|
|
|
|
'techage_electric_switch.png',
|
|
|
|
'techage_electric_junction.png',
|
|
|
|
'techage_electric_junction.png',
|
|
|
|
},
|
|
|
|
|
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
2020-01-26 22:15:40 +03:00
|
|
|
{ -1/4, -1/4, -2/4, 1/4, 1/4, 2/4},
|
2020-01-26 01:22:06 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2020-01-26 22:15:40 +03:00
|
|
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
|
|
|
if not Cable:after_place_tube(pos, placer, pointed_thing) then
|
|
|
|
minetest.remove_node(pos)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
return false
|
2020-01-26 01:22:06 +03:00
|
|
|
end,
|
|
|
|
|
2020-01-26 22:15:40 +03:00
|
|
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
|
|
|
Cable:after_dig_tube(pos, oldnode, oldmetadata)
|
|
|
|
end,
|
2020-01-26 01:22:06 +03:00
|
|
|
|
|
|
|
paramtype = "light",
|
2021-03-17 21:36:47 +03:00
|
|
|
use_texture_alpha = "clip",
|
2020-01-26 01:22:06 +03:00
|
|
|
sunlight_propagates = true,
|
2020-01-26 22:15:40 +03:00
|
|
|
on_rotate = screwdriver.disallow, -- important!
|
2020-01-26 01:22:06 +03:00
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = {choppy=2, cracky=2, crumbly=2, techage_trowel = 1},
|
|
|
|
is_ground_content = false,
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
})
|
|
|
|
|
2020-01-26 22:15:40 +03:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "techage:powerswitch_box",
|
|
|
|
recipe = {
|
|
|
|
{"", "basic_materials:plastic_sheet", ""},
|
|
|
|
{"techage:electric_cableS", "basic_materials:copper_wire", "techage:electric_cableS"},
|
|
|
|
{"", "basic_materials:plastic_sheet", ""},
|
|
|
|
},
|
|
|
|
})
|