mirror of
https://github.com/minetest-mods/technic.git
synced 2025-02-23 07:10:19 +01:00
#14 HV digicables
This commit is contained in:
parent
0904fc3a61
commit
c3bed5d5c2
@ -1,3 +1,4 @@
|
|||||||
|
local S = technic.getter
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:hv_cable 3',
|
output = 'technic:hv_cable 3',
|
||||||
@ -10,3 +11,26 @@ minetest.register_craft({
|
|||||||
|
|
||||||
technic.register_cable("HV", 3/16)
|
technic.register_cable("HV", 3/16)
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'technic:hv_digi_cable 1',
|
||||||
|
recipe = {
|
||||||
|
{'digilines:wire_std_00000000', 'digilines:wire_std_00000000', 'digilines:wire_std_00000000'},
|
||||||
|
{'digilines:wire_std_00000000', 'technic:hv_cable', 'digilines:wire_std_00000000'},
|
||||||
|
{'digilines:wire_std_00000000', 'digilines:wire_std_00000000', 'digilines:wire_std_00000000'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
technic.register_cable("HV", 3/16, S("HV Cable (digiline)"), "_digi", {
|
||||||
|
digiline = {
|
||||||
|
wire = {
|
||||||
|
rules = {
|
||||||
|
{x = 1, y = 0, z = 0},
|
||||||
|
{x =-1, y = 0, z = 0},
|
||||||
|
{x = 0, y = 1, z = 0},
|
||||||
|
{x = 0, y =-1, z = 0},
|
||||||
|
{x = 0, y = 0, z = 1},
|
||||||
|
{x = 0, y = 0, z =-1}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
@ -130,9 +130,20 @@ local function item_place_override_node(itemstack, placer, pointed, node)
|
|||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
function technic.register_cable(tier, size)
|
local function override_table(target, source)
|
||||||
|
if target and source then
|
||||||
|
for k,v in pairs(source) do
|
||||||
|
target[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return target
|
||||||
|
end
|
||||||
|
|
||||||
|
function technic.register_cable(tier, size, description, prefix, override_cable, override_cable_plate)
|
||||||
|
prefix = prefix or ""
|
||||||
|
override_cable_plate = override_cable_plate or override_cable
|
||||||
local ltier = string.lower(tier)
|
local ltier = string.lower(tier)
|
||||||
cable_tier["technic:"..ltier.."_cable"] = tier
|
cable_tier["technic:"..ltier..prefix.."_cable"] = tier
|
||||||
|
|
||||||
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||||
["technic_"..ltier.."_cable"] = 1}
|
["technic_"..ltier.."_cable"] = 1}
|
||||||
@ -148,14 +159,14 @@ function technic.register_cable(tier, size)
|
|||||||
connect_right = {-size, -size, -size, 0.5, size, size}, -- x+
|
connect_right = {-size, -size, -size, 0.5, size, size}, -- x+
|
||||||
}
|
}
|
||||||
|
|
||||||
minetest.register_node("technic:"..ltier.."_cable", {
|
minetest.register_node("technic:"..ltier..prefix.."_cable", override_table({
|
||||||
description = S("%s Cable"):format(tier),
|
description = S("%s Cable"):format(tier),
|
||||||
tiles = {"technic_"..ltier.."_cable.png"},
|
tiles = {"technic_"..ltier..prefix.."_cable.png"},
|
||||||
inventory_image = "technic_"..ltier.."_cable_wield.png",
|
inventory_image = "technic_"..ltier..prefix.."_cable_wield.png",
|
||||||
wield_image = "technic_"..ltier.."_cable_wield.png",
|
wield_image = "technic_"..ltier..prefix.."_cable_wield.png",
|
||||||
groups = groups,
|
groups = groups,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
drop = "technic:"..ltier.."_cable",
|
drop = "technic:"..ltier..prefix.."_cable",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
@ -164,7 +175,7 @@ function technic.register_cable(tier, size)
|
|||||||
"group:technic_"..ltier, "group:technic_all_tiers"},
|
"group:technic_"..ltier, "group:technic_all_tiers"},
|
||||||
on_construct = clear_networks,
|
on_construct = clear_networks,
|
||||||
on_destruct = clear_networks,
|
on_destruct = clear_networks,
|
||||||
})
|
}, override_cable))
|
||||||
|
|
||||||
local xyz = {
|
local xyz = {
|
||||||
["-x"] = 1,
|
["-x"] = 1,
|
||||||
@ -192,10 +203,10 @@ function technic.register_cable(tier, size)
|
|||||||
for p, i in pairs(xyz) do
|
for p, i in pairs(xyz) do
|
||||||
local def = {
|
local def = {
|
||||||
description = S("%s Cable Plate"):format(tier),
|
description = S("%s Cable Plate"):format(tier),
|
||||||
tiles = {"technic_"..ltier.."_cable.png"},
|
tiles = {"technic_"..ltier..prefix.."_cable.png"},
|
||||||
groups = table.copy(groups),
|
groups = table.copy(groups),
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
drop = "technic:"..ltier.."_cable_plate_1",
|
drop = "technic:"..ltier..prefix.."_cable_plate_1",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
@ -244,7 +255,7 @@ function technic.register_cable(tier, size)
|
|||||||
if num == nil then num = 1 end
|
if num == nil then num = 1 end
|
||||||
return item_place_override_node(
|
return item_place_override_node(
|
||||||
itemstack, placer, pointed_thing,
|
itemstack, placer, pointed_thing,
|
||||||
{name = "technic:"..ltier.."_cable_plate_"..num}
|
{name = "technic:"..ltier..prefix.."_cable_plate_"..num}
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -261,15 +272,15 @@ function technic.register_cable(tier, size)
|
|||||||
num = num + dir
|
num = num + dir
|
||||||
num = (num >= 1 and num) or num + 6
|
num = (num >= 1 and num) or num + 6
|
||||||
num = (num <= 6 and num) or num - 6
|
num = (num <= 6 and num) or num - 6
|
||||||
minetest.swap_node(pos, {name = "technic:"..ltier.."_cable_plate_"..num})
|
minetest.swap_node(pos, {name = "technic:"..ltier..prefix.."_cable_plate_"..num})
|
||||||
end
|
end
|
||||||
minetest.register_node("technic:"..ltier.."_cable_plate_"..i, def)
|
minetest.register_node("technic:"..ltier..prefix.."_cable_plate_"..i, override_table(def, override_cable_plate))
|
||||||
cable_tier["technic:"..ltier.."_cable_plate_"..i] = tier
|
cable_tier["technic:"..ltier..prefix.."_cable_plate_"..i] = tier
|
||||||
end
|
end
|
||||||
|
|
||||||
local c = "technic:"..ltier.."_cable"
|
local c = "technic:"..ltier..prefix.."_cable"
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "technic:"..ltier.."_cable_plate_1 5",
|
output = "technic:"..ltier..prefix.."_cable_plate_1 5",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"", "", c},
|
{"", "", c},
|
||||||
{c , c , c},
|
{c , c , c},
|
||||||
@ -280,7 +291,7 @@ function technic.register_cable(tier, size)
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = c,
|
output = c,
|
||||||
recipe = {
|
recipe = {
|
||||||
{"technic:"..ltier.."_cable_plate_1"},
|
{"technic:"..ltier..prefix.."_cable_plate_1"},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
BIN
technic/textures/technic_hv_digi_cable.png
Normal file
BIN
technic/textures/technic_hv_digi_cable.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
BIN
technic/textures/technic_hv_digi_cable_wield.png
Normal file
BIN
technic/textures/technic_hv_digi_cable_wield.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
Loading…
x
Reference in New Issue
Block a user