2014-11-13 18:25:36 +01:00
|
|
|
--- Forcefield generator.
|
|
|
|
-- @author ShadowNinja
|
2013-07-17 21:34:35 +02:00
|
|
|
--
|
|
|
|
-- Forcefields are powerful barriers but they consume huge amounts of power.
|
2014-11-13 18:25:36 +01:00
|
|
|
-- The forcefield Generator is an HV machine.
|
2013-07-17 21:34:35 +02:00
|
|
|
|
|
|
|
-- How expensive is the generator?
|
|
|
|
-- Leaves room for upgrades lowering the power drain?
|
2017-04-01 21:52:12 +02:00
|
|
|
local digilines_path = minetest.get_modpath("digilines")
|
|
|
|
|
2013-07-17 21:34:35 +02:00
|
|
|
local forcefield_power_drain = 10
|
|
|
|
|
2013-10-30 18:45:32 +01:00
|
|
|
local S = technic.getter
|
|
|
|
|
2017-04-11 14:31:17 +02:00
|
|
|
local cable_entry = "^technic_cable_connection_overlay.png"
|
|
|
|
|
2013-07-17 21:34:35 +02:00
|
|
|
minetest.register_craft({
|
2014-11-13 18:25:36 +01:00
|
|
|
output = "technic:forcefield_emitter_off",
|
2013-07-17 21:34:35 +02:00
|
|
|
recipe = {
|
2018-10-31 01:29:28 +01:00
|
|
|
{"default:mese", "basic_materials:motor", "default:mese" },
|
2017-06-05 16:56:03 +02:00
|
|
|
{"technic:deployer_off", "technic:machine_casing", "technic:deployer_off"},
|
|
|
|
{"default:mese", "technic:hv_cable", "default:mese" },
|
2013-07-17 21:34:35 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2014-11-13 18:25:36 +01:00
|
|
|
local replaceable_cids = {}
|
|
|
|
|
|
|
|
minetest.after(0, function()
|
|
|
|
for name, ndef in pairs(minetest.registered_nodes) do
|
|
|
|
if ndef.buildable_to == true and name ~= "ignore" then
|
|
|
|
replaceable_cids[minetest.get_content_id(name)] = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
2013-07-17 21:34:35 +02:00
|
|
|
-- Idea: Let forcefields have different colors by upgrade slot.
|
|
|
|
-- Idea: Let forcefields add up by detecting if one hits another.
|
|
|
|
-- ___ __
|
|
|
|
-- / \/ \
|
|
|
|
-- | |
|
|
|
|
-- \___/\___/
|
|
|
|
|
2018-12-09 15:57:48 +01:00
|
|
|
local function update_forcefield(pos, meta, active)
|
2014-08-14 21:50:40 +02:00
|
|
|
local shape = meta:get_int("shape")
|
|
|
|
local range = meta:get_int("range")
|
2013-07-17 21:34:35 +02:00
|
|
|
local vm = VoxelManip()
|
2014-11-13 18:25:36 +01:00
|
|
|
local MinEdge, MaxEdge = vm:read_from_map(vector.subtract(pos, range),
|
|
|
|
vector.add(pos, range))
|
2013-07-17 21:34:35 +02:00
|
|
|
local area = VoxelArea:new({MinEdge = MinEdge, MaxEdge = MaxEdge})
|
|
|
|
local data = vm:get_data()
|
|
|
|
|
2014-11-13 18:25:36 +01:00
|
|
|
local c_air = minetest.get_content_id("air")
|
2013-07-17 21:34:35 +02:00
|
|
|
local c_field = minetest.get_content_id("technic:forcefield")
|
|
|
|
|
2014-11-13 18:25:36 +01:00
|
|
|
for z = -range, range do
|
|
|
|
for y = -range, range do
|
|
|
|
local vi = area:index(pos.x + (-range), pos.y + y, pos.z + z)
|
|
|
|
for x = -range, range do
|
2014-08-14 21:50:40 +02:00
|
|
|
local relevant
|
|
|
|
if shape == 0 then
|
2014-11-13 18:25:36 +01:00
|
|
|
local squared = x * x + y * y + z * z
|
2014-08-14 21:50:40 +02:00
|
|
|
relevant =
|
2014-11-13 18:25:36 +01:00
|
|
|
squared <= range * range + range and
|
|
|
|
squared >= (range - 1) * (range - 1) + (range - 1)
|
2014-08-14 21:50:40 +02:00
|
|
|
else
|
|
|
|
relevant =
|
|
|
|
x == -range or x == range or
|
|
|
|
y == -range or y == range or
|
|
|
|
z == -range or z == range
|
|
|
|
end
|
|
|
|
if relevant then
|
2014-11-13 18:25:36 +01:00
|
|
|
local cid = data[vi]
|
|
|
|
if active and replaceable_cids[cid] then
|
2013-07-17 21:34:35 +02:00
|
|
|
data[vi] = c_field
|
2014-11-13 18:25:36 +01:00
|
|
|
elseif not active and cid == c_field then
|
2013-07-17 21:34:35 +02:00
|
|
|
data[vi] = c_air
|
|
|
|
end
|
|
|
|
end
|
|
|
|
vi = vi + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
vm:set_data(data)
|
|
|
|
vm:update_liquids()
|
|
|
|
vm:write_to_map()
|
|
|
|
end
|
|
|
|
|
2014-07-03 00:59:53 +02:00
|
|
|
local function set_forcefield_formspec(meta)
|
2017-04-01 21:52:12 +02:00
|
|
|
local formspec
|
|
|
|
if digilines_path then
|
|
|
|
formspec = "size[5,3.25]"..
|
|
|
|
"field[0.3,3;5,1;channel;Digiline Channel;"..meta:get_string("channel").."]"
|
|
|
|
else
|
|
|
|
formspec = "size[5,2.25]"
|
|
|
|
end
|
|
|
|
formspec = formspec..
|
2014-08-14 21:50:40 +02:00
|
|
|
"field[0.3,0.5;2,1;range;"..S("Range")..";"..meta:get_int("range").."]"
|
2014-07-16 00:42:27 +02:00
|
|
|
-- The names for these toggle buttons are explicit about which
|
|
|
|
-- state they'll switch to, so that multiple presses (arising
|
|
|
|
-- from the ambiguity between lag and a missed press) only make
|
|
|
|
-- the single change that the user expects.
|
2014-08-14 21:50:40 +02:00
|
|
|
if meta:get_int("shape") == 0 then
|
|
|
|
formspec = formspec.."button[3,0.2;2,1;shape1;"..S("Sphere").."]"
|
|
|
|
else
|
|
|
|
formspec = formspec.."button[3,0.2;2,1;shape0;"..S("Cube").."]"
|
|
|
|
end
|
2014-07-14 15:58:59 +02:00
|
|
|
if meta:get_int("mesecon_mode") == 0 then
|
2014-07-16 00:42:27 +02:00
|
|
|
formspec = formspec.."button[0,1;5,1;mesecon_mode_1;"..S("Ignoring Mesecon Signal").."]"
|
2014-07-14 15:58:59 +02:00
|
|
|
else
|
2014-07-16 00:42:27 +02:00
|
|
|
formspec = formspec.."button[0,1;5,1;mesecon_mode_0;"..S("Controlled by Mesecon Signal").."]"
|
2014-07-14 15:58:59 +02:00
|
|
|
end
|
2014-07-03 00:59:53 +02:00
|
|
|
if meta:get_int("enabled") == 0 then
|
2014-07-16 00:42:27 +02:00
|
|
|
formspec = formspec.."button[0,1.75;5,1;enable;"..S("%s Disabled"):format(S("%s Forcefield Emitter"):format("HV")).."]"
|
2014-07-03 00:59:53 +02:00
|
|
|
else
|
2014-07-16 00:42:27 +02:00
|
|
|
formspec = formspec.."button[0,1.75;5,1;disable;"..S("%s Enabled"):format(S("%s Forcefield Emitter"):format("HV")).."]"
|
2014-07-03 00:59:53 +02:00
|
|
|
end
|
|
|
|
meta:set_string("formspec", formspec)
|
2013-07-17 21:34:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
local forcefield_receive_fields = function(pos, formname, fields, sender)
|
2019-04-13 20:45:49 +02:00
|
|
|
local player_name = sender:get_player_name()
|
|
|
|
if minetest.is_protected(pos, player_name) then
|
|
|
|
minetest.chat_send_player(player_name, "You are not allowed to edit this!")
|
|
|
|
minetest.record_protection_violation(pos, player_name)
|
|
|
|
return
|
|
|
|
end
|
2013-07-17 21:34:35 +02:00
|
|
|
local meta = minetest.get_meta(pos)
|
2014-08-14 21:50:40 +02:00
|
|
|
local range = nil
|
2014-07-03 00:59:53 +02:00
|
|
|
if fields.range then
|
2014-08-14 21:50:40 +02:00
|
|
|
range = tonumber(fields.range) or 0
|
2014-07-03 00:59:53 +02:00
|
|
|
-- Smallest field is 5. Anything less is asking for trouble.
|
|
|
|
-- Largest is 20. It is a matter of pratical node handling.
|
|
|
|
-- At the maximim range updating the forcefield takes about 0.2s
|
|
|
|
range = math.max(range, 5)
|
|
|
|
range = math.min(range, 20)
|
2014-08-14 21:50:40 +02:00
|
|
|
if range == meta:get_int("range") then range = nil end
|
2013-07-17 21:34:35 +02:00
|
|
|
end
|
2014-08-14 21:50:40 +02:00
|
|
|
if fields.shape0 or fields.shape1 or range then
|
|
|
|
update_forcefield(pos, meta, false)
|
|
|
|
end
|
|
|
|
if range then meta:set_int("range", range) end
|
2017-04-01 21:52:12 +02:00
|
|
|
if fields.channel then meta:set_string("channel", fields.channel) end
|
|
|
|
if fields.shape0 then meta:set_int("shape", 0) end
|
|
|
|
if fields.shape1 then meta:set_int("shape", 1) end
|
|
|
|
if fields.enable then meta:set_int("enabled", 1) end
|
2014-07-03 00:59:53 +02:00
|
|
|
if fields.disable then meta:set_int("enabled", 0) end
|
2014-07-14 15:58:59 +02:00
|
|
|
if fields.mesecon_mode_0 then meta:set_int("mesecon_mode", 0) end
|
|
|
|
if fields.mesecon_mode_1 then meta:set_int("mesecon_mode", 1) end
|
2014-07-03 00:59:53 +02:00
|
|
|
set_forcefield_formspec(meta)
|
2013-07-17 21:34:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
local mesecons = {
|
|
|
|
effector = {
|
|
|
|
action_on = function(pos, node)
|
2014-07-14 15:58:59 +02:00
|
|
|
minetest.get_meta(pos):set_int("mesecon_effect", 1)
|
2013-07-17 21:34:35 +02:00
|
|
|
end,
|
|
|
|
action_off = function(pos, node)
|
2014-07-14 15:58:59 +02:00
|
|
|
minetest.get_meta(pos):set_int("mesecon_effect", 0)
|
2013-07-17 21:34:35 +02:00
|
|
|
end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-01 21:52:12 +02:00
|
|
|
local digiline_def = {
|
|
|
|
receptor = {action = function() end},
|
|
|
|
effector = {
|
|
|
|
action = function(pos, node, channel, msg)
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
if channel ~= meta:get_string("channel") then
|
|
|
|
return
|
|
|
|
end
|
2017-06-05 16:56:03 +02:00
|
|
|
local msgt = type(msg)
|
|
|
|
if msgt == "string" then
|
|
|
|
local smsg = msg:lower()
|
|
|
|
msg = {}
|
|
|
|
if smsg == "get" then
|
|
|
|
msg.command = "get"
|
|
|
|
elseif smsg == "off" then
|
|
|
|
msg.command = "off"
|
|
|
|
elseif smsg == "on" then
|
|
|
|
msg.command = "on"
|
|
|
|
elseif smsg == "toggle" then
|
|
|
|
msg.command = "toggle"
|
|
|
|
elseif smsg:sub(1, 5) == "range" then
|
|
|
|
msg.command = "range"
|
|
|
|
msg.value = tonumber(smsg:sub(7))
|
|
|
|
elseif smsg:sub(1, 5) == "shape" then
|
|
|
|
msg.command = "shape"
|
|
|
|
msg.value = smsg:sub(7):lower()
|
|
|
|
msg.value = tonumber(msg.value) or msg.value
|
|
|
|
end
|
|
|
|
elseif msgt ~= "table" then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
if msg.command == "get" then
|
2017-04-01 21:52:12 +02:00
|
|
|
digilines.receptor_send(pos, digilines.rules.default, channel, {
|
|
|
|
enabled = meta:get_int("enabled"),
|
|
|
|
range = meta:get_int("range"),
|
|
|
|
shape = meta:get_int("shape")
|
|
|
|
})
|
|
|
|
return
|
2017-06-05 16:56:03 +02:00
|
|
|
elseif msg.command == "off" then
|
2017-04-01 21:52:12 +02:00
|
|
|
meta:set_int("enabled", 0)
|
2017-06-05 16:56:03 +02:00
|
|
|
elseif msg.command == "on" then
|
2017-04-01 21:52:12 +02:00
|
|
|
meta:set_int("enabled", 1)
|
2017-06-05 16:56:03 +02:00
|
|
|
elseif msg.command == "toggle" then
|
2017-04-01 21:52:12 +02:00
|
|
|
local onn = meta:get_int("enabled")
|
|
|
|
onn = 1-onn -- Mirror onn with pivot 0.5, so switch between 1 and 0.
|
|
|
|
meta:set_int("enabled", onn)
|
2017-06-05 16:56:03 +02:00
|
|
|
elseif msg.command == "range" then
|
|
|
|
if type(msg.value) ~= "number" then
|
2017-04-01 21:52:12 +02:00
|
|
|
return
|
|
|
|
end
|
2017-06-05 16:56:03 +02:00
|
|
|
msg.value = math.max(msg.value, 5)
|
|
|
|
msg.value = math.min(msg.value, 20)
|
2017-04-01 21:52:12 +02:00
|
|
|
update_forcefield(pos, meta, false)
|
2017-06-05 16:56:03 +02:00
|
|
|
meta:set_int("range", msg.value)
|
|
|
|
elseif msg.command == "shape" then
|
|
|
|
local valuet = type(msg.value)
|
|
|
|
if valuet == "string" then
|
|
|
|
if msg.value == "sphere" then
|
|
|
|
msg.value = 0
|
|
|
|
elseif msg.value == "cube" then
|
|
|
|
msg.value = 1
|
|
|
|
end
|
|
|
|
elseif valuet ~= "number" then
|
|
|
|
return
|
2017-04-01 21:52:12 +02:00
|
|
|
end
|
2017-06-05 16:56:03 +02:00
|
|
|
if not msg.value then
|
2017-04-01 21:52:12 +02:00
|
|
|
return
|
|
|
|
end
|
|
|
|
update_forcefield(pos, meta, false)
|
2017-06-05 16:56:03 +02:00
|
|
|
meta:set_int("shape", msg.value)
|
2017-04-01 21:52:12 +02:00
|
|
|
else
|
|
|
|
return
|
|
|
|
end
|
|
|
|
set_forcefield_formspec(meta)
|
|
|
|
end
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2014-11-13 18:25:36 +01:00
|
|
|
local function run(pos, node)
|
2014-07-11 11:00:46 +02:00
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
local eu_input = meta:get_int("HV_EU_input")
|
2017-06-05 16:56:03 +02:00
|
|
|
local enabled = meta:get_int("enabled") ~= 0 and
|
|
|
|
(meta:get_int("mesecon_mode") == 0 or meta:get_int("mesecon_effect") ~= 0)
|
2014-07-11 11:00:46 +02:00
|
|
|
local machine_name = S("%s Forcefield Emitter"):format("HV")
|
|
|
|
|
2014-08-14 21:50:40 +02:00
|
|
|
local range = meta:get_int("range")
|
|
|
|
local power_requirement
|
|
|
|
if meta:get_int("shape") == 0 then
|
|
|
|
power_requirement = math.floor(4 * math.pi * range * range)
|
|
|
|
else
|
|
|
|
power_requirement = 24 * range * range
|
|
|
|
end
|
|
|
|
power_requirement = power_requirement * forcefield_power_drain
|
2014-07-11 11:00:46 +02:00
|
|
|
|
2014-07-14 15:58:59 +02:00
|
|
|
if not enabled then
|
2014-07-11 11:00:46 +02:00
|
|
|
if node.name == "technic:forcefield_emitter_on" then
|
2014-08-14 21:50:40 +02:00
|
|
|
update_forcefield(pos, meta, false)
|
2014-07-11 11:00:46 +02:00
|
|
|
technic.swap_node(pos, "technic:forcefield_emitter_off")
|
|
|
|
meta:set_string("infotext", S("%s Disabled"):format(machine_name))
|
|
|
|
end
|
2014-08-14 21:54:13 +02:00
|
|
|
meta:set_int("HV_EU_demand", 0)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
meta:set_int("HV_EU_demand", power_requirement)
|
|
|
|
if eu_input < power_requirement then
|
2014-07-11 11:00:46 +02:00
|
|
|
meta:set_string("infotext", S("%s Unpowered"):format(machine_name))
|
|
|
|
if node.name == "technic:forcefield_emitter_on" then
|
2014-08-14 21:50:40 +02:00
|
|
|
update_forcefield(pos, meta, false)
|
2014-07-11 11:00:46 +02:00
|
|
|
technic.swap_node(pos, "technic:forcefield_emitter_off")
|
|
|
|
end
|
|
|
|
elseif eu_input >= power_requirement then
|
|
|
|
if node.name == "technic:forcefield_emitter_off" then
|
|
|
|
technic.swap_node(pos, "technic:forcefield_emitter_on")
|
|
|
|
meta:set_string("infotext", S("%s Active"):format(machine_name))
|
|
|
|
end
|
2018-12-09 15:57:48 +01:00
|
|
|
update_forcefield(pos, meta, true)
|
2014-07-11 11:00:46 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-07-17 21:34:35 +02:00
|
|
|
minetest.register_node("technic:forcefield_emitter_off", {
|
Rationalise machine terminology
All electrically-powered machines now consistently indicate their
tier (supply voltage) in their names. As this implies that they are
electrically powered, the furnaces no longer have "Electric" in their
names. The fuel-fired equivalents of electric machines, which exist
for alloy furnace and furnace, now say "Fuel-Fired" to distinguish them.
(The fuel-fired alloy furnace used to say "Coal", which was inaccurate
because it uses any fuel. The fuel-fired furnace, from the default mod,
used to just be called "Furnace", which is ambiguous.)
Electric power generators now consistently indicate their tier and have
the word "Generator" in their names. This makes their purpose much
clearer, and makes obvious craft guide searches produce useful results.
The fuel-fired generators, previously just (ambiguously) called
"Generator", are now explicitly "Fuel-Fired".
2014-06-20 17:58:52 +02:00
|
|
|
description = S("%s Forcefield Emitter"):format("HV"),
|
2017-04-11 14:31:17 +02:00
|
|
|
tiles = {
|
|
|
|
"technic_forcefield_emitter_off.png",
|
|
|
|
"technic_machine_bottom.png"..cable_entry,
|
|
|
|
"technic_forcefield_emitter_off.png",
|
|
|
|
"technic_forcefield_emitter_off.png",
|
|
|
|
"technic_forcefield_emitter_off.png",
|
|
|
|
"technic_forcefield_emitter_off.png"
|
|
|
|
},
|
2016-03-20 02:34:56 +01:00
|
|
|
groups = {cracky = 1, technic_machine = 1, technic_hv = 1},
|
2013-07-17 21:34:35 +02:00
|
|
|
on_receive_fields = forcefield_receive_fields,
|
|
|
|
on_construct = function(pos)
|
|
|
|
local meta = minetest.get_meta(pos)
|
|
|
|
meta:set_int("HV_EU_input", 0)
|
|
|
|
meta:set_int("HV_EU_demand", 0)
|
|
|
|
meta:set_int("range", 10)
|
|
|
|
meta:set_int("enabled", 0)
|
2014-07-14 15:58:59 +02:00
|
|
|
meta:set_int("mesecon_mode", 0)
|
|
|
|
meta:set_int("mesecon_effect", 0)
|
2017-04-01 21:52:12 +02:00
|
|
|
if digilines_path then
|
|
|
|
meta:set_string("channel", "forcefield"..minetest.pos_to_string(pos))
|
|
|
|
end
|
Rationalise machine terminology
All electrically-powered machines now consistently indicate their
tier (supply voltage) in their names. As this implies that they are
electrically powered, the furnaces no longer have "Electric" in their
names. The fuel-fired equivalents of electric machines, which exist
for alloy furnace and furnace, now say "Fuel-Fired" to distinguish them.
(The fuel-fired alloy furnace used to say "Coal", which was inaccurate
because it uses any fuel. The fuel-fired furnace, from the default mod,
used to just be called "Furnace", which is ambiguous.)
Electric power generators now consistently indicate their tier and have
the word "Generator" in their names. This makes their purpose much
clearer, and makes obvious craft guide searches produce useful results.
The fuel-fired generators, previously just (ambiguously) called
"Generator", are now explicitly "Fuel-Fired".
2014-06-20 17:58:52 +02:00
|
|
|
meta:set_string("infotext", S("%s Forcefield Emitter"):format("HV"))
|
2014-07-03 00:59:53 +02:00
|
|
|
set_forcefield_formspec(meta)
|
2013-07-17 21:34:35 +02:00
|
|
|
end,
|
2014-07-11 11:00:46 +02:00
|
|
|
mesecons = mesecons,
|
2017-04-01 21:52:12 +02:00
|
|
|
digiline = digiline_def,
|
2014-07-11 11:00:46 +02:00
|
|
|
technic_run = run,
|
2013-07-17 21:34:35 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("technic:forcefield_emitter_on", {
|
Rationalise machine terminology
All electrically-powered machines now consistently indicate their
tier (supply voltage) in their names. As this implies that they are
electrically powered, the furnaces no longer have "Electric" in their
names. The fuel-fired equivalents of electric machines, which exist
for alloy furnace and furnace, now say "Fuel-Fired" to distinguish them.
(The fuel-fired alloy furnace used to say "Coal", which was inaccurate
because it uses any fuel. The fuel-fired furnace, from the default mod,
used to just be called "Furnace", which is ambiguous.)
Electric power generators now consistently indicate their tier and have
the word "Generator" in their names. This makes their purpose much
clearer, and makes obvious craft guide searches produce useful results.
The fuel-fired generators, previously just (ambiguously) called
"Generator", are now explicitly "Fuel-Fired".
2014-06-20 17:58:52 +02:00
|
|
|
description = S("%s Forcefield Emitter"):format("HV"),
|
2017-04-11 14:31:17 +02:00
|
|
|
tiles = {
|
|
|
|
"technic_forcefield_emitter_on.png",
|
|
|
|
"technic_machine_bottom.png"..cable_entry,
|
|
|
|
"technic_forcefield_emitter_on.png",
|
|
|
|
"technic_forcefield_emitter_on.png",
|
|
|
|
"technic_forcefield_emitter_on.png",
|
|
|
|
"technic_forcefield_emitter_on.png"
|
|
|
|
},
|
2016-03-20 02:34:56 +01:00
|
|
|
groups = {cracky = 1, technic_machine = 1, technic_hv = 1,
|
|
|
|
not_in_creative_inventory=1},
|
2013-07-17 21:34:35 +02:00
|
|
|
drop = "technic:forcefield_emitter_off",
|
|
|
|
on_receive_fields = forcefield_receive_fields,
|
|
|
|
on_destruct = function(pos)
|
|
|
|
local meta = minetest.get_meta(pos)
|
2014-08-14 21:50:40 +02:00
|
|
|
update_forcefield(pos, meta, false)
|
2013-07-17 21:34:35 +02:00
|
|
|
end,
|
2014-07-11 11:00:46 +02:00
|
|
|
mesecons = mesecons,
|
2017-04-01 21:52:12 +02:00
|
|
|
digiline = digiline_def,
|
2014-07-11 11:00:46 +02:00
|
|
|
technic_run = run,
|
2014-08-01 18:30:21 +02:00
|
|
|
technic_on_disable = function (pos, node)
|
|
|
|
local meta = minetest.get_meta(pos)
|
2014-08-14 21:50:40 +02:00
|
|
|
update_forcefield(pos, meta, false)
|
2014-08-01 18:30:21 +02:00
|
|
|
technic.swap_node(pos, "technic:forcefield_emitter_off")
|
|
|
|
end,
|
2017-06-05 16:56:03 +02:00
|
|
|
on_blast = function(pos, intensity)
|
|
|
|
minetest.dig_node(pos)
|
|
|
|
return {"technic:forcefield_emitter_off"}
|
|
|
|
end,
|
2013-07-17 21:34:35 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("technic:forcefield", {
|
Rationalise machine terminology
All electrically-powered machines now consistently indicate their
tier (supply voltage) in their names. As this implies that they are
electrically powered, the furnaces no longer have "Electric" in their
names. The fuel-fired equivalents of electric machines, which exist
for alloy furnace and furnace, now say "Fuel-Fired" to distinguish them.
(The fuel-fired alloy furnace used to say "Coal", which was inaccurate
because it uses any fuel. The fuel-fired furnace, from the default mod,
used to just be called "Furnace", which is ambiguous.)
Electric power generators now consistently indicate their tier and have
the word "Generator" in their names. This makes their purpose much
clearer, and makes obvious craft guide searches produce useful results.
The fuel-fired generators, previously just (ambiguously) called
"Generator", are now explicitly "Fuel-Fired".
2014-06-20 17:58:52 +02:00
|
|
|
description = S("%s Forcefield"):format("HV"),
|
2013-07-17 21:34:35 +02:00
|
|
|
sunlight_propagates = true,
|
|
|
|
drawtype = "glasslike",
|
2014-08-24 01:20:25 +02:00
|
|
|
groups = {not_in_creative_inventory=1},
|
2013-07-17 21:34:35 +02:00
|
|
|
paramtype = "light",
|
2017-06-05 16:56:03 +02:00
|
|
|
light_source = default.LIGHT_MAX,
|
2014-08-24 01:20:25 +02:00
|
|
|
diggable = false,
|
2013-07-17 21:34:35 +02:00
|
|
|
drop = '',
|
|
|
|
tiles = {{
|
|
|
|
name = "technic_forcefield_animated.png",
|
|
|
|
animation = {
|
|
|
|
type = "vertical_frames",
|
|
|
|
aspect_w = 16,
|
|
|
|
aspect_h = 16,
|
|
|
|
length = 1.0,
|
|
|
|
},
|
|
|
|
}},
|
2017-06-05 16:56:03 +02:00
|
|
|
on_blast = function(pos, intensity)
|
|
|
|
end,
|
2013-07-17 21:34:35 +02:00
|
|
|
})
|
2014-07-11 11:00:46 +02:00
|
|
|
|
2013-07-17 21:34:35 +02:00
|
|
|
|
|
|
|
if minetest.get_modpath("mesecons_mvps") then
|
2014-11-22 19:58:38 +01:00
|
|
|
mesecon.register_mvps_stopper("technic:forcefield")
|
2013-07-17 21:34:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
technic.register_machine("HV", "technic:forcefield_emitter_on", technic.receiver)
|
|
|
|
technic.register_machine("HV", "technic:forcefield_emitter_off", technic.receiver)
|
|
|
|
|