mirror of
https://github.com/minetest-mods/technic.git
synced 2025-04-16 09:20:39 +02:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
8d554d2e21
@ -7,11 +7,14 @@ technic.concrete_posts = {}
|
|||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||||
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
|
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end
|
||||||
|
|
||||||
minetest.register_alias("technic:concrete_post", "technic:concrete_post0")
|
for i = 0, 31 do
|
||||||
minetest.register_alias("technic:concrete_post32", "technic:concrete_post12")
|
minetest.register_alias("technic:concrete_post"..i,
|
||||||
minetest.register_alias("technic:concrete_post33", "technic:concrete_post3")
|
"technic:concrete_post")
|
||||||
minetest.register_alias("technic:concrete_post34", "technic:concrete_post28")
|
end
|
||||||
minetest.register_alias("technic:concrete_post35", "technic:concrete_post19")
|
for i = 32, 63 do
|
||||||
|
minetest.register_alias("technic:concrete_post"..i,
|
||||||
|
"technic:concrete_post_with_platform")
|
||||||
|
end
|
||||||
|
|
||||||
local steel_ingot
|
local steel_ingot
|
||||||
if minetest.get_modpath("technic_worldgen") then
|
if minetest.get_modpath("technic_worldgen") then
|
||||||
@ -41,12 +44,12 @@ minetest.register_craft({
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:concrete_post_platform 6',
|
output = 'technic:concrete_post_platform 6',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'technic:concrete','technic:concrete_post0','technic:concrete'},
|
{'technic:concrete','technic:concrete_post','technic:concrete'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:concrete_post0 12',
|
output = 'technic:concrete_post 12',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'default:stone','technic:rebar','default:stone'},
|
{'default:stone','technic:rebar','default:stone'},
|
||||||
{'default:stone','technic:rebar','default:stone'},
|
{'default:stone','technic:rebar','default:stone'},
|
||||||
@ -63,13 +66,6 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
local box_platform = {-0.5, 0.3, -0.5, 0.5, 0.5, 0.5}
|
|
||||||
local box_center = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}
|
|
||||||
local box_x1 = {0, -0.3, -0.1, 0.5, 0.3, 0.1}
|
|
||||||
local box_z1 = {-0.1, -0.3, 0, 0.1, 0.3, 0.5}
|
|
||||||
local box_x2 = {0, -0.3, -0.1, -0.5, 0.3, 0.1}
|
|
||||||
local box_z2 = {-0.1, -0.3, 0, 0.1, 0.3, -0.5}
|
|
||||||
|
|
||||||
minetest.register_craftitem(":technic:rebar", {
|
minetest.register_craftitem(":technic:rebar", {
|
||||||
description = S("Rebar"),
|
description = S("Rebar"),
|
||||||
inventory_image = "technic_rebar.png",
|
inventory_image = "technic_rebar.png",
|
||||||
@ -80,12 +76,6 @@ minetest.register_node(":technic:concrete", {
|
|||||||
tiles = {"technic_concrete_block.png",},
|
tiles = {"technic_concrete_block.png",},
|
||||||
groups = {cracky=1, level=2, concrete=1},
|
groups = {cracky=1, level=2, concrete=1},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
after_place_node = function(pos, placer, itemstack)
|
|
||||||
technic.update_posts(pos, false)
|
|
||||||
end,
|
|
||||||
after_dig_node = function (pos, oldnode, oldmetadata, digger)
|
|
||||||
technic.update_posts(pos, false)
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node(":technic:blast_resistant_concrete", {
|
minetest.register_node(":technic:blast_resistant_concrete", {
|
||||||
@ -93,14 +83,22 @@ minetest.register_node(":technic:blast_resistant_concrete", {
|
|||||||
tiles = {"technic_blast_resistant_concrete_block.png",},
|
tiles = {"technic_blast_resistant_concrete_block.png",},
|
||||||
groups = {cracky=1, level=3, concrete=1},
|
groups = {cracky=1, level=3, concrete=1},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
after_place_node = function(pos, player, itemstack)
|
on_blast = function(pos, intensity)
|
||||||
technic.update_posts(pos, false)
|
if intensity > 1 then
|
||||||
end,
|
minetest.remove_node(pos)
|
||||||
after_dig_node = function (pos, oldnode, oldmetadata, digger)
|
minetest.add_item(pos, "technic:blast_resistant_concrete")
|
||||||
technic.update_posts(pos, false)
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
local box_platform = {-0.5, 0.3, -0.5, 0.5, 0.5, 0.5}
|
||||||
|
local box_post = {-0.15, -0.5, -0.15, 0.15, 0.5, 0.15}
|
||||||
|
local box_front = {-0.1, -0.3, 0, 0.1, 0.3, -0.5}
|
||||||
|
local box_back = {-0.1, -0.3, 0, 0.1, 0.3, 0.5}
|
||||||
|
local box_left = {0, -0.3, -0.1, -0.5, 0.3, 0.1}
|
||||||
|
local box_right = {0, -0.3, -0.1, 0.5, 0.3, 0.1}
|
||||||
|
|
||||||
minetest.register_node(":technic:concrete_post_platform", {
|
minetest.register_node(":technic:concrete_post_platform", {
|
||||||
description = S("Concrete Post Platform"),
|
description = S("Concrete Post Platform"),
|
||||||
tiles = {"technic_concrete_block.png",},
|
tiles = {"technic_concrete_block.png",},
|
||||||
@ -114,161 +112,45 @@ minetest.register_node(":technic:concrete_post_platform", {
|
|||||||
},
|
},
|
||||||
on_place = function (itemstack, placer, pointed_thing)
|
on_place = function (itemstack, placer, pointed_thing)
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
if not technic.concrete_posts[node.name] then
|
if node.name ~= "technic:concrete_post" then
|
||||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||||
end
|
end
|
||||||
local links = technic.concrete_posts[node.name]
|
minetest.set_node(pointed_thing.under, {name="technic:concrete_post_with_platform"})
|
||||||
if links[6] ~= 0 then -- The post already has a platform
|
|
||||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
|
||||||
end
|
|
||||||
local id = technic.get_post_id({links[1], links[2], links[3], links[4], links[5], 1})
|
|
||||||
minetest.set_node(pointed_thing.under, {name="technic:concrete_post"..id})
|
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
placer:set_wielded_item(itemstack)
|
placer:set_wielded_item(itemstack)
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local function gen_post_nodebox(x1, x2, z1, z2, y, platform)
|
|
||||||
local box
|
|
||||||
local xx = x1 + x2
|
|
||||||
local zz = z1 + z2
|
|
||||||
if ((xx == 2 and zz == 0) or (xx == 0 and zz == 2)) and y == 0 then
|
|
||||||
box = {}
|
|
||||||
else
|
|
||||||
box = {box_center}
|
|
||||||
end
|
|
||||||
if x1 ~= 0 then
|
|
||||||
table.insert(box, box_x1)
|
|
||||||
end
|
|
||||||
if x2 ~= 0 then
|
|
||||||
table.insert(box, box_x2)
|
|
||||||
end
|
|
||||||
if z1 ~= 0 then
|
|
||||||
table.insert(box, box_z1)
|
|
||||||
end
|
|
||||||
if z2 ~= 0 then
|
|
||||||
table.insert(box, box_z2)
|
|
||||||
end
|
|
||||||
if platform ~= 0 then
|
|
||||||
table.insert(box, box_platform)
|
|
||||||
end
|
|
||||||
return box
|
|
||||||
end
|
|
||||||
|
|
||||||
local function dig_post_with_platform(pos, oldnode, oldmetadata)
|
|
||||||
oldnode.name = "technic:concrete_post0"
|
|
||||||
minetest.set_node(pos, oldnode)
|
|
||||||
technic.update_posts(pos, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
function technic.posts_should_connect(pos)
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
if technic.concrete_posts[node.name] then
|
|
||||||
return "post"
|
|
||||||
elseif minetest.get_item_group(node.name, "concrete") ~= 0 then
|
|
||||||
return "block"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function technic.get_post_id(links)
|
|
||||||
return (links[1] * 1) + (links[2] * 2)
|
|
||||||
+ (links[3] * 4) + (links[4] * 8)
|
|
||||||
+ (links[5] * 16) + (links[6] * 32)
|
|
||||||
end
|
|
||||||
|
|
||||||
function technic.update_posts(pos, set, secondrun)
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
local link_positions = {
|
|
||||||
{x=pos.x+1, y=pos.y, z=pos.z},
|
|
||||||
{x=pos.x-1, y=pos.y, z=pos.z},
|
|
||||||
{x=pos.x, y=pos.y, z=pos.z+1},
|
|
||||||
{x=pos.x, y=pos.y, z=pos.z-1},
|
|
||||||
{x=pos.x, y=pos.y-1, z=pos.z},
|
|
||||||
{x=pos.x, y=pos.y+1, z=pos.z},
|
|
||||||
}
|
|
||||||
|
|
||||||
local links = {0, 0, 0, 0, 0, 0}
|
|
||||||
|
|
||||||
for i, link_pos in pairs(link_positions) do
|
|
||||||
local connecttype = technic.posts_should_connect(link_pos)
|
|
||||||
if connecttype then
|
|
||||||
links[i] = 1
|
|
||||||
-- Have posts next to us update theirselves,
|
|
||||||
-- but only once. (We don't want to start an
|
|
||||||
-- infinite loop of updates)
|
|
||||||
if not secondrun and connecttype == "post" then
|
|
||||||
technic.update_posts(link_pos, true, true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if links[5] == 1 or links[6] == 1 then
|
|
||||||
links[5] = 1
|
|
||||||
links[6] = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
-- We don't want to set ourselves if we have been removed or we are
|
|
||||||
-- updating a concrete node
|
|
||||||
if set then
|
|
||||||
-- Preserve platform
|
|
||||||
local oldlinks = technic.concrete_posts[node.name]
|
|
||||||
if oldlinks then
|
|
||||||
links[6] = oldlinks[6]
|
|
||||||
end
|
|
||||||
minetest.set_node(pos, {name="technic:concrete_post"
|
|
||||||
..technic.get_post_id(links)})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for x1 = 0, 1 do
|
|
||||||
for x2 = 0, 1 do
|
|
||||||
for z1 = 0, 1 do
|
|
||||||
for z2 = 0, 1 do
|
|
||||||
for y = 0, 1 do
|
|
||||||
for platform = 0, 1 do
|
for platform = 0, 1 do
|
||||||
local links = {x1, x2, z1, z2, y, platform}
|
local after_dig_node = nil
|
||||||
local id = technic.get_post_id(links)
|
if platform == 1 then
|
||||||
technic.concrete_posts["technic:concrete_post"..id] = links
|
after_dig_node = function(pos, old_node)
|
||||||
|
old_node.name = "technic:concrete_post"
|
||||||
local groups = {cracky=1, level=2, concrete_post=1}
|
minetest.set_node(pos, old_node)
|
||||||
if id ~= 0 then
|
|
||||||
groups.not_in_creative_inventory = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
local drop = "technic:concrete_post0"
|
|
||||||
local after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
|
||||||
technic.update_posts(pos, false)
|
|
||||||
end
|
|
||||||
if platform ~= 0 then
|
|
||||||
drop = "technic:concrete_post_platform"
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
|
||||||
dig_post_with_platform(pos, oldnode, oldmetadata)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(":technic:concrete_post"..id, {
|
minetest.register_node(":technic:concrete_post"..(platform == 1 and "_with_platform" or ""), {
|
||||||
description = S("Concrete Post"),
|
description = S("Concrete Post"),
|
||||||
tiles = {"technic_concrete_block.png"},
|
tiles = {"technic_concrete_block.png"},
|
||||||
groups = groups,
|
groups = {cracky=1, level=2, concrete_post=1, not_in_creative_inventory=platform},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
drop = drop,
|
drop = (platform == 1 and "technic:concrete_post_platform" or
|
||||||
|
"technic:concrete_post"),
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
connects_to = {"group:concrete", "group:concrete_post"},
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "connected",
|
||||||
fixed = gen_post_nodebox(x1, x2, z1, z2, y, platform),
|
fixed = {box_post, (platform == 1 and box_platform or nil)},
|
||||||
|
connect_front = box_front,
|
||||||
|
connect_back = box_back,
|
||||||
|
connect_left = box_left,
|
||||||
|
connect_right = box_right,
|
||||||
},
|
},
|
||||||
after_place_node = function(pos, placer, itemstack)
|
|
||||||
technic.update_posts(pos, true)
|
|
||||||
end,
|
|
||||||
after_dig_node = after_dig_node,
|
after_dig_node = after_dig_node,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
@ -1,27 +1,38 @@
|
|||||||
--load config
|
local digit_sep_esc
|
||||||
local sepchar = nil
|
|
||||||
do
|
do
|
||||||
local sepcode = technic.config:get("thousand_separator")
|
local sep = technic.config:get("digit_separator")
|
||||||
--default is SI style
|
sep = tonumber(sep) and string.char(sep) or sep or " "
|
||||||
sepchar = sepcode and string.char(sepcode) or " "
|
-- Escape for gsub
|
||||||
baresepchar = sepchar
|
for magic in ("().%+-*?[^$"):gmatch(".") do
|
||||||
--handling if sepchar is magic...
|
if sep == magic then
|
||||||
for magic in string.gmatch("().%+-*?[^$", ".") do
|
sep = "%"..sep
|
||||||
if sepchar == magic then sepchar = "%"..sepchar end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
digit_sep_esc = sep
|
||||||
|
end
|
||||||
|
|
||||||
-- Only changes name, keeps other params
|
|
||||||
|
function technic.pretty_num(num)
|
||||||
|
local str, k = tostring(num), nil
|
||||||
|
repeat
|
||||||
|
str, k = str:gsub("^(-?%d+)(%d%d%d)", "%1"..digit_sep_esc.."%2")
|
||||||
|
until k == 0
|
||||||
|
return str
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Same as minetest.swap_node, but only changes name
|
||||||
|
-- and doesn't re-set if already set.
|
||||||
function technic.swap_node(pos, name)
|
function technic.swap_node(pos, name)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
if node.name ~= name then
|
if node.name ~= name then
|
||||||
node.name = name
|
node.name = name
|
||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
end
|
end
|
||||||
return node.name
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Fully charge RE chargeable item.
|
|
||||||
|
--- Fully charge RE chargeable item.
|
||||||
-- Must be defined early to reference in item definitions.
|
-- Must be defined early to reference in item definitions.
|
||||||
function technic.refill_RE_charge(stack)
|
function technic.refill_RE_charge(stack)
|
||||||
local max_charge = technic.power_tools[stack:get_name()]
|
local max_charge = technic.power_tools[stack:get_name()]
|
||||||
@ -33,35 +44,83 @@ function technic.refill_RE_charge(stack)
|
|||||||
return stack
|
return stack
|
||||||
end
|
end
|
||||||
|
|
||||||
local function resolve_name(function_name)
|
|
||||||
local a = _G
|
|
||||||
for key in string.gmatch(function_name, "([^%.]+)(%.?)") do
|
|
||||||
if a[key] then
|
|
||||||
a = a[key]
|
|
||||||
else
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return a
|
|
||||||
end
|
|
||||||
|
|
||||||
function technic.function_exists(function_name)
|
-- If the node is loaded, returns it. If it isn't loaded, load it and return nil.
|
||||||
return type(resolve_name(function_name)) == 'function'
|
|
||||||
end
|
|
||||||
|
|
||||||
-- if the node is loaded, returns it. If it isn't loaded, load it and return nil.
|
|
||||||
function technic.get_or_load_node(pos)
|
function technic.get_or_load_node(pos)
|
||||||
local node_or_nil = minetest.get_node_or_nil(pos)
|
local node = minetest.get_node_or_nil(pos)
|
||||||
if node_or_nil then return node_or_nil end
|
if node then return node end
|
||||||
local vm = VoxelManip()
|
local vm = VoxelManip()
|
||||||
local MinEdge, MaxEdge = vm:read_from_map(pos, pos)
|
local MinEdge, MaxEdge = vm:read_from_map(pos, pos)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function technic.prettynum(num)
|
|
||||||
local str, k = tostring(num), nil
|
technic.tube_inject_item = pipeworks.tube_inject_item or function(pos, start_pos, velocity, item)
|
||||||
repeat
|
local tubed = pipeworks.tube_item(vector.new(pos), item)
|
||||||
str, k = str:gsub("^(-?%d+)(%d%d%d)", "%1"..sepchar.."%2")
|
tubed:get_luaentity().start_pos = vector.new(start_pos)
|
||||||
until k == 0
|
tubed:setvelocity(velocity)
|
||||||
return str
|
tubed:setacceleration(vector.new(0, 0, 0))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Based on code by Uberi: https://gist.github.com/Uberi/3125280
|
||||||
|
function technic.trace_node_ray(pos, dir, range)
|
||||||
|
local p = vector.round(pos)
|
||||||
|
local x_step, y_step, z_step = 0, 0, 0
|
||||||
|
local x_component, y_component, z_component = 0, 0, 0
|
||||||
|
local x_intersect, y_intersect, z_intersect = 0, 0, 0
|
||||||
|
|
||||||
|
if dir.x == 0 then
|
||||||
|
x_intersect = math.huge
|
||||||
|
elseif dir.x > 0 then
|
||||||
|
x_step = 1
|
||||||
|
x_component = 1 / dir.x
|
||||||
|
x_intersect = x_component
|
||||||
|
else
|
||||||
|
x_step = -1
|
||||||
|
x_component = 1 / -dir.x
|
||||||
|
end
|
||||||
|
if dir.y == 0 then
|
||||||
|
y_intersect = math.huge
|
||||||
|
elseif dir.y > 0 then
|
||||||
|
y_step = 1
|
||||||
|
y_component = 1 / dir.y
|
||||||
|
y_intersect = y_component
|
||||||
|
else
|
||||||
|
y_step = -1
|
||||||
|
y_component = 1 / -dir.y
|
||||||
|
end
|
||||||
|
if dir.z == 0 then
|
||||||
|
z_intersect = math.huge
|
||||||
|
elseif dir.z > 0 then
|
||||||
|
z_step = 1
|
||||||
|
z_component = 1 / dir.z
|
||||||
|
z_intersect = z_component
|
||||||
|
else
|
||||||
|
z_step = -1
|
||||||
|
z_component = 1 / -dir.z
|
||||||
|
end
|
||||||
|
|
||||||
|
return function()
|
||||||
|
if x_intersect < y_intersect then
|
||||||
|
if x_intersect < z_intersect then
|
||||||
|
p.x = p.x + x_step
|
||||||
|
x_intersect = x_intersect + x_component
|
||||||
|
else
|
||||||
|
p.z = p.z + z_step
|
||||||
|
z_intersect = z_intersect + z_component
|
||||||
|
end
|
||||||
|
elseif y_intersect < z_intersect then
|
||||||
|
p.y = p.y + y_step
|
||||||
|
y_intersect = y_intersect + y_component
|
||||||
|
else
|
||||||
|
p.z = p.z + z_step
|
||||||
|
z_intersect = z_intersect + z_component
|
||||||
|
end
|
||||||
|
if vector.distance(pos, p) > range then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
return p
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@ -2,22 +2,18 @@
|
|||||||
-- namespace: technic
|
-- namespace: technic
|
||||||
-- (c) 2012-2013 by RealBadAngel <mk@realbadangel.pl>
|
-- (c) 2012-2013 by RealBadAngel <mk@realbadangel.pl>
|
||||||
|
|
||||||
|
local load_start = os.clock()
|
||||||
|
|
||||||
technic = rawget(_G, "technic") or {}
|
technic = rawget(_G, "technic") or {}
|
||||||
technic.creative_mode = minetest.setting_getbool("creative_mode")
|
technic.creative_mode = minetest.setting_getbool("creative_mode")
|
||||||
|
|
||||||
technic.tube_inject_item = pipeworks.tube_inject_item or function (pos, start_pos, velocity, item)
|
|
||||||
local tubed = pipeworks.tube_item(vector.new(pos), item)
|
|
||||||
tubed:get_luaentity().start_pos = vector.new(start_pos)
|
|
||||||
tubed:setvelocity(velocity)
|
|
||||||
tubed:setacceleration(vector.new(0, 0, 0))
|
|
||||||
end
|
|
||||||
|
|
||||||
local load_start = os.clock()
|
|
||||||
local modpath = minetest.get_modpath("technic")
|
local modpath = minetest.get_modpath("technic")
|
||||||
technic.modpath = modpath
|
technic.modpath = modpath
|
||||||
|
|
||||||
|
|
||||||
-- Boilerplate to support intllib
|
-- Boilerplate to support intllib
|
||||||
if minetest.get_modpath("intllib") then
|
if rawget(_G, "intllib") then
|
||||||
technic.getter = intllib.Getter()
|
technic.getter = intllib.Getter()
|
||||||
else
|
else
|
||||||
technic.getter = function(s,a,...)if a==nil then return s end a={a,...}return s:gsub("(@?)@(%(?)(%d+)(%)?)",function(e,o,n,c)if e==""then return a[tonumber(n)]..(o==""and c or"")else return"@"..o..n..c end end) end
|
technic.getter = function(s,a,...)if a==nil then return s end a={a,...}return s:gsub("(@?)@(%(?)(%d+)(%)?)",function(e,o,n,c)if e==""then return a[tonumber(n)]..(o==""and c or"")else return"@"..o..n..c end end) end
|
||||||
|
@ -22,9 +22,6 @@ technic.legacy_nodenames = {
|
|||||||
["technic:compressor"] = "technic:lv_compressor",
|
["technic:compressor"] = "technic:lv_compressor",
|
||||||
["technic:compressor_active"] = "technic:lv_compressor_active",
|
["technic:compressor_active"] = "technic:lv_compressor_active",
|
||||||
["technic:hv_battery_box"] = "technic:hv_battery_box0",
|
["technic:hv_battery_box"] = "technic:hv_battery_box0",
|
||||||
["technic:hv_cable"] = "technic:hv_cable0",
|
|
||||||
["technic:lv_cable"] = "technic:lv_cable0",
|
|
||||||
["technic:mv_cable"] = "technic:mv_cable0",
|
|
||||||
["technic:mv_battery_box"] = "technic:mv_battery_box0",
|
["technic:mv_battery_box"] = "technic:mv_battery_box0",
|
||||||
["technic:generator"] = "technic:lv_generator",
|
["technic:generator"] = "technic:lv_generator",
|
||||||
["technic:generator_active"] = "technic:lv_generator_active",
|
["technic:generator_active"] = "technic:lv_generator_active",
|
||||||
@ -36,3 +33,9 @@ for old, new in pairs(technic.legacy_nodenames) do
|
|||||||
minetest.register_alias(old, new)
|
minetest.register_alias(old, new)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for i = 0, 63 do
|
||||||
|
minetest.register_alias("technic:hv_cable"..i, "technic:hv_cable")
|
||||||
|
minetest.register_alias("technic:mv_cable"..i, "technic:mv_cable")
|
||||||
|
minetest.register_alias("technic:lv_cable"..i, "technic:lv_cable")
|
||||||
|
end
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:mv_battery_box0', 'technic:mv_battery_box0', 'technic:mv_battery_box0'},
|
{'technic:mv_battery_box0', 'technic:mv_battery_box0', 'technic:mv_battery_box0'},
|
||||||
{'technic:mv_battery_box0', 'technic:hv_transformer', 'technic:mv_battery_box0'},
|
{'technic:mv_battery_box0', 'technic:hv_transformer', 'technic:mv_battery_box0'},
|
||||||
{'', 'technic:hv_cable0', ''},
|
{'', 'technic:hv_cable', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:hv_cable0 3',
|
output = 'technic:hv_cable 3',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting'},
|
{'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting'},
|
||||||
{'technic:mv_cable0', 'technic:mv_cable0', 'technic:mv_cable0'},
|
{'technic:mv_cable', 'technic:mv_cable', 'technic:mv_cable'},
|
||||||
{'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting'},
|
{'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting', 'homedecor:plastic_sheeting'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -15,7 +15,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{"default:mese", "technic:motor", "default:mese" },
|
{"default:mese", "technic:motor", "default:mese" },
|
||||||
{"technic:deployer_off", "technic:machine_casing", "technic:deployer_off"},
|
{"technic:deployer_off", "technic:machine_casing", "technic:deployer_off"},
|
||||||
{"default:mese", "technic:hv_cable0", "default:mese" },
|
{"default:mese", "technic:hv_cable", "default:mese" },
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ end
|
|||||||
minetest.register_node("technic:forcefield_emitter_off", {
|
minetest.register_node("technic:forcefield_emitter_off", {
|
||||||
description = S("%s Forcefield Emitter"):format("HV"),
|
description = S("%s Forcefield Emitter"):format("HV"),
|
||||||
tiles = {"technic_forcefield_emitter_off.png"},
|
tiles = {"technic_forcefield_emitter_off.png"},
|
||||||
groups = {cracky = 1, technic_machine = 1},
|
groups = {cracky = 1, technic_machine = 1, technic_hv = 1},
|
||||||
on_receive_fields = forcefield_receive_fields,
|
on_receive_fields = forcefield_receive_fields,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
@ -215,7 +215,8 @@ minetest.register_node("technic:forcefield_emitter_off", {
|
|||||||
minetest.register_node("technic:forcefield_emitter_on", {
|
minetest.register_node("technic:forcefield_emitter_on", {
|
||||||
description = S("%s Forcefield Emitter"):format("HV"),
|
description = S("%s Forcefield Emitter"):format("HV"),
|
||||||
tiles = {"technic_forcefield_emitter_on.png"},
|
tiles = {"technic_forcefield_emitter_on.png"},
|
||||||
groups = {cracky = 1, technic_machine = 1, not_in_creative_inventory=1},
|
groups = {cracky = 1, technic_machine = 1, technic_hv = 1,
|
||||||
|
not_in_creative_inventory=1},
|
||||||
drop = "technic:forcefield_emitter_off",
|
drop = "technic:forcefield_emitter_off",
|
||||||
on_receive_fields = forcefield_receive_fields,
|
on_receive_fields = forcefield_receive_fields,
|
||||||
on_destruct = function(pos)
|
on_destruct = function(pos)
|
||||||
|
@ -5,7 +5,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:carbon_plate', 'technic:mv_generator', 'technic:composite_plate'},
|
{'technic:carbon_plate', 'technic:mv_generator', 'technic:composite_plate'},
|
||||||
{'pipeworks:tube_1', 'technic:hv_transformer', 'pipeworks:tube_1'},
|
{'pipeworks:tube_1', 'technic:hv_transformer', 'pipeworks:tube_1'},
|
||||||
{'technic:stainless_steel_ingot', 'technic:hv_cable0', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,34 +1,34 @@
|
|||||||
-- The enriched uranium rod driven EU generator.
|
--[[
|
||||||
-- A very large and advanced machine providing vast amounts of power.
|
The enriched uranium rod driven EU generator.
|
||||||
-- Very efficient but also expensive to run as it needs uranium. (10000EU 86400 ticks (one week))
|
A very large and advanced machine providing vast amounts of power.
|
||||||
-- Provides HV EUs that can be down converted as needed.
|
Very efficient but also expensive to run as it needs uranium.
|
||||||
--
|
Provides 10000 HV EUs for one week (only counted when loaded).
|
||||||
-- The nuclear reactor core needs water and a protective shield to work.
|
|
||||||
-- This is checked now and then and if the machine is tampered with... BOOM!
|
|
||||||
|
|
||||||
local burn_ticks = 7 * 24 * 60 * 60 -- (seconds).
|
The nuclear reactor core requires a casing of water and a protective
|
||||||
|
shield to work. This is checked now and then and if the casing is not
|
||||||
|
intact the reactor will melt down!
|
||||||
|
--]]
|
||||||
|
|
||||||
|
local burn_ticks = 7 * 24 * 60 * 60 -- Seconds
|
||||||
local power_supply = 100000 -- EUs
|
local power_supply = 100000 -- EUs
|
||||||
local fuel_type = "technic:uranium_fuel" -- The reactor burns this stuff
|
local fuel_type = "technic:uranium_fuel" -- The reactor burns this
|
||||||
|
|
||||||
local S = technic.getter
|
local S = technic.getter
|
||||||
|
|
||||||
if not vector.length_square then
|
local reactor_desc = S("@1 Nuclear Reactor Core", S("HV")),
|
||||||
vector.length_square = function (v)
|
|
||||||
return v.x*v.x + v.y*v.y + v.z*v.z
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- FIXME: recipe must make more sense like a rod recepticle, steam chamber, HV generator?
|
|
||||||
|
-- FIXME: Recipe should make more sense like a rod recepticle, steam chamber, HV generator?
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:hv_nuclear_reactor_core',
|
output = 'technic:hv_nuclear_reactor_core',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'technic:carbon_plate', 'default:obsidian_glass', 'technic:carbon_plate'},
|
{'technic:carbon_plate', 'default:obsidian_glass', 'technic:carbon_plate'},
|
||||||
{'technic:composite_plate', 'technic:machine_casing', 'technic:composite_plate'},
|
{'technic:composite_plate', 'technic:machine_casing', 'technic:composite_plate'},
|
||||||
{'technic:stainless_steel_ingot', 'technic:hv_cable0', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
local generator_formspec =
|
local reactor_formspec =
|
||||||
"invsize[8,9;]"..
|
"invsize[8,9;]"..
|
||||||
"label[0,0;"..S("Nuclear Reactor Rod Compartment").."]"..
|
"label[0,0;"..S("Nuclear Reactor Rod Compartment").."]"..
|
||||||
"list[current_name;src;2,1;3,2;]"..
|
"list[current_name;src;2,1;3,2;]"..
|
||||||
@ -36,7 +36,7 @@ local generator_formspec =
|
|||||||
"listring[]"
|
"listring[]"
|
||||||
|
|
||||||
-- "Boxy sphere"
|
-- "Boxy sphere"
|
||||||
local nodebox = {
|
local node_box = {
|
||||||
{-0.353, -0.353, -0.353, 0.353, 0.353, 0.353}, -- Box
|
{-0.353, -0.353, -0.353, 0.353, 0.353, 0.353}, -- Box
|
||||||
{-0.495, -0.064, -0.064, 0.495, 0.064, 0.064}, -- Circle +-x
|
{-0.495, -0.064, -0.064, 0.495, 0.064, 0.064}, -- Circle +-x
|
||||||
{-0.483, -0.128, -0.128, 0.483, 0.128, 0.128},
|
{-0.483, -0.128, -0.128, 0.483, 0.128, 0.128},
|
||||||
@ -55,84 +55,92 @@ local nodebox = {
|
|||||||
{-0.303, -0.303, -0.397, 0.303, 0.303, 0.397},
|
{-0.303, -0.303, -0.397, 0.303, 0.303, 0.397},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local SS_OFF = 0
|
||||||
|
local SS_DANGER = 1
|
||||||
|
local SS_CLEAR = 2
|
||||||
|
|
||||||
local reactor_siren = {}
|
local reactor_siren = {}
|
||||||
local function siren_set_state(pos, newstate)
|
local function siren_set_state(pos, state)
|
||||||
local hpos = minetest.hash_node_position(pos)
|
local hpos = minetest.hash_node_position(pos)
|
||||||
local siren = reactor_siren[hpos]
|
local siren = reactor_siren[hpos]
|
||||||
if not siren then
|
if not siren then
|
||||||
if newstate == "off" then return end
|
if state == SS_OFF then return end
|
||||||
siren = {state="off"}
|
siren = {state=SS_OFF}
|
||||||
reactor_siren[hpos] = siren
|
reactor_siren[hpos] = siren
|
||||||
end
|
end
|
||||||
if newstate == "danger" and siren.state ~= "danger" then
|
if state == SS_DANGER and siren.state ~= SS_DANGER then
|
||||||
if siren.handle then minetest.sound_stop(siren.handle) end
|
if siren.handle then minetest.sound_stop(siren.handle) end
|
||||||
siren.handle = minetest.sound_play("technic_hv_nuclear_reactor_siren_danger_loop", {pos=pos, gain=1.5, loop=true, max_hear_distance=48})
|
siren.handle = minetest.sound_play("technic_hv_nuclear_reactor_siren_danger_loop",
|
||||||
siren.state = "danger"
|
{pos=pos, gain=1.5, loop=true, max_hear_distance=48})
|
||||||
elseif newstate == "clear" then
|
siren.state = SS_DANGER
|
||||||
|
elseif state == SS_CLEAR then
|
||||||
if siren.handle then minetest.sound_stop(siren.handle) end
|
if siren.handle then minetest.sound_stop(siren.handle) end
|
||||||
local clear_handle = minetest.sound_play("technic_hv_nuclear_reactor_siren_clear", {pos=pos, gain=1.5, loop=false, max_hear_distance=48})
|
local clear_handle = minetest.sound_play("technic_hv_nuclear_reactor_siren_clear",
|
||||||
|
{pos=pos, gain=1.5, loop=false, max_hear_distance=48})
|
||||||
siren.handle = clear_handle
|
siren.handle = clear_handle
|
||||||
siren.state = "clear"
|
siren.state = SS_CLEAR
|
||||||
minetest.after(10, function()
|
minetest.after(10, function()
|
||||||
if siren.handle == clear_handle then
|
if siren.handle ~= clear_handle then return end
|
||||||
minetest.sound_stop(clear_handle)
|
minetest.sound_stop(clear_handle)
|
||||||
if reactor_siren[hpos] == siren then
|
if reactor_siren[hpos] == siren then
|
||||||
reactor_siren[hpos] = nil
|
reactor_siren[hpos] = nil
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
elseif newstate == "off" and siren.state ~= "off" then
|
elseif state == SS_OFF and siren.state ~= SS_OFF then
|
||||||
if siren.handle then minetest.sound_stop(siren.handle) end
|
if siren.handle then minetest.sound_stop(siren.handle) end
|
||||||
siren.handle = nil
|
|
||||||
reactor_siren[hpos] = nil
|
reactor_siren[hpos] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function siren_danger(pos, meta)
|
local function siren_danger(pos, meta)
|
||||||
meta:set_int("siren", 1)
|
meta:set_int("siren", 1)
|
||||||
siren_set_state(pos, "danger")
|
siren_set_state(pos, SS_DANGER)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function siren_clear(pos, meta)
|
local function siren_clear(pos, meta)
|
||||||
if meta:get_int("siren") ~= 0 then
|
if meta:get_int("siren") ~= 0 then
|
||||||
siren_set_state(pos, "clear")
|
siren_set_state(pos, SS_CLEAR)
|
||||||
meta:set_int("siren", 0)
|
meta:set_int("siren", 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- The standard reactor structure consists of a 9x9x9 cube. A cross
|
--[[
|
||||||
-- section through the middle:
|
The standard reactor structure consists of a 9x9x9 cube. A cross
|
||||||
--
|
section through the middle:
|
||||||
-- CCCC CCCC
|
|
||||||
-- CBBB BBBC
|
CCCC CCCC
|
||||||
-- CBSS SSBC
|
CBBB BBBC
|
||||||
-- CBSWWWSBC
|
CBSS SSBC
|
||||||
-- CBSW#WSBC
|
CBSWWWSBC
|
||||||
-- CBSW|WSBC
|
CBSW#WSBC
|
||||||
-- CBSS|SSBC
|
CBSW|WSBC
|
||||||
-- CBBB|BBBC
|
CBSS|SSBC
|
||||||
-- CCCC|CCCC
|
CBBB|BBBC
|
||||||
-- C = Concrete, B = Blast-resistant concrete, S = Stainless Steel,
|
CCCC|CCCC
|
||||||
-- W = water node, # = reactor core, | = HV cable
|
C = Concrete, B = Blast-resistant concrete, S = Stainless Steel,
|
||||||
--
|
W = water node, # = reactor core, | = HV cable
|
||||||
-- The man-hole and the HV cable are only in the middle, and the man-hole
|
|
||||||
-- is optional.
|
The man-hole and the HV cable are only in the middle, and the man-hole
|
||||||
--
|
is optional.
|
||||||
-- For the reactor to operate and not melt down, it insists on the inner
|
|
||||||
-- 7x7x7 portion (from the core out to the blast-resistant concrete)
|
For the reactor to operate and not melt down, it insists on the inner
|
||||||
-- being intact. Intactness only depends on the number of nodes of the
|
7x7x7 portion (from the core out to the blast-resistant concrete)
|
||||||
-- right type in each layer. The water layer must have water in all but
|
being intact. Intactness only depends on the number of nodes of the
|
||||||
-- at most one node; the steel and blast-resistant concrete layers must
|
right type in each layer. The water layer must have water in all but
|
||||||
-- have the right material in all but at most two nodes. The permitted
|
at most one node; the steel and blast-resistant concrete layers must
|
||||||
-- gaps are meant for the cable and man-hole, but can actually be anywhere
|
have the right material in all but at most two nodes. The permitted
|
||||||
-- and contain anything. For the reactor to be useful, a cable must
|
gaps are meant for the cable and man-hole, but can actually be anywhere
|
||||||
-- connect to the core, but it can go in any direction.
|
and contain anything. For the reactor to be useful, a cable must
|
||||||
--
|
connect to the core, but it can go in any direction.
|
||||||
-- The outer concrete layer of the standard structure is not required
|
|
||||||
-- for the reactor to operate. It is noted here because it used to
|
The outer concrete layer of the standard structure is not required
|
||||||
-- be mandatory, and for historical reasons (that it predates the
|
for the reactor to operate. It is noted here because it used to
|
||||||
-- implementation of radiation) it needs to continue being adequate
|
be mandatory, and for historical reasons (that it predates the
|
||||||
-- shielding of legacy reactors. If it ever ceases to be adequate
|
implementation of radiation) it needs to continue being adequate
|
||||||
-- shielding for new reactors, legacy ones should be grandfathered.
|
shielding of legacy reactors. If it ever ceases to be adequate
|
||||||
local reactor_structure_badness = function(pos)
|
shielding for new reactors, legacy ones should be grandfathered.
|
||||||
|
--]]
|
||||||
|
local function reactor_structure_badness(pos)
|
||||||
local vm = VoxelManip()
|
local vm = VoxelManip()
|
||||||
local pos1 = vector.subtract(pos, 3)
|
local pos1 = vector.subtract(pos, 3)
|
||||||
local pos2 = vector.add(pos, 3)
|
local pos2 = vector.add(pos, 3)
|
||||||
@ -179,14 +187,16 @@ local reactor_structure_badness = function(pos)
|
|||||||
return (25 - waterlayer) + (96 - steellayer) + (216 - blastlayer)
|
return (25 - waterlayer) + (96 - steellayer) + (216 - blastlayer)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function meltdown_reactor(pos)
|
|
||||||
print("A reactor melted down at "..minetest.pos_to_string(pos))
|
local function melt_down_reactor(pos)
|
||||||
|
minetest.log("action", "A reactor melted down at "..minetest.pos_to_string(pos))
|
||||||
minetest.set_node(pos, {name="technic:corium_source"})
|
minetest.set_node(pos, {name="technic:corium_source"})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"technic:hv_nuclear_reactor_core_active"},
|
nodenames = {"technic:hv_nuclear_reactor_core_active"},
|
||||||
interval = 1,
|
interval = 4,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function (pos, node)
|
action = function (pos, node)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
@ -194,14 +204,14 @@ minetest.register_abm({
|
|||||||
local accum_badness = meta:get_int("structure_accumulated_badness")
|
local accum_badness = meta:get_int("structure_accumulated_badness")
|
||||||
if badness == 0 then
|
if badness == 0 then
|
||||||
if accum_badness ~= 0 then
|
if accum_badness ~= 0 then
|
||||||
meta:set_int("structure_accumulated_badness", accum_badness - 1)
|
meta:set_int("structure_accumulated_badness", accum_badness - 4)
|
||||||
siren_clear(pos, meta)
|
siren_clear(pos, meta)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
siren_danger(pos, meta)
|
siren_danger(pos, meta)
|
||||||
accum_badness = accum_badness + badness
|
accum_badness = accum_badness + badness
|
||||||
if accum_badness >= 100 then
|
if accum_badness >= 25 then
|
||||||
meltdown_reactor(pos)
|
melt_down_reactor(pos)
|
||||||
else
|
else
|
||||||
meta:set_int("structure_accumulated_badness", accum_badness)
|
meta:set_int("structure_accumulated_badness", accum_badness)
|
||||||
end
|
end
|
||||||
@ -209,40 +219,36 @@ minetest.register_abm({
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local run = function(pos, node)
|
local function run(pos, node)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local machine_name = S("Nuclear %s Generator Core"):format("HV")
|
|
||||||
local burn_time = meta:get_int("burn_time") or 0
|
local burn_time = meta:get_int("burn_time") or 0
|
||||||
|
|
||||||
if burn_time >= burn_ticks or burn_time == 0 then
|
if burn_time >= burn_ticks or burn_time == 0 then
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
if not inv:is_empty("src") then
|
if not inv:is_empty("src") then
|
||||||
local srclist = inv:get_list("src")
|
local src_list = inv:get_list("src")
|
||||||
local correct_fuel_count = 0
|
local correct_fuel_count = 0
|
||||||
for _, srcstack in pairs(srclist) do
|
for _, src_stack in pairs(src_list) do
|
||||||
if srcstack then
|
if src_stack and src_stack:get_name() == fuel_type then
|
||||||
if srcstack:get_name() == fuel_type then
|
|
||||||
correct_fuel_count = correct_fuel_count + 1
|
correct_fuel_count = correct_fuel_count + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
-- Check that the reactor is complete and has the correct fuel
|
||||||
-- Check that the reactor is complete as well
|
|
||||||
-- as the correct number of correct fuel
|
|
||||||
if correct_fuel_count == 6 and
|
if correct_fuel_count == 6 and
|
||||||
reactor_structure_badness(pos) == 0 then
|
reactor_structure_badness(pos) == 0 then
|
||||||
meta:set_int("burn_time", 1)
|
meta:set_int("burn_time", 1)
|
||||||
technic.swap_node(pos, "technic:hv_nuclear_reactor_core_active")
|
technic.swap_node(pos, "technic:hv_nuclear_reactor_core_active")
|
||||||
meta:set_int("HV_EU_supply", power_supply)
|
meta:set_int("HV_EU_supply", power_supply)
|
||||||
for idx, srcstack in pairs(srclist) do
|
for idx, src_stack in pairs(src_list) do
|
||||||
srcstack:take_item()
|
src_stack:take_item()
|
||||||
inv:set_stack("src", idx, srcstack)
|
inv:set_stack("src", idx, src_stack)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
meta:set_int("HV_EU_supply", 0)
|
meta:set_int("HV_EU_supply", 0)
|
||||||
meta:set_int("burn_time", 0)
|
meta:set_int("burn_time", 0)
|
||||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
meta:set_string("infotext", S("%s Idle"):format(reactor_desc))
|
||||||
technic.swap_node(pos, "technic:hv_nuclear_reactor_core")
|
technic.swap_node(pos, "technic:hv_nuclear_reactor_core")
|
||||||
meta:set_int("structure_accumulated_badness", 0)
|
meta:set_int("structure_accumulated_badness", 0)
|
||||||
siren_clear(pos, meta)
|
siren_clear(pos, meta)
|
||||||
@ -250,17 +256,15 @@ local run = function(pos, node)
|
|||||||
burn_time = burn_time + 1
|
burn_time = burn_time + 1
|
||||||
meta:set_int("burn_time", burn_time)
|
meta:set_int("burn_time", burn_time)
|
||||||
local percent = math.floor(burn_time / burn_ticks * 100)
|
local percent = math.floor(burn_time / burn_ticks * 100)
|
||||||
meta:set_string("infotext", machine_name.." ("..percent.."%)")
|
meta:set_string("infotext", reactor_desc.." ("..percent.."%)")
|
||||||
meta:set_int("HV_EU_supply", power_supply)
|
meta:set_int("HV_EU_supply", power_supply)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("technic:hv_nuclear_reactor_core", {
|
minetest.register_node("technic:hv_nuclear_reactor_core", {
|
||||||
description = S("Nuclear %s Generator Core"):format("HV"),
|
description = reactor_desc,
|
||||||
tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
|
tiles = {"technic_hv_nuclear_reactor_core.png"},
|
||||||
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
|
groups = {cracky=1, technic_machine=1, technic_hv=1},
|
||||||
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"},
|
|
||||||
groups = {cracky=1, technic_machine=1},
|
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
@ -268,22 +272,17 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
|
|||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = nodebox
|
fixed = node_box
|
||||||
},
|
},
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", S("Nuclear %s Generator Core"):format("HV"))
|
meta:set_string("infotext", reactor_desc)
|
||||||
meta:set_int("HV_EU_supply", 0)
|
meta:set_string("formspec", reactor_formspec)
|
||||||
-- Signal to the switching station that this device burns some
|
|
||||||
-- sort of fuel and needs special handling
|
|
||||||
meta:set_int("HV_EU_from_fuel", 1)
|
|
||||||
meta:set_int("burn_time", 0)
|
|
||||||
meta:set_string("formspec", generator_formspec)
|
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("src", 6)
|
inv:set_size("src", 6)
|
||||||
end,
|
end,
|
||||||
can_dig = technic.machine_can_dig,
|
can_dig = technic.machine_can_dig,
|
||||||
on_destruct = function(pos) siren_set_state(pos, "off") end,
|
on_destruct = function(pos) siren_set_state(pos, SS_OFF) end,
|
||||||
allow_metadata_inventory_put = technic.machine_inventory_put,
|
allow_metadata_inventory_put = technic.machine_inventory_put,
|
||||||
allow_metadata_inventory_take = technic.machine_inventory_take,
|
allow_metadata_inventory_take = technic.machine_inventory_take,
|
||||||
allow_metadata_inventory_move = technic.machine_inventory_move,
|
allow_metadata_inventory_move = technic.machine_inventory_move,
|
||||||
@ -291,23 +290,22 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("technic:hv_nuclear_reactor_core_active", {
|
minetest.register_node("technic:hv_nuclear_reactor_core_active", {
|
||||||
tiles = {"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
|
tiles = {"technic_hv_nuclear_reactor_core.png"},
|
||||||
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png",
|
groups = {cracky=1, technic_machine=1, technic_hv=1,
|
||||||
"technic_hv_nuclear_reactor_core.png", "technic_hv_nuclear_reactor_core.png"},
|
radioactive=11000, not_in_creative_inventory=1},
|
||||||
groups = {cracky=1, technic_machine=1, radioactive=11000, not_in_creative_inventory=1},
|
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
drop = "technic:hv_nuclear_reactor_core",
|
drop = "technic:hv_nuclear_reactor_core",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
light_source = 15,
|
light_source = 14,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = nodebox
|
fixed = node_box
|
||||||
},
|
},
|
||||||
can_dig = technic.machine_can_dig,
|
can_dig = technic.machine_can_dig,
|
||||||
after_dig_node = meltdown_reactor,
|
after_dig_node = melt_down_reactor,
|
||||||
on_destruct = function(pos) siren_set_state(pos, "off") end,
|
on_destruct = function(pos) siren_set_state(pos, SS_OFF) end,
|
||||||
allow_metadata_inventory_put = technic.machine_inventory_put,
|
allow_metadata_inventory_put = technic.machine_inventory_put,
|
||||||
allow_metadata_inventory_take = technic.machine_inventory_take,
|
allow_metadata_inventory_take = technic.machine_inventory_take,
|
||||||
allow_metadata_inventory_move = technic.machine_inventory_move,
|
allow_metadata_inventory_move = technic.machine_inventory_move,
|
||||||
@ -341,34 +339,36 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", {
|
|||||||
technic.register_machine("HV", "technic:hv_nuclear_reactor_core", technic.producer)
|
technic.register_machine("HV", "technic:hv_nuclear_reactor_core", technic.producer)
|
||||||
technic.register_machine("HV", "technic:hv_nuclear_reactor_core_active", technic.producer)
|
technic.register_machine("HV", "technic:hv_nuclear_reactor_core_active", technic.producer)
|
||||||
|
|
||||||
-- radioactivity
|
--[[
|
||||||
|
Radioactivity
|
||||||
|
|
||||||
|
Radiation resistance represents the extent to which a material
|
||||||
|
attenuates radiation passing through it; i.e., how good a radiation
|
||||||
|
shield it is. This is identified per node type. For materials that
|
||||||
|
exist in real life, the radiation resistance value that this system
|
||||||
|
uses for a node type consisting of a solid cube of that material is the
|
||||||
|
(approximate) number of halvings of ionising radiation that is achieved
|
||||||
|
by a meter of the material in real life. This is approximately
|
||||||
|
proportional to density, which provides a good way to estimate it.
|
||||||
|
Homogeneous mixtures of materials have radiation resistance computed
|
||||||
|
by a simple weighted mean. Note that the amount of attenuation that
|
||||||
|
a material achieves in-game is not required to be (and is not) the
|
||||||
|
same as the attenuation achieved in real life.
|
||||||
|
|
||||||
|
Radiation resistance for a node type may be specified in the node
|
||||||
|
definition, under the key "radiation_resistance". As an interim
|
||||||
|
measure, until node definitions widely include this, this code
|
||||||
|
knows a bunch of values for particular node types in several mods,
|
||||||
|
and values for groups of node types. The node definition takes
|
||||||
|
precedence if it specifies a value. Nodes for which no value at
|
||||||
|
all is known are taken to provide no radiation resistance at all;
|
||||||
|
this is appropriate for the majority of node types. Only node types
|
||||||
|
consisting of a fairly homogeneous mass of material should report
|
||||||
|
non-zero radiation resistance; anything with non-uniform geometry
|
||||||
|
or complex internal structure should show no radiation resistance.
|
||||||
|
Fractional resistance values are permitted.
|
||||||
|
--]]
|
||||||
|
|
||||||
-- Radiation resistance represents the extent to which a material
|
|
||||||
-- attenuates radiation passing through it; i.e., how good a radiation
|
|
||||||
-- shield it is. This is identified per node type. For materials that
|
|
||||||
-- exist in real life, the radiation resistance value that this system
|
|
||||||
-- uses for a node type consisting of a solid cube of that material is the
|
|
||||||
-- (approximate) number of halvings of ionising radiation that is achieved
|
|
||||||
-- by a metre of the material in real life. This is approximately
|
|
||||||
-- proportional to density, which provides a good way to estimate it.
|
|
||||||
-- Homogeneous mixtures of materials have radiation resistance computed
|
|
||||||
-- by a simple weighted mean. Note that the amount of attenuation that
|
|
||||||
-- a material achieves in-game is not required to be (and is not) the
|
|
||||||
-- same as the attenuation achieved in real life.
|
|
||||||
--
|
|
||||||
-- Radiation resistance for a node type may be specified in the node
|
|
||||||
-- definition, under the key "radiation_resistance". As an interim
|
|
||||||
-- measure, until node definitions widely include this, this code
|
|
||||||
-- knows a bunch of values for particular node types in several mods,
|
|
||||||
-- and values for groups of node types. The node definition takes
|
|
||||||
-- precedence if it specifies a value. Nodes for which no value at
|
|
||||||
-- all is known are taken to provide no radiation resistance at all;
|
|
||||||
-- this is appropriate for the majority of node types. Only node types
|
|
||||||
-- consisting of a fairly homogeneous mass of material should report
|
|
||||||
-- non-zero radiation resistance; anything with non-uniform geometry
|
|
||||||
-- or complex internal structure should show no radiation resistance.
|
|
||||||
-- Fractional resistance values are permitted; two significant figures
|
|
||||||
-- is the recommended precision.
|
|
||||||
local default_radiation_resistance_per_node = {
|
local default_radiation_resistance_per_node = {
|
||||||
["default:brick"] = 13,
|
["default:brick"] = 13,
|
||||||
["default:bronzeblock"] = 45,
|
["default:bronzeblock"] = 45,
|
||||||
@ -505,12 +505,13 @@ local default_radiation_resistance_per_group = {
|
|||||||
wood = 1.7,
|
wood = 1.7,
|
||||||
}
|
}
|
||||||
local cache_radiation_resistance = {}
|
local cache_radiation_resistance = {}
|
||||||
local function node_radiation_resistance(nodename)
|
local function node_radiation_resistance(node_name)
|
||||||
local eff = cache_radiation_resistance[nodename]
|
local eff = cache_radiation_resistance[node_name]
|
||||||
if eff then return eff end
|
if eff then return eff end
|
||||||
local def = minetest.registered_nodes[nodename] or {groups={}}
|
local def = minetest.registered_nodes[node_name]
|
||||||
eff = def.radiation_resistance or default_radiation_resistance_per_node[nodename]
|
eff = def and def.radiation_resistance or
|
||||||
if not eff then
|
default_radiation_resistance_per_node[node_name]
|
||||||
|
if def and not eff then
|
||||||
for g, v in pairs(def.groups) do
|
for g, v in pairs(def.groups) do
|
||||||
if v > 0 and default_radiation_resistance_per_group[g] then
|
if v > 0 and default_radiation_resistance_per_group[g] then
|
||||||
eff = default_radiation_resistance_per_group[g]
|
eff = default_radiation_resistance_per_group[g]
|
||||||
@ -519,93 +520,82 @@ local function node_radiation_resistance(nodename)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not eff then eff = 0 end
|
if not eff then eff = 0 end
|
||||||
cache_radiation_resistance[nodename] = eff
|
cache_radiation_resistance[node_name] = eff
|
||||||
return eff
|
return eff
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Radioactive nodes cause damage to nearby players. The damage
|
--[[
|
||||||
-- effect depends on the intrinsic strength of the radiation source,
|
Radioactive nodes cause damage to nearby players. The damage
|
||||||
-- the distance between the source and the player, and the shielding
|
effect depends on the intrinsic strength of the radiation source,
|
||||||
-- effect of the intervening material. These determine a rate of damage;
|
the distance between the source and the player, and the shielding
|
||||||
-- total damage caused is the integral of this over time.
|
effect of the intervening material. These determine a rate of damage;
|
||||||
--
|
total damage caused is the integral of this over time.
|
||||||
-- In the absence of effective shielding, for a specific source the
|
|
||||||
-- damage rate varies realistically in inverse proportion to the square
|
In the absence of effective shielding, for a specific source the
|
||||||
-- of the distance. (Distance is measured to the player's abdomen,
|
damage rate varies realistically in inverse proportion to the square
|
||||||
-- not to the nominal player position which corresponds to the foot.)
|
of the distance. (Distance is measured to the player's abdomen,
|
||||||
-- However, if the player is inside a non-walkable (liquid or gaseous)
|
not to the nominal player position which corresponds to the foot.)
|
||||||
-- radioactive node, the nominal distance could go to zero, yielding
|
However, if the player is inside a non-walkable (liquid or gaseous)
|
||||||
-- infinite damage. In that case, the player's body is displacing the
|
radioactive node, the nominal distance could go to zero, yielding
|
||||||
-- radioactive material, so the effective distance should remain non-zero.
|
infinite damage. In that case, the player's body is displacing the
|
||||||
-- We therefore apply a lower distance bound of sqrt(0.75) m, which is
|
radioactive material, so the effective distance should remain non-zero.
|
||||||
-- the maximum distance one can get from the node centre within the node.
|
We therefore apply a lower distance bound of sqrt(0.75), which is
|
||||||
--
|
the maximum distance one can get from the node center within the node.
|
||||||
-- A radioactive node is identified by being in the "radioactive" group,
|
|
||||||
-- and the group value signifies the strength of the radiation source.
|
A radioactive node is identified by being in the "radioactive" group,
|
||||||
-- The group value is the distance in millimetres from a node at which
|
and the group value signifies the strength of the radiation source.
|
||||||
-- an unshielded player will be damaged by 0.25 HP/s. Or, equivalently,
|
The group value is 1000 times the distance from a node at which
|
||||||
-- it is 2000 times the square root of the damage rate in HP/s that an
|
an unshielded player will be damaged by 0.25 HP/s. Or, equivalently,
|
||||||
-- unshielded player 1 m away will take.
|
it is 2000 times the square root of the damage rate in HP/s that an
|
||||||
--
|
unshielded player 1 node away will take.
|
||||||
-- Shielding is assessed by sampling every 0.25 m along the path
|
|
||||||
-- from the source to the player, ignoring the source node itself.
|
Shielding is assessed by adding the shielding values of all nodes
|
||||||
-- The summed shielding values from the sampled nodes yield a measure
|
between the source node and the player, ignoring the source node itself.
|
||||||
-- of the total amount of shielding on the path. As in reality,
|
As in reality, shielding causes exponential attenuation of radiation.
|
||||||
-- shielding causes exponential attenuation of radiation. However, the
|
However, the effect is scaled down relative to real life. A node with
|
||||||
-- effect is scaled down relative to real life. A metre of a node with
|
radiation resistance value R yields attenuation of sqrt(R) * 0.1 nepers.
|
||||||
-- radiation resistance value R yields attenuation of sqrt(R)*0.1 nepers.
|
(In real life it would be about R * 0.69 nepers, by the definition
|
||||||
-- (In real life it would be about R*0.69 nepers, by the definition
|
of the radiation resistance values.) The sqrt part of this formula
|
||||||
-- of the radiation resistance values.) The sqrt part of this formula
|
scales down the differences between shielding types, reflecting the
|
||||||
-- scales down the differences between shielding types, reflecting the
|
game's simplification of making expensive materials such as gold
|
||||||
-- game's simplification of making expensive materials such as gold
|
readily available in cubes. The multiplicative factor in the
|
||||||
-- readily available in cubic metres. The multiplicative factor in the
|
formula scales down the difference between shielded and unshielded
|
||||||
-- formula scales down the difference between shielded and unshielded
|
safe distances, avoiding the latter becoming impractically large.
|
||||||
-- safe distances, avoiding the latter becoming impractically large.
|
|
||||||
--
|
Damage is processed at rates down to 0.25 HP/s, which in the absence of
|
||||||
-- Damage is processed at rates down to 0.25 HP/s, which in the absence of
|
shielding is attained at the distance specified by the "radioactive"
|
||||||
-- shielding is attained at the distance specified by the "radioactive"
|
group value. Computed damage rates below 0.25 HP/s result in no
|
||||||
-- group value. Computed damage rates below 0.25 HP/s result in no
|
damage at all to the player. This gives the player an opportunity
|
||||||
-- damage at all to the player. This gives the player an opportunity
|
to be safe, and limits the range at which source/player interactions
|
||||||
-- to be safe, and limits the range at which source/player interactions
|
need to be considered.
|
||||||
-- need to be considered.
|
--]]
|
||||||
local assumed_abdomen_offset = vector.new(0, 1, 0)
|
local abdomen_offset = vector.new(0, 1, 0)
|
||||||
local assumed_abdomen_offset_length = vector.length(assumed_abdomen_offset)
|
local abdomen_offset_length = vector.length(abdomen_offset)
|
||||||
local cache_scaled_shielding = {}
|
local cache_scaled_shielding = {}
|
||||||
|
|
||||||
local damage_enabled = minetest.setting_getbool("enable_damage")
|
local function dmg_player(pos, o, strength)
|
||||||
|
local pl_pos = vector.add(o:getpos(), abdomen_offset)
|
||||||
if damage_enabled then
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"group:radioactive"},
|
|
||||||
interval = 1,
|
|
||||||
chance = 1,
|
|
||||||
action = function (pos, node)
|
|
||||||
local strength = minetest.registered_nodes[node.name].groups.radioactive
|
|
||||||
for _, o in ipairs(minetest.get_objects_inside_radius(pos, strength*0.001 + assumed_abdomen_offset_length)) do
|
|
||||||
if o:is_player() then
|
|
||||||
local rel = vector.subtract(vector.add(o:getpos(), assumed_abdomen_offset), pos)
|
|
||||||
local dist_sq = vector.length_square(rel)
|
|
||||||
local dist = math.sqrt(dist_sq)
|
|
||||||
local dirstep = dist == 0 and vector.new(0,0,0) or vector.divide(rel, dist*4)
|
|
||||||
local intpos = pos
|
|
||||||
local shielding = 0
|
local shielding = 0
|
||||||
for intdist = 0.25, dist, 0.25 do
|
local dist = vector.distance(pos, pl_pos)
|
||||||
intpos = vector.add(intpos, dirstep)
|
for ray_pos in technic.trace_node_ray(pos,
|
||||||
local intnodepos = vector.round(intpos)
|
vector.direction(pos, pl_pos), dist) do
|
||||||
if not vector.equals(intnodepos, pos) then
|
if not vector.equals(ray_pos, pos) then
|
||||||
local sname = minetest.get_node(intnodepos).name
|
local shield_name = minetest.get_node(ray_pos).name
|
||||||
local sval = cache_scaled_shielding[sname]
|
local shield_val = cache_scaled_shielding[sname]
|
||||||
if not sval then
|
if not shield_val then
|
||||||
sval = math.sqrt(node_radiation_resistance(sname)) * -0.025
|
shield_val = math.sqrt(node_radiation_resistance(shield_name)) * 0.025
|
||||||
cache_scaled_shielding[sname] = sval
|
cache_scaled_shielding[shield_name] = shield_val
|
||||||
end
|
end
|
||||||
shielding = shielding + sval
|
shielding = shielding + shield_val
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local dmg_rate = 0.25e-6 * strength*strength * math.exp(shielding) / math.max(0.75, dist_sq)
|
local dmg = (0.25e-6 * strength * strength) /
|
||||||
if dmg_rate >= 0.25 then
|
(math.max(0.75, dist * dist) * math.exp(shielding))
|
||||||
local dmg_int = math.floor(dmg_rate)
|
if dmg >= 0.25 then
|
||||||
if math.random() < dmg_rate-dmg_int then
|
local dmg_int = math.floor(dmg)
|
||||||
|
-- The closer you are to getting one more damage point,
|
||||||
|
-- the more likely it will be added.
|
||||||
|
if math.random() < dmg - dmg_int then
|
||||||
dmg_int = dmg_int + 1
|
dmg_int = dmg_int + 1
|
||||||
end
|
end
|
||||||
if dmg_int > 0 then
|
if dmg_int > 0 then
|
||||||
@ -613,18 +603,31 @@ if damage_enabled then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function dmg_abm(pos, node)
|
||||||
|
local strength = minetest.get_item_group(node.name, "radioactive")
|
||||||
|
for _, o in pairs(minetest.get_objects_inside_radius(pos,
|
||||||
|
strength * 0.001 + abdomen_offset_length)) do
|
||||||
|
if o:is_player() then
|
||||||
|
dmg_player(pos, o, strength)
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if minetest.setting_getbool("enable_damage") then
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"group:radioactive"},
|
||||||
|
interval = 1,
|
||||||
|
chance = 1,
|
||||||
|
action = dmg_abm,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- radioactive materials that can result from destroying a reactor
|
-- Radioactive materials that can result from destroying a reactor
|
||||||
local corium_griefing = 1
|
local griefing = technic.config:get_bool("enable_corium_griefing")
|
||||||
if (not technic.config:get_bool("enable_corium_griefing")) then
|
|
||||||
corium_griefing = 0
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, state in ipairs({ "flowing", "source" }) do
|
for _, state in pairs({"flowing", "source"}) do
|
||||||
minetest.register_node("technic:corium_"..state, {
|
minetest.register_node("technic:corium_"..state, {
|
||||||
description = S(state == "source" and "Corium Source" or "Flowing Corium"),
|
description = S(state == "source" and "Corium Source" or "Flowing Corium"),
|
||||||
drawtype = (state == "source" and "liquid" or "flowingliquid"),
|
drawtype = (state == "source" and "liquid" or "flowingliquid"),
|
||||||
@ -656,14 +659,14 @@ for _, state in ipairs({ "flowing", "source" }) do
|
|||||||
groups = {
|
groups = {
|
||||||
liquid = 2,
|
liquid = 2,
|
||||||
hot = 3,
|
hot = 3,
|
||||||
igniter = corium_griefing,
|
igniter = (griefing and 1 or 0),
|
||||||
radioactive = (state == "source" and 32000 or 16000),
|
radioactive = (state == "source" and 32000 or 16000),
|
||||||
not_in_creative_inventory = (state == "flowing" and 1 or nil),
|
not_in_creative_inventory = (state == "flowing" and 1 or nil),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if bucket and bucket.register_liquid then
|
if rawget(_G, "bucket") and bucket.register_liquid then
|
||||||
bucket.register_liquid(
|
bucket.register_liquid(
|
||||||
"technic:corium_source",
|
"technic:corium_source",
|
||||||
"technic:corium_flowing",
|
"technic:corium_flowing",
|
||||||
@ -680,7 +683,6 @@ minetest.register_node("technic:chernobylite_block", {
|
|||||||
groups = {cracky=1, radioactive=5000, level=2},
|
groups = {cracky=1, radioactive=5000, level=2},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
light_source = 2,
|
light_source = 2,
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
@ -693,15 +695,26 @@ minetest.register_abm({
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (corium_griefing == 1) then
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"technic:corium_flowing"},
|
nodenames = {"technic:corium_flowing"},
|
||||||
interval = 5,
|
neighbors = {"group:water"},
|
||||||
chance = 10,
|
interval = 1,
|
||||||
|
chance = 1,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
minetest.set_node(pos, {name="technic:chernobylite_block"})
|
minetest.set_node(pos, {name="technic:chernobylite_block"})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"technic:corium_flowing"},
|
||||||
|
interval = 5,
|
||||||
|
chance = (griefing and 10 or 1),
|
||||||
|
action = function(pos, node)
|
||||||
|
minetest.set_node(pos, {name="technic:chernobylite_block"})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
if griefing then
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"technic:corium_source", "technic:corium_flowing"},
|
nodenames = {"technic:corium_source", "technic:corium_flowing"},
|
||||||
interval = 4,
|
interval = 4,
|
||||||
@ -721,3 +734,4 @@ if (corium_griefing == 1) then
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{"technic:carbon_plate", "pipeworks:filter", "technic:composite_plate"},
|
{"technic:carbon_plate", "pipeworks:filter", "technic:composite_plate"},
|
||||||
{"technic:motor", "technic:machine_casing", "technic:diamond_drill_head"},
|
{"technic:motor", "technic:machine_casing", "technic:diamond_drill_head"},
|
||||||
{"technic:carbon_steel_block", "technic:hv_cable0", "technic:carbon_steel_block"}},
|
{"technic:carbon_steel_block", "technic:hv_cable", "technic:carbon_steel_block"}},
|
||||||
output = "technic:quarry",
|
output = "technic:quarry",
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -213,7 +213,8 @@ minetest.register_node("technic:quarry", {
|
|||||||
"technic_carbon_steel_block.png^default_tool_mesepick.png",
|
"technic_carbon_steel_block.png^default_tool_mesepick.png",
|
||||||
"technic_carbon_steel_block.png"),
|
"technic_carbon_steel_block.png"),
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=2, tubedevice=1, technic_machine = 1},
|
groups = {cracky=2, tubedevice=1, technic_machine=1, technic_hv=1},
|
||||||
|
connect_sides = {"bottom", "front", "left", "right"},
|
||||||
tube = {
|
tube = {
|
||||||
connect_sides = {top = 1},
|
connect_sides = {top = 1},
|
||||||
},
|
},
|
||||||
|
@ -6,7 +6,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:solar_array_mv', 'technic:solar_array_mv', 'technic:solar_array_mv'},
|
{'technic:solar_array_mv', 'technic:solar_array_mv', 'technic:solar_array_mv'},
|
||||||
{'technic:carbon_plate', 'technic:hv_transformer', 'technic:composite_plate'},
|
{'technic:carbon_plate', 'technic:hv_transformer', 'technic:composite_plate'},
|
||||||
{'', 'technic:hv_cable0', ''},
|
{'', 'technic:hv_cable', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'default:brick', 'default:brick', 'default:brick'},
|
{'default:brick', 'default:brick', 'default:brick'},
|
||||||
{'default:brick', 'technic:machine_casing', 'default:brick'},
|
{'default:brick', 'technic:machine_casing', 'default:brick'},
|
||||||
{'default:brick', 'technic:lv_cable0', 'default:brick'},
|
{'default:brick', 'technic:lv_cable', 'default:brick'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'group:wood', 'group:wood', 'group:wood'},
|
{'group:wood', 'group:wood', 'group:wood'},
|
||||||
{'technic:battery', 'technic:machine_casing', 'technic:battery'},
|
{'technic:battery', 'technic:machine_casing', 'technic:battery'},
|
||||||
{'technic:battery', 'technic:lv_cable0', 'technic:battery'},
|
{'technic:battery', 'technic:lv_cable', 'technic:battery'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
minetest.register_alias("lv_cable", "technic:lv_cable0")
|
minetest.register_alias("lv_cable", "technic:lv_cable")
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:lv_cable0 6',
|
output = 'technic:lv_cable 6',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'default:paper', 'default:paper', 'default:paper'},
|
{'default:paper', 'default:paper', 'default:paper'},
|
||||||
{'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'},
|
{'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'},
|
||||||
|
@ -9,6 +9,17 @@
|
|||||||
|
|
||||||
local S = technic.getter
|
local S = technic.getter
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'technic:cnc',
|
||||||
|
recipe = {
|
||||||
|
{'default:glass', 'technic:diamond_drill_head', 'default:glass'},
|
||||||
|
{'technic:control_logic_unit', 'technic:machine_casing', 'technic:motor'},
|
||||||
|
{'technic:carbon_steel_ingot', 'technic:lv_cable', 'technic:carbon_steel_ingot'},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
local shape = {}
|
local shape = {}
|
||||||
local onesize_products = {
|
local onesize_products = {
|
||||||
slope = 2,
|
slope = 2,
|
||||||
@ -174,16 +185,9 @@ minetest.register_node("technic:cnc", {
|
|||||||
description = S("%s CNC Machine"):format("LV"),
|
description = S("%s CNC Machine"):format("LV"),
|
||||||
tiles = {"technic_cnc_top.png", "technic_cnc_bottom.png", "technic_cnc_side.png",
|
tiles = {"technic_cnc_top.png", "technic_cnc_bottom.png", "technic_cnc_side.png",
|
||||||
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"},
|
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front.png"},
|
||||||
drawtype = "nodebox",
|
groups = {cracky=2, technic_machine=1, technic_lv=1},
|
||||||
paramtype = "light",
|
connect_sides = {"bottom", "back", "left", "right"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
groups = {cracky=2, technic_machine=1},
|
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
@ -207,9 +211,10 @@ minetest.register_node("technic:cnc_active", {
|
|||||||
description = S("%s CNC Machine"):format("LV"),
|
description = S("%s CNC Machine"):format("LV"),
|
||||||
tiles = {"technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png",
|
tiles = {"technic_cnc_top_active.png", "technic_cnc_bottom.png", "technic_cnc_side.png",
|
||||||
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front_active.png"},
|
"technic_cnc_side.png", "technic_cnc_side.png", "technic_cnc_front_active.png"},
|
||||||
|
groups = {cracky=2, technic_machine=1, technic_lv=1, not_in_creative_inventory=1},
|
||||||
|
connect_sides = {"bottom", "back", "left", "right"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
drop = "technic:cnc",
|
drop = "technic:cnc",
|
||||||
groups = {cracky=2, technic_machine=1, not_in_creative_inventory=1},
|
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
can_dig = technic.machine_can_dig,
|
can_dig = technic.machine_can_dig,
|
||||||
allow_metadata_inventory_put = technic.machine_inventory_put,
|
allow_metadata_inventory_put = technic.machine_inventory_put,
|
||||||
@ -223,15 +228,3 @@ minetest.register_node("technic:cnc_active", {
|
|||||||
technic.register_machine("LV", "technic:cnc", technic.receiver)
|
technic.register_machine("LV", "technic:cnc", technic.receiver)
|
||||||
technic.register_machine("LV", "technic:cnc_active", technic.receiver)
|
technic.register_machine("LV", "technic:cnc_active", technic.receiver)
|
||||||
|
|
||||||
-------------------------
|
|
||||||
-- CNC Machine Recipe
|
|
||||||
-------------------------
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'technic:cnc',
|
|
||||||
recipe = {
|
|
||||||
{'default:glass', 'technic:diamond_drill_head', 'default:glass'},
|
|
||||||
{'technic:control_logic_unit', 'technic:machine_casing', 'technic:motor'},
|
|
||||||
{'technic:carbon_steel_ingot', 'technic:lv_cable0', 'technic:carbon_steel_ingot'},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'default:stone', 'technic:motor', 'default:stone'},
|
{'default:stone', 'technic:motor', 'default:stone'},
|
||||||
{'mesecons:piston', 'technic:machine_casing', 'mesecons:piston'},
|
{'mesecons:piston', 'technic:machine_casing', 'mesecons:piston'},
|
||||||
{'technic:fine_silver_wire', 'technic:lv_cable0', 'technic:fine_silver_wire'},
|
{'technic:fine_silver_wire', 'technic:lv_cable', 'technic:fine_silver_wire'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'default:cobble', 'default:cobble', 'default:cobble'},
|
{'default:cobble', 'default:cobble', 'default:cobble'},
|
||||||
{'default:cobble', 'technic:machine_casing', 'default:cobble'},
|
{'default:cobble', 'technic:machine_casing', 'default:cobble'},
|
||||||
{'default:cobble', 'technic:lv_cable0', 'default:cobble'},
|
{'default:cobble', 'technic:lv_cable', 'default:cobble'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:treetap', 'technic:motor', 'technic:treetap'},
|
{'technic:treetap', 'technic:motor', 'technic:treetap'},
|
||||||
{'technic:treetap', 'technic:machine_casing', 'technic:treetap'},
|
{'technic:treetap', 'technic:machine_casing', 'technic:treetap'},
|
||||||
{'', 'technic:lv_cable0', ''},
|
{'', 'technic:lv_cable', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'default:stone', 'default:furnace', 'default:stone'},
|
{'default:stone', 'default:furnace', 'default:stone'},
|
||||||
{'default:stone', 'technic:machine_casing', 'default:stone'},
|
{'default:stone', 'technic:machine_casing', 'default:stone'},
|
||||||
{'default:stone', 'technic:lv_cable0', 'default:stone'},
|
{'default:stone', 'technic:lv_cable', 'default:stone'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:granite', 'default:diamond', 'technic:granite'},
|
{'technic:granite', 'default:diamond', 'technic:granite'},
|
||||||
{'technic:fine_copper_wire', 'technic:machine_casing', 'technic:fine_copper_wire'},
|
{'technic:fine_copper_wire', 'technic:machine_casing', 'technic:fine_copper_wire'},
|
||||||
{'technic:granite', 'technic:lv_cable0', 'technic:granite'},
|
{'technic:granite', 'technic:lv_cable', 'technic:granite'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -82,8 +82,9 @@ minetest.register_node("technic:geothermal", {
|
|||||||
description = S("Geothermal %s Generator"):format("LV"),
|
description = S("Geothermal %s Generator"):format("LV"),
|
||||||
tiles = {"technic_geothermal_top.png", "technic_machine_bottom.png", "technic_geothermal_side.png",
|
tiles = {"technic_geothermal_top.png", "technic_machine_bottom.png", "technic_geothermal_side.png",
|
||||||
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
|
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
|
||||||
|
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||||
|
technic_machine=1, technic_lv=1},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1},
|
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
@ -99,7 +100,8 @@ minetest.register_node("technic:geothermal_active", {
|
|||||||
tiles = {"technic_geothermal_top_active.png", "technic_machine_bottom.png", "technic_geothermal_side.png",
|
tiles = {"technic_geothermal_top_active.png", "technic_machine_bottom.png", "technic_geothermal_side.png",
|
||||||
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
|
"technic_geothermal_side.png", "technic_geothermal_side.png", "technic_geothermal_side.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, not_in_creative_inventory=1},
|
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||||
|
technic_machine=1, technic_lv=1, not_in_creative_inventory=1},
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
drop = "technic:geothermal",
|
drop = "technic:geothermal",
|
||||||
|
@ -5,7 +5,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'default:desert_stone', 'default:diamond', 'default:desert_stone'},
|
{'default:desert_stone', 'default:diamond', 'default:desert_stone'},
|
||||||
{'default:desert_stone', 'technic:machine_casing', 'default:desert_stone'},
|
{'default:desert_stone', 'technic:machine_casing', 'default:desert_stone'},
|
||||||
{'technic:granite', 'technic:lv_cable0', 'technic:granite'},
|
{'technic:granite', 'technic:lv_cable', 'technic:granite'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:chromium_ingot', 'default:diamond', 'technic:chromium_ingot'},
|
{'technic:chromium_ingot', 'default:diamond', 'technic:chromium_ingot'},
|
||||||
{'default:diamond', 'technic:machine_casing', 'default:diamond'},
|
{'default:diamond', 'technic:machine_casing', 'default:diamond'},
|
||||||
{'default:mossycobble', 'technic:lv_cable0', 'default:mossycobble'},
|
{'default:mossycobble', 'technic:lv_cable', 'default:mossycobble'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -94,7 +94,9 @@ minetest.register_node("technic:music_player", {
|
|||||||
description = S("%s Music Player"):format("LV"),
|
description = S("%s Music Player"):format("LV"),
|
||||||
tiles = {"technic_music_player_top.png", "technic_machine_bottom.png", "technic_music_player_side.png",
|
tiles = {"technic_music_player_top.png", "technic_machine_bottom.png", "technic_music_player_side.png",
|
||||||
"technic_music_player_side.png", "technic_music_player_side.png", "technic_music_player_side.png"},
|
"technic_music_player_side.png", "technic_music_player_side.png", "technic_music_player_side.png"},
|
||||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1},
|
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||||
|
technic_machine=1, technic_lv=1},
|
||||||
|
connect_sides = {"bottom"},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
@ -10,7 +10,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:solar_panel', 'technic:solar_panel', 'technic:solar_panel'},
|
{'technic:solar_panel', 'technic:solar_panel', 'technic:solar_panel'},
|
||||||
{'technic:carbon_steel_ingot', 'technic:lv_transformer', 'technic:carbon_steel_ingot'},
|
{'technic:carbon_steel_ingot', 'technic:lv_transformer', 'technic:carbon_steel_ingot'},
|
||||||
{'', 'technic:lv_cable0', ''},
|
{'', 'technic:lv_cable', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -4,6 +4,17 @@
|
|||||||
|
|
||||||
local S = technic.getter
|
local S = technic.getter
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'technic:solar_panel',
|
||||||
|
recipe = {
|
||||||
|
{'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer'},
|
||||||
|
{'technic:fine_silver_wire', 'technic:lv_cable', 'mesecons_materials:glue'},
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
local run = function(pos, node)
|
local run = function(pos, node)
|
||||||
-- The action here is to make the solar panel prodice power
|
-- The action here is to make the solar panel prodice power
|
||||||
-- Power is dependent on the light level and the height above ground
|
-- Power is dependent on the light level and the height above ground
|
||||||
@ -24,7 +35,7 @@ local run = function(pos, node)
|
|||||||
local charge_to_give = math.floor((light + pos1.y) * 3)
|
local charge_to_give = math.floor((light + pos1.y) * 3)
|
||||||
charge_to_give = math.max(charge_to_give, 0)
|
charge_to_give = math.max(charge_to_give, 0)
|
||||||
charge_to_give = math.min(charge_to_give, 200)
|
charge_to_give = math.min(charge_to_give, 200)
|
||||||
meta:set_string("infotext", S("@1 Active (@2 EU)", machine_name, technic.prettynum(charge_to_give)))
|
meta:set_string("infotext", S("@1 Active (@2 EU)", machine_name, technic.pretty_num(charge_to_give)))
|
||||||
meta:set_int("LV_EU_supply", charge_to_give)
|
meta:set_int("LV_EU_supply", charge_to_give)
|
||||||
else
|
else
|
||||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||||
@ -35,7 +46,9 @@ end
|
|||||||
minetest.register_node("technic:solar_panel", {
|
minetest.register_node("technic:solar_panel", {
|
||||||
tiles = {"technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png",
|
tiles = {"technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png",
|
||||||
"technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png"},
|
"technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png"},
|
||||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1},
|
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||||
|
technic_machine=1, technic_lv=1},
|
||||||
|
connect_sides = {"bottom"},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
description = S("Small Solar %s Generator"):format("LV"),
|
description = S("Small Solar %s Generator"):format("LV"),
|
||||||
active = false,
|
active = false,
|
||||||
@ -54,14 +67,5 @@ minetest.register_node("technic:solar_panel", {
|
|||||||
technic_run = run,
|
technic_run = run,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'technic:solar_panel',
|
|
||||||
recipe = {
|
|
||||||
{'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer', 'technic:doped_silicon_wafer'},
|
|
||||||
{'technic:fine_silver_wire', 'technic:lv_cable0', 'mesecons_materials:glue'},
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
technic.register_machine("LV", "technic:solar_panel", technic.producer)
|
technic.register_machine("LV", "technic:solar_panel", technic.producer)
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:marble', 'default:diamond', 'technic:marble'},
|
{'technic:marble', 'default:diamond', 'technic:marble'},
|
||||||
{'group:wood', 'technic:machine_casing', 'group:wood'},
|
{'group:wood', 'technic:machine_casing', 'group:wood'},
|
||||||
{'technic:marble', 'technic:lv_cable0', 'technic:marble'},
|
{'technic:marble', 'technic:lv_cable', 'technic:marble'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -72,7 +72,8 @@ minetest.register_node("technic:water_mill", {
|
|||||||
"technic_water_mill_side.png", "technic_water_mill_side.png",
|
"technic_water_mill_side.png", "technic_water_mill_side.png",
|
||||||
"technic_water_mill_side.png", "technic_water_mill_side.png"},
|
"technic_water_mill_side.png", "technic_water_mill_side.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1},
|
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||||
|
technic_machine=1, technic_lv=1},
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
@ -89,7 +90,8 @@ minetest.register_node("technic:water_mill_active", {
|
|||||||
"technic_water_mill_side.png", "technic_water_mill_side.png",
|
"technic_water_mill_side.png", "technic_water_mill_side.png",
|
||||||
"technic_water_mill_side.png", "technic_water_mill_side.png"},
|
"technic_water_mill_side.png", "technic_water_mill_side.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1, not_in_creative_inventory=1},
|
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||||
|
technic_machine=1, technic_lv=1, not_in_creative_inventory=1},
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
drop = "technic:water_mill",
|
drop = "technic:water_mill",
|
||||||
|
@ -5,7 +5,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:stainless_steel_ingot', 'technic:lv_alloy_furnace', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:lv_alloy_furnace', 'technic:stainless_steel_ingot'},
|
||||||
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'},
|
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'},
|
||||||
{'technic:stainless_steel_ingot', 'technic:mv_cable0', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:lv_battery_box0', 'technic:lv_battery_box0', 'technic:lv_battery_box0'},
|
{'technic:lv_battery_box0', 'technic:lv_battery_box0', 'technic:lv_battery_box0'},
|
||||||
{'technic:lv_battery_box0', 'technic:mv_transformer', 'technic:lv_battery_box0'},
|
{'technic:lv_battery_box0', 'technic:mv_transformer', 'technic:lv_battery_box0'},
|
||||||
{'', 'technic:mv_cable0', ''},
|
{'', 'technic:mv_cable', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
minetest.register_alias("mv_cable", "technic:mv_cable0")
|
minetest.register_alias("mv_cable", "technic:mv_cable")
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'technic:mv_cable0 3',
|
output = 'technic:mv_cable 3',
|
||||||
recipe ={
|
recipe ={
|
||||||
{'technic:rubber', 'technic:rubber', 'technic:rubber'},
|
{'technic:rubber', 'technic:rubber', 'technic:rubber'},
|
||||||
{'technic:lv_cable0', 'technic:lv_cable0', 'technic:lv_cable0'},
|
{'technic:lv_cable', 'technic:lv_cable', 'technic:lv_cable'},
|
||||||
{'technic:rubber', 'technic:rubber', 'technic:rubber'},
|
{'technic:rubber', 'technic:rubber', 'technic:rubber'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -3,7 +3,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{"technic:motor", "technic:copper_plate", "technic:diamond_drill_head"},
|
{"technic:motor", "technic:copper_plate", "technic:diamond_drill_head"},
|
||||||
{"technic:copper_plate", "technic:machine_casing", "technic:copper_plate" },
|
{"technic:copper_plate", "technic:machine_casing", "technic:copper_plate" },
|
||||||
{ "pipeworks:one_way_tube", "technic:mv_cable0", "pipeworks:mese_filter" },
|
{"pipeworks:one_way_tube", "technic:mv_cable", "pipeworks:mese_filter" },
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:stainless_steel_ingot', 'technic:lv_compressor', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:lv_compressor', 'technic:stainless_steel_ingot'},
|
||||||
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'},
|
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'},
|
||||||
{'technic:stainless_steel_ingot', 'technic:mv_cable0', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:stainless_steel_ingot', 'technic:lv_electric_furnace', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:lv_electric_furnace', 'technic:stainless_steel_ingot'},
|
||||||
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'},
|
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'},
|
||||||
{'technic:stainless_steel_ingot', 'technic:mv_cable0', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:stainless_steel_ingot', 'technic:lv_extractor', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:lv_extractor', 'technic:stainless_steel_ingot'},
|
||||||
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'},
|
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'},
|
||||||
{'technic:stainless_steel_ingot', 'technic:mv_cable0', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:stainless_steel_ingot', 'technic:lv_generator', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:lv_generator', 'technic:stainless_steel_ingot'},
|
||||||
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'},
|
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'},
|
||||||
{'technic:stainless_steel_ingot', 'technic:mv_cable0', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:stainless_steel_ingot', 'technic:lv_grinder', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:lv_grinder', 'technic:stainless_steel_ingot'},
|
||||||
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'},
|
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'},
|
||||||
{'technic:stainless_steel_ingot', 'technic:mv_cable0', 'technic:stainless_steel_ingot'},
|
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -12,6 +12,16 @@
|
|||||||
|
|
||||||
local power_radius = 12
|
local power_radius = 12
|
||||||
|
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'technic:power_radiator 1',
|
||||||
|
recipe = {
|
||||||
|
{'technic:stainless_steel_ingot', 'technic:mv_transformer', 'technic:stainless_steel_ingot'},
|
||||||
|
{'technic:copper_coil', 'technic:machine_casing', 'technic:copper_coil'},
|
||||||
|
{'technic:rubber', 'technic:mv_cable', 'technic:rubber'},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
-- API for inductive powered nodes:
|
-- API for inductive powered nodes:
|
||||||
-- Use the functions below to set the corresponding callbacks
|
-- Use the functions below to set the corresponding callbacks
|
||||||
@ -135,15 +145,6 @@ minetest.register_node("technic:power_radiator", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'technic:power_radiator 1',
|
|
||||||
recipe = {
|
|
||||||
{'technic:stainless_steel_ingot', 'technic:mv_transformer', 'technic:stainless_steel_ingot'},
|
|
||||||
{'technic:copper_coil', 'technic:machine_casing', 'technic:copper_coil'},
|
|
||||||
{'technic:rubber', 'technic:mv_cable0', 'technic:rubber'},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"technic:power_radiator"},
|
nodenames = {"technic:power_radiator"},
|
||||||
interval = 1,
|
interval = 1,
|
||||||
|
@ -4,7 +4,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:solar_array_lv', 'technic:solar_array_lv', 'technic:solar_array_lv'},
|
{'technic:solar_array_lv', 'technic:solar_array_lv', 'technic:solar_array_lv'},
|
||||||
{'technic:carbon_steel_ingot', 'technic:mv_transformer', 'technic:carbon_steel_ingot'},
|
{'technic:carbon_steel_ingot', 'technic:mv_transformer', 'technic:carbon_steel_ingot'},
|
||||||
{'', 'technic:mv_cable0', ''},
|
{'', 'technic:mv_cable', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'group:wood', 'default:diamond', 'group:wood'},
|
{'group:wood', 'default:diamond', 'group:wood'},
|
||||||
{'mesecons_pistons:piston_sticky_off', 'technic:machine_casing', 'technic:carbon_cloth'},
|
{'mesecons_pistons:piston_sticky_off', 'technic:machine_casing', 'technic:carbon_cloth'},
|
||||||
{'default:obsidian', 'technic:mv_cable0', 'default:obsidian'},
|
{'default:obsidian', 'technic:mv_cable', 'default:obsidian'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -85,7 +85,9 @@ minetest.register_node("technic:tool_workshop", {
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
tiles = {"technic_workshop_top.png", "technic_machine_bottom.png", "technic_workshop_side.png",
|
tiles = {"technic_workshop_top.png", "technic_machine_bottom.png", "technic_workshop_side.png",
|
||||||
"technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"},
|
"technic_workshop_side.png", "technic_workshop_side.png", "technic_workshop_side.png"},
|
||||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1, tubedevice=1, tubedevice_receiver=1},
|
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||||
|
technic_machine=1, technic_mv=1, tubedevice=1, tubedevice_receiver=1},
|
||||||
|
connect_sides = {"bottom", "back", "left", "right"},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
@ -15,7 +15,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'', 'technic:motor', ''},
|
{'', 'technic:motor', ''},
|
||||||
{'technic:carbon_steel_ingot', 'technic:carbon_steel_block', 'technic:carbon_steel_ingot'},
|
{'technic:carbon_steel_ingot', 'technic:carbon_steel_block', 'technic:carbon_steel_ingot'},
|
||||||
{'', 'technic:mv_cable0', ''},
|
{'', 'technic:mv_cable', ''},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -55,14 +55,15 @@ local run = function(pos, node)
|
|||||||
meta:set_int("MV_EU_supply", power)
|
meta:set_int("MV_EU_supply", power)
|
||||||
end
|
end
|
||||||
|
|
||||||
meta:set_string("infotext", S("@1 (@2 EU)", machine_name, technic.prettynum(power)))
|
meta:set_string("infotext", S("@1 (@2 EU)", machine_name, technic.pretty_num(power)))
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("technic:wind_mill", {
|
minetest.register_node("technic:wind_mill", {
|
||||||
description = S("Wind %s Generator"):format("MV"),
|
description = S("Wind %s Generator"):format("MV"),
|
||||||
tiles = {"technic_carbon_steel_block.png"},
|
tiles = {"technic_carbon_steel_block.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {cracky=1, technic_machine=1},
|
groups = {cracky=1, technic_machine=1, technic_mv=1},
|
||||||
|
connect_sides = {"top", "bottom", "back", "left", "right"},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
|
@ -151,7 +151,7 @@ function technic.register_battery_box(data)
|
|||||||
..":technic_power_meter_fg.png]")
|
..":technic_power_meter_fg.png]")
|
||||||
|
|
||||||
local infotext = S("@1 Battery Box: @2/@3", tier,
|
local infotext = S("@1 Battery Box: @2/@3", tier,
|
||||||
technic.prettynum(current_charge), technic.prettynum(max_charge))
|
technic.pretty_num(current_charge), technic.pretty_num(max_charge))
|
||||||
if eu_input == 0 then
|
if eu_input == 0 then
|
||||||
infotext = S("%s Idle"):format(infotext)
|
infotext = S("%s Idle"):format(infotext)
|
||||||
end
|
end
|
||||||
@ -159,7 +159,8 @@ function technic.register_battery_box(data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for i = 0, 8 do
|
for i = 0, 8 do
|
||||||
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1}
|
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||||
|
technic_machine=1, ["technic_"..ltier]=1}
|
||||||
if i ~= 0 then
|
if i ~= 0 then
|
||||||
groups.not_in_creative_inventory = 1
|
groups.not_in_creative_inventory = 1
|
||||||
end
|
end
|
||||||
@ -178,6 +179,7 @@ function technic.register_battery_box(data)
|
|||||||
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png",
|
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png",
|
||||||
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png"},
|
"technic_"..ltier.."_battery_box_side.png^technic_power_meter"..i..".png"},
|
||||||
groups = groups,
|
groups = groups,
|
||||||
|
connect_sides = {"bottom"},
|
||||||
tube = data.tube and tube or nil,
|
tube = data.tube and tube or nil,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
|
@ -1,177 +1,65 @@
|
|||||||
|
|
||||||
local S = technic.getter
|
local S = technic.getter
|
||||||
|
|
||||||
local cable_itstr_to_tier = {}
|
local cable_tier = {}
|
||||||
|
|
||||||
|
function technic.is_tier_cable(name, tier)
|
||||||
|
return cable_tier[name] == tier
|
||||||
|
end
|
||||||
|
|
||||||
|
function technic.get_cable_tier(name)
|
||||||
|
return cable_tier[name]
|
||||||
|
end
|
||||||
|
|
||||||
|
local function clear_networks()
|
||||||
|
technic.networks = {}
|
||||||
|
end
|
||||||
|
|
||||||
function technic.register_cable(tier, size)
|
function technic.register_cable(tier, size)
|
||||||
local ltier = string.lower(tier)
|
local ltier = string.lower(tier)
|
||||||
|
cable_tier["technic:"..ltier.."_cable"] = tier
|
||||||
for x1 = 0, 1 do
|
|
||||||
for x2 = 0, 1 do
|
|
||||||
for y1 = 0, 1 do
|
|
||||||
for y2 = 0, 1 do
|
|
||||||
for z1 = 0, 1 do
|
|
||||||
for z2 = 0, 1 do
|
|
||||||
local id = technic.get_cable_id({x1, x2, y1, y2, z1, z2})
|
|
||||||
|
|
||||||
cable_itstr_to_tier["technic:"..ltier.."_cable"..id] = tier
|
|
||||||
|
|
||||||
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}
|
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2}
|
||||||
if id ~= 0 then
|
|
||||||
groups.not_in_creative_inventory = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_node("technic:"..ltier.."_cable"..id, {
|
local node_box = {
|
||||||
|
type = "connected",
|
||||||
|
fixed = {-size, -size, -size, size, size, size},
|
||||||
|
connect_top = {-size, -size, -size, size, 0.5, size}, -- y+
|
||||||
|
connect_bottom = {-size, -0.5, -size, size, size, size}, -- y-
|
||||||
|
connect_front = {-size, -size, -0.5, size, size, size}, -- z-
|
||||||
|
connect_back = {-size, -size, size, size, size, 0.5 }, -- z+
|
||||||
|
connect_left = {-0.5, -size, -size, size, size, size}, -- x-
|
||||||
|
connect_right = {-size, -size, -size, 0.5, size, size}, -- x+
|
||||||
|
}
|
||||||
|
|
||||||
|
minetest.register_node("technic:"..ltier.."_cable", {
|
||||||
description = S("%s Cable"):format(tier),
|
description = S("%s Cable"):format(tier),
|
||||||
tiles = {"technic_"..ltier.."_cable.png"},
|
tiles = {"technic_"..ltier.."_cable.png"},
|
||||||
inventory_image = "technic_"..ltier.."_cable_wield.png",
|
inventory_image = "technic_"..ltier.."_cable_wield.png",
|
||||||
wield_image = "technic_"..ltier.."_cable_wield.png",
|
wield_image = "technic_"..ltier.."_cable_wield.png",
|
||||||
groups = groups,
|
groups = groups,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
drop = "technic:"..ltier.."_cable0",
|
drop = "technic:"..ltier.."_cable",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = node_box,
|
||||||
type = "fixed",
|
connects_to = {"technic:"..ltier.."_cable",
|
||||||
fixed = technic.gen_cable_nodebox(x1, y1, z1, x2, y2, z2, size)
|
"group:technic_"..ltier, "group:technic_all_tiers"},
|
||||||
},
|
on_construct = clear_networks,
|
||||||
on_construct = function()
|
on_destruct = clear_networks,
|
||||||
technic.networks = {}
|
|
||||||
end,
|
|
||||||
on_destruct = function()
|
|
||||||
technic.networks = {}
|
|
||||||
end,
|
|
||||||
after_place_node = function(pos)
|
|
||||||
local node = minetest.get_node(pos)
|
|
||||||
technic.update_cables(pos, technic.get_cable_tier(node.name))
|
|
||||||
end,
|
|
||||||
after_dig_node = function(pos, oldnode)
|
|
||||||
local tier = technic.get_cable_tier(oldnode.name)
|
|
||||||
technic.update_cables(pos, tier, true)
|
|
||||||
end
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_on_placenode(function(pos, node)
|
|
||||||
|
local function clear_nets_if_machine(pos, node)
|
||||||
for tier, machine_list in pairs(technic.machines) do
|
for tier, machine_list in pairs(technic.machines) do
|
||||||
if machine_list[node.name] ~= nil then
|
if machine_list[node.name] ~= nil then
|
||||||
technic.update_cables(pos, tier, true)
|
return clear_networks()
|
||||||
technic.networks = {}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
minetest.register_on_dignode(function(pos, node)
|
|
||||||
for tier, machine_list in pairs(technic.machines) do
|
|
||||||
if machine_list[node.name] ~= nil then
|
|
||||||
technic.update_cables(pos, tier, true)
|
|
||||||
technic.networks = {}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
function technic.get_cable_id(links)
|
|
||||||
return (links[6] * 1) + (links[5] * 2)
|
|
||||||
+ (links[4] * 4) + (links[3] * 8)
|
|
||||||
+ (links[2] * 16) + (links[1] * 32)
|
|
||||||
end
|
|
||||||
|
|
||||||
function technic.update_cables(pos, tier, no_set, secondrun)
|
|
||||||
local link_positions = {
|
|
||||||
{x=pos.x+1, y=pos.y, z=pos.z},
|
|
||||||
{x=pos.x-1, y=pos.y, z=pos.z},
|
|
||||||
{x=pos.x, y=pos.y+1, z=pos.z},
|
|
||||||
{x=pos.x, y=pos.y-1, z=pos.z},
|
|
||||||
{x=pos.x, y=pos.y, z=pos.z+1},
|
|
||||||
{x=pos.x, y=pos.y, z=pos.z-1}}
|
|
||||||
|
|
||||||
local links = {0, 0, 0, 0, 0, 0}
|
|
||||||
|
|
||||||
for i, link_pos in pairs(link_positions) do
|
|
||||||
local connect_type = technic.cables_should_connect(pos, link_pos, tier)
|
|
||||||
if connect_type then
|
|
||||||
links[i] = 1
|
|
||||||
-- Have cables next to us update theirselves,
|
|
||||||
-- but only once. (We don't want to update the entire
|
|
||||||
-- network or start an infinite loop of updates)
|
|
||||||
if not secondrun and connect_type == "cable" then
|
|
||||||
technic.update_cables(link_pos, tier, false, true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- We don't want to set ourselves if we have been removed or we are
|
|
||||||
-- updating a machine
|
|
||||||
if not no_set then
|
|
||||||
minetest.set_node(pos, {name="technic:"..string.lower(tier)
|
|
||||||
.."_cable"..technic.get_cable_id(links)})
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.register_on_placenode(clear_nets_if_machine)
|
||||||
function technic.is_tier_cable(name, tier)
|
minetest.register_on_dignode(clear_nets_if_machine)
|
||||||
return cable_itstr_to_tier[name] and cable_itstr_to_tier[name] == tier
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function technic.get_cable_tier(name)
|
|
||||||
return cable_itstr_to_tier[name]
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function technic.cables_should_connect(pos1, pos2, tier)
|
|
||||||
local name = minetest.get_node(pos2).name
|
|
||||||
|
|
||||||
if name == "technic:switching_station" then
|
|
||||||
return pos2.y == pos1.y + 1 and "machine" or false
|
|
||||||
elseif name == "technic:supply_converter" then
|
|
||||||
return math.abs(pos2.y - pos1.y) == 1 and "machine" or false
|
|
||||||
elseif technic.is_tier_cable(name, tier) then
|
|
||||||
return "cable"
|
|
||||||
elseif technic.machines[tier][name] then
|
|
||||||
return "machine"
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function technic.gen_cable_nodebox(x1, y1, z1, x2, y2, z2, size)
|
|
||||||
-- Nodeboxes
|
|
||||||
local box_center = {-size, -size, -size, size, size, size}
|
|
||||||
local box_y1 = {-size, -size, -size, size, 0.5, size} -- y+
|
|
||||||
local box_x1 = {-size, -size, -size, 0.5, size, size} -- x+
|
|
||||||
local box_z1 = {-size, -size, size, size, size, 0.5} -- z+
|
|
||||||
local box_z2 = {-size, -size, -0.5, size, size, size} -- z-
|
|
||||||
local box_y2 = {-size, -0.5, -size, size, size, size} -- y-
|
|
||||||
local box_x2 = {-0.5, -size, -size, size, size, size} -- x-
|
|
||||||
|
|
||||||
local box = {box_center}
|
|
||||||
if x1 == 1 then
|
|
||||||
table.insert(box, box_x1)
|
|
||||||
end
|
|
||||||
if y1 == 1 then
|
|
||||||
table.insert(box, box_y1)
|
|
||||||
end
|
|
||||||
if z1 == 1 then
|
|
||||||
table.insert(box, box_z1)
|
|
||||||
end
|
|
||||||
if x2 == 1 then
|
|
||||||
table.insert(box, box_x2)
|
|
||||||
end
|
|
||||||
if y2 == 1 then
|
|
||||||
table.insert(box, box_y2)
|
|
||||||
end
|
|
||||||
if z2 == 1 then
|
|
||||||
table.insert(box, box_z2)
|
|
||||||
end
|
|
||||||
return box
|
|
||||||
end
|
|
||||||
|
|
||||||
|
@ -18,14 +18,14 @@ function technic.register_generator(data)
|
|||||||
local tier = data.tier
|
local tier = data.tier
|
||||||
local ltier = string.lower(tier)
|
local ltier = string.lower(tier)
|
||||||
|
|
||||||
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1}
|
local groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||||
local active_groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1, not_in_creative_inventory=1}
|
technic_machine=1, ["technic_"..ltier]=1}
|
||||||
if data.tube then
|
if data.tube then
|
||||||
groups.tubedevice = 1
|
groups.tubedevice = 1
|
||||||
groups.tubedevice_receiver = 1
|
groups.tubedevice_receiver = 1
|
||||||
active_groups.tubedevice = 1
|
|
||||||
active_groups.tubedevice_receiver = 1
|
|
||||||
end
|
end
|
||||||
|
local active_groups = {not_in_creative_inventory = 1}
|
||||||
|
for k, v in pairs(groups) do active_groups[k] = v end
|
||||||
|
|
||||||
local generator_formspec =
|
local generator_formspec =
|
||||||
"invsize[8,9;]"..
|
"invsize[8,9;]"..
|
||||||
@ -93,6 +93,7 @@ function technic.register_generator(data)
|
|||||||
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front.png"},
|
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = groups,
|
groups = groups,
|
||||||
|
connect_sides = {"bottom", "back", "left", "right"},
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
tube = data.tube and tube or nil,
|
tube = data.tube and tube or nil,
|
||||||
@ -122,6 +123,7 @@ function technic.register_generator(data)
|
|||||||
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front_active.png"},
|
"technic_"..ltier.."_generator_side.png", "technic_"..ltier.."_generator_front_active.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = active_groups,
|
groups = active_groups,
|
||||||
|
connect_sides = {"bottom"},
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
tube = data.tube and tube or nil,
|
tube = data.tube and tube or nil,
|
||||||
|
@ -15,6 +15,8 @@ local tube = {
|
|||||||
connect_sides = {left = 1, right = 1, back = 1, top = 1, bottom = 1},
|
connect_sides = {left = 1, right = 1, back = 1, top = 1, bottom = 1},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local connect_default = {"bottom", "back", "left", "right"}
|
||||||
|
|
||||||
local function round(v)
|
local function round(v)
|
||||||
return math.floor(v + 0.5)
|
return math.floor(v + 0.5)
|
||||||
end
|
end
|
||||||
@ -27,15 +29,13 @@ function technic.register_base_machine(data)
|
|||||||
local tier = data.tier
|
local tier = data.tier
|
||||||
local ltier = string.lower(tier)
|
local ltier = string.lower(tier)
|
||||||
|
|
||||||
local groups = {cracky = 2, technic_machine = 1}
|
local groups = {cracky = 2, technic_machine = 1, ["technic_"..ltier] = 1}
|
||||||
local active_groups = {cracky = 2, technic_machine = 1, not_in_creative_inventory = 1}
|
|
||||||
if data.tube then
|
if data.tube then
|
||||||
groups.tubedevice = 1
|
groups.tubedevice = 1
|
||||||
groups.tubedevice_receiver = 1
|
groups.tubedevice_receiver = 1
|
||||||
active_groups.tubedevice = 1
|
|
||||||
active_groups.tubedevice_receiver = 1
|
|
||||||
end
|
end
|
||||||
|
local active_groups = {not_in_creative_inventory = 1}
|
||||||
|
for k, v in pairs(groups) do active_groups[k] = v end
|
||||||
|
|
||||||
local formspec =
|
local formspec =
|
||||||
"invsize[8,9;]"..
|
"invsize[8,9;]"..
|
||||||
@ -145,6 +145,7 @@ function technic.register_base_machine(data)
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = groups,
|
groups = groups,
|
||||||
tube = data.tube and tube or nil,
|
tube = data.tube and tube or nil,
|
||||||
|
connect_sides = data.connect_sides or connect_default,
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
@ -179,6 +180,7 @@ function technic.register_base_machine(data)
|
|||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
drop = "technic:"..ltier.."_"..machine_name,
|
drop = "technic:"..ltier.."_"..machine_name,
|
||||||
groups = active_groups,
|
groups = active_groups,
|
||||||
|
connect_sides = data.connect_sides or connect_default,
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
tube = data.tube and tube or nil,
|
tube = data.tube and tube or nil,
|
||||||
|
@ -30,7 +30,7 @@ function technic.register_solar_array(data)
|
|||||||
local charge_to_give = math.floor((light + pos.y) * data.power)
|
local charge_to_give = math.floor((light + pos.y) * data.power)
|
||||||
charge_to_give = math.max(charge_to_give, 0)
|
charge_to_give = math.max(charge_to_give, 0)
|
||||||
charge_to_give = math.min(charge_to_give, data.power * 50)
|
charge_to_give = math.min(charge_to_give, data.power * 50)
|
||||||
meta:set_string("infotext", S("@1 Active (@2 EU)", machine_name, technic.prettynum(charge_to_give)))
|
meta:set_string("infotext", S("@1 Active (@2 EU)", machine_name, technic.pretty_num(charge_to_give)))
|
||||||
meta:set_int(tier.."_EU_supply", charge_to_give)
|
meta:set_int(tier.."_EU_supply", charge_to_give)
|
||||||
else
|
else
|
||||||
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
meta:set_string("infotext", S("%s Idle"):format(machine_name))
|
||||||
@ -42,7 +42,8 @@ function technic.register_solar_array(data)
|
|||||||
tiles = {"technic_"..ltier.."_solar_array_top.png", "technic_"..ltier.."_solar_array_bottom.png",
|
tiles = {"technic_"..ltier.."_solar_array_top.png", "technic_"..ltier.."_solar_array_bottom.png",
|
||||||
"technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png",
|
"technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png",
|
||||||
"technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png"},
|
"technic_"..ltier.."_solar_array_side.png", "technic_"..ltier.."_solar_array_side.png"},
|
||||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1},
|
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1, ["technic_"..ltier]=1},
|
||||||
|
connect_sides = {"bottom"},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
description = S("Arrayed Solar %s Generator"):format(tier),
|
description = S("Arrayed Solar %s Generator"):format(tier),
|
||||||
active = false,
|
active = false,
|
||||||
|
@ -30,7 +30,7 @@ local run = function(pos, node)
|
|||||||
meta:set_int(from.."_EU_supply", 0)
|
meta:set_int(from.."_EU_supply", 0)
|
||||||
meta:set_int(to.."_EU_demand", 0)
|
meta:set_int(to.."_EU_demand", 0)
|
||||||
meta:set_int(to.."_EU_supply", input * remain)
|
meta:set_int(to.."_EU_supply", input * remain)
|
||||||
meta:set_string("infotext", S("@1 (@2 @3 -> @4 @5)", machine_name, technic.prettynum(input), from, technic.prettynum(input * remain), to))
|
meta:set_string("infotext", S("@1 (@2 @3 -> @4 @5)", machine_name, technic.pretty_num(input), from, technic.pretty_num(input * remain), to))
|
||||||
else
|
else
|
||||||
meta:set_string("infotext", S("%s Has Bad Cabling"):format(machine_name))
|
meta:set_string("infotext", S("%s Has Bad Cabling"):format(machine_name))
|
||||||
if to then
|
if to then
|
||||||
@ -49,14 +49,10 @@ minetest.register_node("technic:supply_converter", {
|
|||||||
tiles = {"technic_supply_converter_top.png", "technic_supply_converter_bottom.png",
|
tiles = {"technic_supply_converter_top.png", "technic_supply_converter_bottom.png",
|
||||||
"technic_supply_converter_side.png", "technic_supply_converter_side.png",
|
"technic_supply_converter_side.png", "technic_supply_converter_side.png",
|
||||||
"technic_supply_converter_side.png", "technic_supply_converter_side.png"},
|
"technic_supply_converter_side.png", "technic_supply_converter_side.png"},
|
||||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_machine=1},
|
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||||
|
technic_machine=1, technic_all_tiers=1},
|
||||||
|
connect_sides = {"top", "bottom"},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
drawtype = "nodebox",
|
|
||||||
paramtype = "light",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
|
||||||
},
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", S("Supply Converter"))
|
meta:set_string("infotext", S("Supply Converter"))
|
||||||
@ -70,7 +66,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{'technic:fine_gold_wire', 'technic:rubber', 'technic:doped_silicon_wafer'},
|
{'technic:fine_gold_wire', 'technic:rubber', 'technic:doped_silicon_wafer'},
|
||||||
{'technic:mv_transformer', 'technic:machine_casing', 'technic:lv_transformer'},
|
{'technic:mv_transformer', 'technic:machine_casing', 'technic:lv_transformer'},
|
||||||
{'technic:mv_cable0', 'technic:rubber', 'technic:lv_cable0'},
|
{'technic:mv_cable', 'technic:rubber', 'technic:lv_cable'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{"", "technic:lv_transformer", ""},
|
{"", "technic:lv_transformer", ""},
|
||||||
{"default:copper_ingot", "technic:machine_casing", "default:copper_ingot"},
|
{"default:copper_ingot", "technic:machine_casing", "default:copper_ingot"},
|
||||||
{"technic:lv_cable0", "technic:lv_cable0", "technic:lv_cable0"}
|
{"technic:lv_cable", "technic:lv_cable", "technic:lv_cable"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -49,14 +49,9 @@ minetest.register_node("technic:switching_station",{
|
|||||||
tiles = {"technic_water_mill_top_active.png", "technic_water_mill_top_active.png",
|
tiles = {"technic_water_mill_top_active.png", "technic_water_mill_top_active.png",
|
||||||
"technic_water_mill_top_active.png", "technic_water_mill_top_active.png",
|
"technic_water_mill_top_active.png", "technic_water_mill_top_active.png",
|
||||||
"technic_water_mill_top_active.png", "technic_water_mill_top_active.png"},
|
"technic_water_mill_top_active.png", "technic_water_mill_top_active.png"},
|
||||||
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2},
|
groups = {snappy=2, choppy=2, oddly_breakable_by_hand=2, technic_all_tiers=1},
|
||||||
|
connect_sides = {"bottom"},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
drawtype = "nodebox",
|
|
||||||
paramtype = "light",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
|
||||||
},
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", S("Switching Station"))
|
meta:set_string("infotext", S("Switching Station"))
|
||||||
@ -294,7 +289,7 @@ minetest.register_abm({
|
|||||||
|
|
||||||
meta:set_string("infotext",
|
meta:set_string("infotext",
|
||||||
S("@1. Supply: @2 Demand: @3",
|
S("@1. Supply: @2 Demand: @3",
|
||||||
machine_name, technic.prettynum(PR_eu_supply), technic.prettynum(RE_eu_demand)))
|
machine_name, technic.pretty_num(PR_eu_supply), technic.pretty_num(RE_eu_demand)))
|
||||||
|
|
||||||
-- If the PR supply is enough for the RE demand supply them all
|
-- If the PR supply is enough for the RE demand supply them all
|
||||||
if PR_eu_supply >= RE_eu_demand then
|
if PR_eu_supply >= RE_eu_demand then
|
||||||
|
@ -32,67 +32,6 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Based on code by Uberi: https://gist.github.com/Uberi/3125280
|
|
||||||
local function rayIter(pos, dir, range)
|
|
||||||
local p = vector.round(pos)
|
|
||||||
local x_step, y_step, z_step = 0, 0, 0
|
|
||||||
local x_component, y_component, z_component = 0, 0, 0
|
|
||||||
local x_intersect, y_intersect, z_intersect = 0, 0, 0
|
|
||||||
|
|
||||||
if dir.x == 0 then
|
|
||||||
x_intersect = math.huge
|
|
||||||
elseif dir.x > 0 then
|
|
||||||
x_step = 1
|
|
||||||
x_component = 1 / dir.x
|
|
||||||
x_intersect = x_component
|
|
||||||
else
|
|
||||||
x_step = -1
|
|
||||||
x_component = 1 / -dir.x
|
|
||||||
end
|
|
||||||
if dir.y == 0 then
|
|
||||||
y_intersect = math.huge
|
|
||||||
elseif dir.y > 0 then
|
|
||||||
y_step = 1
|
|
||||||
y_component = 1 / dir.y
|
|
||||||
y_intersect = y_component
|
|
||||||
else
|
|
||||||
y_step = -1
|
|
||||||
y_component = 1 / -dir.y
|
|
||||||
end
|
|
||||||
if dir.z == 0 then
|
|
||||||
z_intersect = math.huge
|
|
||||||
elseif dir.z > 0 then
|
|
||||||
z_step = 1
|
|
||||||
z_component = 1 / dir.z
|
|
||||||
z_intersect = z_component
|
|
||||||
else
|
|
||||||
z_step = -1
|
|
||||||
z_component = 1 / -dir.z
|
|
||||||
end
|
|
||||||
|
|
||||||
return function()
|
|
||||||
if x_intersect < y_intersect then
|
|
||||||
if x_intersect < z_intersect then
|
|
||||||
p.x = p.x + x_step
|
|
||||||
x_intersect = x_intersect + x_component
|
|
||||||
else
|
|
||||||
p.z = p.z + z_step
|
|
||||||
z_intersect = z_intersect + z_component
|
|
||||||
end
|
|
||||||
elseif y_intersect < z_intersect then
|
|
||||||
p.y = p.y + y_step
|
|
||||||
y_intersect = y_intersect + y_component
|
|
||||||
else
|
|
||||||
p.z = p.z + z_step
|
|
||||||
z_intersect = z_intersect + z_component
|
|
||||||
end
|
|
||||||
if vector.distance(pos, p) > range then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
return p
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function laser_node(pos, node, player)
|
local function laser_node(pos, node, player)
|
||||||
local def = minetest.registered_nodes[node.name]
|
local def = minetest.registered_nodes[node.name]
|
||||||
if def and def.liquidtype ~= "none" then
|
if def and def.liquidtype ~= "none" then
|
||||||
@ -132,7 +71,7 @@ local function laser_shoot(player, range, particle_texture, sound)
|
|||||||
texture = particle_texture .. "^[transform" .. math.random(0, 7),
|
texture = particle_texture .. "^[transform" .. math.random(0, 7),
|
||||||
})
|
})
|
||||||
minetest.sound_play(sound, {pos = player_pos, max_hear_distance = range})
|
minetest.sound_play(sound, {pos = player_pos, max_hear_distance = range})
|
||||||
for pos in rayIter(start_pos, dir, range) do
|
for pos in technic.trace_node_ray(start_pos, dir, range) do
|
||||||
if minetest.is_protected(pos, player_name) then
|
if minetest.is_protected(pos, player_name) then
|
||||||
minetest.record_protection_violation(pos, player_name)
|
minetest.record_protection_violation(pos, player_name)
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user