power line nodes added
parent
cd96067fe0
commit
7ce72287be
1
init.lua
1
init.lua
|
@ -47,6 +47,7 @@ else
|
||||||
dofile(MP.."/power/steam_pipe.lua")
|
dofile(MP.."/power/steam_pipe.lua")
|
||||||
dofile(MP.."/power/biogas_pipe.lua")
|
dofile(MP.."/power/biogas_pipe.lua")
|
||||||
dofile(MP.."/power/electric_cable.lua")
|
dofile(MP.."/power/electric_cable.lua")
|
||||||
|
dofile(MP.."/power/power_line.lua")
|
||||||
dofile(MP.."/power/junctionbox.lua")
|
dofile(MP.."/power/junctionbox.lua")
|
||||||
dofile(MP.."/power/powerswitch.lua")
|
dofile(MP.."/power/powerswitch.lua")
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,14 @@ local Cable = tubelib2.Tube:new({
|
||||||
max_tube_length = 1000,
|
max_tube_length = 1000,
|
||||||
show_infotext = false,
|
show_infotext = false,
|
||||||
tube_type = "electric_cable",
|
tube_type = "electric_cable",
|
||||||
primary_node_names = {"techage:electric_cableS", "techage:electric_cableA"},
|
primary_node_names = {"techage:electric_cableS", "techage:electric_cableA", "techage:power_line"},
|
||||||
secondary_node_names = {},
|
secondary_node_names = {},
|
||||||
after_place_tube = function(pos, param2, tube_type, num_tubes)
|
after_place_tube = function(pos, param2, tube_type, num_tubes)
|
||||||
|
-- Don't replace "power line" nodes
|
||||||
|
if minetest.get_node(pos).name == "techage:power_line" then
|
||||||
|
M(pos):set_int("tl2_param2", param2)
|
||||||
|
return
|
||||||
|
end
|
||||||
-- Don't replace "hidden" cable
|
-- Don't replace "hidden" cable
|
||||||
if M(pos):get_string("techage_hidden_nodename") == "" then
|
if M(pos):get_string("techage_hidden_nodename") == "" then
|
||||||
minetest.swap_node(pos, {name = "techage:electric_cable"..tube_type, param2 = param2 % 32})
|
minetest.swap_node(pos, {name = "techage:electric_cable"..tube_type, param2 = param2 % 32})
|
||||||
|
|
|
@ -0,0 +1,110 @@
|
||||||
|
--[[
|
||||||
|
|
||||||
|
TechAge
|
||||||
|
=======
|
||||||
|
|
||||||
|
Copyright (C) 2019 Joachim Stolberg
|
||||||
|
|
||||||
|
LGPLv2.1+
|
||||||
|
See LICENSE.txt for more information
|
||||||
|
|
||||||
|
TA3/TA4 Power line for electrical landline
|
||||||
|
]]--
|
||||||
|
|
||||||
|
-- for lazy programmers
|
||||||
|
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||||
|
local P = minetest.string_to_pos
|
||||||
|
local M = minetest.get_meta
|
||||||
|
|
||||||
|
-- Load support for intllib.
|
||||||
|
local MP = minetest.get_modpath("techage")
|
||||||
|
local I,_ = dofile(MP.."/intllib.lua")
|
||||||
|
|
||||||
|
local Cable = techage.ElectricCable
|
||||||
|
|
||||||
|
|
||||||
|
-- Primary techage.ElectricCable node
|
||||||
|
minetest.register_node("techage:power_line", {
|
||||||
|
description = I("TA Power Line"),
|
||||||
|
tiles = {"techage_power_line.png"},
|
||||||
|
inventory_image = 'techage_power_line_inv.png',
|
||||||
|
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
|
||||||
|
end,
|
||||||
|
|
||||||
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||||
|
if oldmetadata and oldmetadata.fields and oldmetadata.fields.tl2_param2 then
|
||||||
|
oldnode.param2 = oldmetadata.fields.tl2_param2
|
||||||
|
Cable:after_dig_tube(pos, oldnode)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
paramtype2 = "facedir", -- important!
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-1/32, -1/32, -4/8, 1/32, 1/32, 4/8},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-2/32, -2/32, -4/8, 2/32, 2/32, 4/8},
|
||||||
|
},
|
||||||
|
on_rotate = screwdriver.disallow, -- important!
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3},
|
||||||
|
sounds = default.node_sound_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("techage:power_pole", {
|
||||||
|
description = I("TA Power Pole"),
|
||||||
|
--tiles = {"techage_power_pole.png"},
|
||||||
|
tiles = {
|
||||||
|
"default_wood.png^techage_power_pole_top.png",
|
||||||
|
"default_wood.png^techage_power_pole_top.png",
|
||||||
|
"default_wood.png^techage_power_pole.png"
|
||||||
|
},
|
||||||
|
|
||||||
|
paramtype2 = "facedir", -- important!
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{ -4/32, -16/32, -4/32, 4/32, 16/32, 4/32},
|
||||||
|
{-16/32, -6/32, -1/32, 16/32, -4/32, 1/32},
|
||||||
|
{ -1/32, -6/32, -16/32, 1/32, -4/32, 16/32},
|
||||||
|
{-16/32, -4/32, -2/32, -12/32, 4/32, 2/32},
|
||||||
|
{ 12/32, -4/32, -2/32, 16/32, 4/32, 2/32},
|
||||||
|
{ -2/32, -4/32, -16/32, 2/32, 4/32, -12/32},
|
||||||
|
{ -2/32, -4/32, 12/32, 2/32, 4/32, 16/32},
|
||||||
|
--{ -1/32, -1/32, -4/8, 1/32, 1/32, 4/8},
|
||||||
|
--{ -4/8, -1/32, -1/32, 4/8, 1/32, 1/32},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
on_rotate = screwdriver.disallow, -- important!
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {cracky=2, crumbly=2, choppy=2},
|
||||||
|
sounds = default.node_sound_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
techage.power.register_node({"techage:power_pole"}, {
|
||||||
|
power_network = Cable,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techage:power_line 24",
|
||||||
|
recipe = {
|
||||||
|
{"default:copper_ingot", "", ""},
|
||||||
|
{"", "default:copper_ingot", ""},
|
||||||
|
{"", "", "default:copper_ingot"},
|
||||||
|
},
|
||||||
|
})
|
Binary file not shown.
After Width: | Height: | Size: 192 B |
Binary file not shown.
After Width: | Height: | Size: 607 B |
Binary file not shown.
After Width: | Height: | Size: 190 B |
Binary file not shown.
After Width: | Height: | Size: 241 B |
Loading…
Reference in New Issue