summaryrefslogtreecommitdiff
path: root/technic
diff options
context:
space:
mode:
Diffstat (limited to 'technic')
-rw-r--r--technic/config.lua1
-rw-r--r--technic/crafts.lua2
-rw-r--r--technic/machines/creative.lua40
-rw-r--r--technic/machines/init.lua5
-rw-r--r--technic/machines/power_monitor.lua6
-rw-r--r--technic/machines/register/alloy_recipes.lua2
-rw-r--r--technic/machines/register/battery_box.lua2
-rw-r--r--technic/machines/register/grinder_recipes.lua6
-rw-r--r--technic/machines/switching_station.lua7
-rw-r--r--technic/radiation.lua4
-rw-r--r--technic/tools/mining_drill.lua2
-rw-r--r--technic/tools/mining_lasers.lua84
12 files changed, 115 insertions, 46 deletions
diff --git a/technic/config.lua b/technic/config.lua
index bb748ec..ab834f9 100644
--- a/technic/config.lua
+++ b/technic/config.lua
@@ -13,6 +13,7 @@ local defaults = {
enable_entity_radiation_damage = "true",
enable_longterm_radiation_damage = "true",
enable_nuclear_reactor_digiline_selfdestruct = "false",
+ enable_creative_mode = "false",
}
for k, v in pairs(defaults) do
diff --git a/technic/crafts.lua b/technic/crafts.lua
index 14bafd3..5d3ae04 100644
--- a/technic/crafts.lua
+++ b/technic/crafts.lua
@@ -164,7 +164,7 @@ minetest.register_craft({
recipe = {
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
{'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'},
- {'moreores:tin_ingot', 'moreores:tin_ingot', 'moreores:tin_ingot'},
+ {'default:tin_ingot', 'default:tin_ingot', 'default:tin_ingot'},
}
})
diff --git a/technic/machines/creative.lua b/technic/machines/creative.lua
new file mode 100644
index 0000000..7c09a80
--- /dev/null
+++ b/technic/machines/creative.lua
@@ -0,0 +1,40 @@
+local S = technic.getter
+
+minetest.register_abm({
+ nodenames = {"group:technic_lv","group:technic_mv","group:technic_hv"},
+ label = "Run Machines",
+ interval = 1,
+ chance = 1,
+ action = function(pos,node)
+ local meta = minetest.get_meta(pos)
+ local pos1 = {x=pos.x,y=pos.y-1,z=pos.z}
+ local tier = technic.get_cable_tier(minetest.get_node(pos1).name)
+ local meta = minetest.get_meta(pos)
+ if not tier then
+ meta:set_int("active",0)
+ return
+ end
+ meta:set_int("active",1)
+ meta:set_int("LV_EU_input",meta:get_int("LV_EU_demand"))
+ meta:set_int("MV_EU_input",meta:get_int("MV_EU_demand"))
+ meta:set_int("HV_EU_input",meta:get_int("HV_EU_demand"))
+ local nodedef = minetest.registered_nodes[node.name]
+ if nodedef and nodedef.technic_run then
+ nodedef.technic_run(pos,node)
+ end
+ end,
+})
+
+minetest.register_lbm({
+ nodenames = {"technic:switching_station","technic:power_monitor"},
+ name = "technic:update_infotext",
+ label = "Update switching station / power monitor infotext",
+ action = function(pos,node)
+ local meta = minetest.get_meta(pos)
+ if node.name == "technic:switching_station" then
+ meta:set_string("infotext",S("Switching Station"))
+ elseif node.name == "technic:power_monitor" then
+ meta:set_string("infotext",S("Power Monitor"))
+ end
+ end,
+})
diff --git a/technic/machines/init.lua b/technic/machines/init.lua
index f2e31c9..b8d36c1 100644
--- a/technic/machines/init.lua
+++ b/technic/machines/init.lua
@@ -13,3 +13,8 @@ dofile(path.."/supply_converter.lua")
dofile(path.."/other/init.lua")
+if technic.config:get_bool("enable_creative_mode") then
+ --The switching station does not handle running machines
+ --in this mode, so alternative means are used to do so.
+ dofile(path.."/creative.lua")
+end
diff --git a/technic/machines/power_monitor.lua b/technic/machines/power_monitor.lua
index 7e8b850..25836d6 100644
--- a/technic/machines/power_monitor.lua
+++ b/technic/machines/power_monitor.lua
@@ -35,6 +35,12 @@ minetest.register_node("technic:power_monitor",{
end,
})
+if technic.config:get_bool("enable_creative_mode") then
+ --Power distribution is not used in this mode,
+ --so the power monitor is inert and never needs to run.
+ return
+end
+
minetest.register_abm({
nodenames = {"technic:power_monitor"},
label = "Machines: run power monitor",
diff --git a/technic/machines/register/alloy_recipes.lua b/technic/machines/register/alloy_recipes.lua
index bd09bd6..3aeacd5 100644
--- a/technic/machines/register/alloy_recipes.lua
+++ b/technic/machines/register/alloy_recipes.lua
@@ -13,7 +13,7 @@ end
local recipes = {
{"technic:copper_dust 3", "technic:tin_dust", "technic:bronze_dust 4"},
- {"default:copper_ingot 3", "moreores:tin_ingot", "default:bronze_ingot 4"},
+ {"default:copper_ingot 3", "default:tin_ingot", "default:bronze_ingot 4"},
{"technic:wrought_iron_dust", "technic:coal_dust", "technic:carbon_steel_dust", 3},
{"technic:wrought_iron_ingot", "technic:coal_dust", "technic:carbon_steel_ingot", 3},
{"technic:carbon_steel_dust", "technic:coal_dust", "technic:cast_iron_dust", 3},
diff --git a/technic/machines/register/battery_box.lua b/technic/machines/register/battery_box.lua
index 7f25dfd..d10b705 100644
--- a/technic/machines/register/battery_box.lua
+++ b/technic/machines/register/battery_box.lua
@@ -18,7 +18,7 @@ minetest.register_craft({
output = "technic:battery",
recipe = {
{"group:wood", "default:copper_ingot", "group:wood"},
- {"group:wood", "moreores:tin_ingot", "group:wood"},
+ {"group:wood", "default:tin_ingot", "group:wood"},
{"group:wood", "default:copper_ingot", "group:wood"},
}
})
diff --git a/technic/machines/register/grinder_recipes.lua b/technic/machines/register/grinder_recipes.lua
index fa55e7a..1f4047c 100644
--- a/technic/machines/register/grinder_recipes.lua
+++ b/technic/machines/register/grinder_recipes.lua
@@ -15,6 +15,7 @@ local recipes = {
{"default:desert_stone", "default:desert_sand"},
{"default:gold_lump", "technic:gold_dust 2"},
{"default:iron_lump", "technic:wrought_iron_dust 2"},
+ {"default:tin_lump", "technic:tin_dust 2"},
{"technic:chromium_lump", "technic:chromium_dust 2"},
{"technic:uranium_lump", "technic:uranium_dust 2"},
{"technic:zinc_lump", "technic:zinc_dust 2"},
@@ -43,7 +44,6 @@ end
if minetest.get_modpath("moreores") then
table.insert(recipes, {"moreores:mithril_lump", "technic:mithril_dust 2"})
table.insert(recipes, {"moreores:silver_lump", "technic:silver_dust 2"})
- table.insert(recipes, {"moreores:tin_lump", "technic:tin_dust 2"})
end
if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then
@@ -94,9 +94,9 @@ register_dust("Gold", "default:gold_ingot")
register_dust("Mithril", "moreores:mithril_ingot")
register_dust("Silver", "moreores:silver_ingot")
register_dust("Stainless Steel", "technic:stainless_steel_ingot")
-register_dust("Stone", "default:stone")
+register_dust("Stone", "default:stone")
register_dust("Sulfur", nil)
-register_dust("Tin", "moreores:tin_ingot")
+register_dust("Tin", "default:tin_ingot")
register_dust("Wrought Iron", "technic:wrought_iron_ingot")
register_dust("Zinc", "technic:zinc_ingot")
if minetest.get_modpath("gloopores") or minetest.get_modpath("glooptest") then
diff --git a/technic/machines/switching_station.lua b/technic/machines/switching_station.lua
index d645847..2d96b9b 100644
--- a/technic/machines/switching_station.lua
+++ b/technic/machines/switching_station.lua
@@ -88,6 +88,13 @@ minetest.register_node("technic:switching_station",{
},
})
+if technic.config:get_bool("enable_creative_mode") then
+ --Power distribution is not used in this mode,
+ --so the switching station is inert and none of the
+ --network processing is needed.
+ return
+end
+
--------------------------------------------------
-- Functions to traverse the electrical network
--------------------------------------------------
diff --git a/technic/radiation.lua b/technic/radiation.lua
index 722b0ac..a4c49c6 100644
--- a/technic/radiation.lua
+++ b/technic/radiation.lua
@@ -54,6 +54,7 @@ local rad_resistance_node = {
["default:lava_source"] = 17,
["default:mese"] = 21,
["default:mossycobble"] = 15,
+ ["default:tinblock"] = 37,
["pbj_pup:pbj_pup"] = 10000,
["pbj_pup:pbj_pup_candies"] = 10000,
["gloopblocks:rainbow_block_diagonal"] = 5000,
@@ -76,6 +77,7 @@ local rad_resistance_node = {
["default:stone_with_gold"] = 34,
["default:stone_with_iron"] = 20,
["default:stone_with_mese"] = 17,
+ ["default:stone_with_tin"] = 19,
["default:stonebrick"] = 17,
["default:water_flowing"] = 2.8,
["default:water_source"] = 5.6,
@@ -141,10 +143,8 @@ local rad_resistance_node = {
["moreblocks:wood_tile_up"] = 1.7,
["moreores:mineral_mithril"] = 18,
["moreores:mineral_silver"] = 21,
- ["moreores:mineral_tin"] = 19,
["moreores:mithril_block"] = 26,
["moreores:silver_block"] = 53,
- ["moreores:tin_block"] = 37,
["snow:snow_brick"] = 2.8,
["technic:brass_block"] = 43,
["technic:carbon_steel_block"] = 40,
diff --git a/technic/tools/mining_drill.lua b/technic/tools/mining_drill.lua
index bc426e7..1cf7491 100644
--- a/technic/tools/mining_drill.lua
+++ b/technic/tools/mining_drill.lua
@@ -6,7 +6,7 @@ local S = technic.getter
minetest.register_craft({
output = 'technic:mining_drill',
recipe = {
- {'moreores:tin_ingot', 'technic:diamond_drill_head', 'moreores:tin_ingot'},
+ {'default:tin_ingot', 'technic:diamond_drill_head', 'default:tin_ingot'},
{'technic:stainless_steel_ingot', 'technic:motor', 'technic:stainless_steel_ingot'},
{'', 'technic:red_energy_crystal', 'default:copper_ingot'},
}
diff --git a/technic/tools/mining_lasers.lua b/technic/tools/mining_lasers.lua
index ef1eecb..6015e5a 100644
--- a/technic/tools/mining_lasers.lua
+++ b/technic/tools/mining_lasers.lua
@@ -4,43 +4,43 @@ local mining_lasers_list = {
{"2", 14, 200000, 2000},
{"3", 21, 650000, 3000},
}
+local allow_entire_discharging = true
local S = technic.getter
minetest.register_craft({
- output = 'technic:laser_mk1',
+ output = "technic:laser_mk1",
recipe = {
- {'default:diamond', 'technic:brass_ingot', 'default:obsidian_glass'},
- {'', 'technic:brass_ingot', 'technic:red_energy_crystal'},
- {'', '', 'default:copper_ingot'},
+ {"default:diamond", "technic:brass_ingot", "default:obsidian_glass"},
+ {"", "technic:brass_ingot", "technic:red_energy_crystal"},
+ {"", "", "default:copper_ingot"},
}
})
minetest.register_craft({
- output = 'technic:laser_mk2',
+ output = "technic:laser_mk2",
recipe = {
- {'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk1'},
- {'', 'technic:carbon_steel_ingot', 'technic:green_energy_crystal'},
- {'', '', 'default:copper_ingot'},
+ {"default:diamond", "technic:carbon_steel_ingot", "technic:laser_mk1"},
+ {"", "technic:carbon_steel_ingot", "technic:green_energy_crystal"},
+ {"", "", "default:copper_ingot"},
}
})
minetest.register_craft({
- output = 'technic:laser_mk3',
+ output = "technic:laser_mk3",
recipe = {
- {'default:diamond', 'technic:carbon_steel_ingot', 'technic:laser_mk2'},
- {'', 'technic:carbon_steel_ingot', 'technic:blue_energy_crystal'},
- {'', '', 'default:copper_ingot'},
+ {"default:diamond", "technic:carbon_steel_ingot", "technic:laser_mk2"},
+ {"", "technic:carbon_steel_ingot", "technic:blue_energy_crystal"},
+ {"", "", "default:copper_ingot"},
}
})
local function laser_node(pos, node, player)
local def = minetest.registered_nodes[node.name]
- if def and def.liquidtype ~= "none" then
+ if def.liquidtype ~= "none" and def.buildable_to then
minetest.remove_node(pos)
minetest.add_particle({
pos = pos,
- velocity = {x=0, y=2, z=0},
- acceleration = {x=0, y=-1, z=0},
- expirationtime = 1.5,
+ velocity = {x = 0, y = 1.5 + math.random(), z = 0},
+ acceleration = {x = 0, y = -1, z = 0},
size = 6 + math.random() * 2,
texture = "smoke_puff.png^[transform" .. math.random(0, 7),
})
@@ -49,11 +49,15 @@ local function laser_node(pos, node, player)
minetest.node_dig(pos, node, player)
end
-local no_destroy = {
- ["air"] = true,
- ["default:lava_source"] = true,
- ["default:lava_flowing"] = true,
-}
+local keep_node = {air = true}
+local function can_keep_node(name)
+ if keep_node[name] ~= nil then
+ return keep_node[name]
+ end
+ keep_node[name] = minetest.get_item_group(name, "hot") ~= 0
+ return keep_node[name]
+end
+
local function laser_shoot(player, range, particle_texture, sound)
local player_pos = player:getpos()
local player_name = player:get_player_name()
@@ -61,12 +65,12 @@ local function laser_shoot(player, range, particle_texture, sound)
local start_pos = vector.new(player_pos)
-- Adjust to head height
- start_pos.y = start_pos.y + 1.6
+ start_pos.y = start_pos.y + (player:get_properties().eye_height or 1.625)
minetest.add_particle({
- pos = startpos,
+ pos = start_pos,
velocity = dir,
acceleration = vector.multiply(dir, 50),
- expirationtime = range / 11,
+ expirationtime = (math.sqrt(1 + 100 * (range + 0.4)) - 1) / 50,
size = 1,
texture = particle_texture .. "^[transform" .. math.random(0, 7),
})
@@ -76,42 +80,48 @@ local function laser_shoot(player, range, particle_texture, sound)
minetest.record_protection_violation(pos, player_name)
break
end
- local node = minetest.get_node_or_nil(pos)
- if not node then
+ local node = minetest.get_node(pos)
+ if node.name == "ignore"
+ or not minetest.registered_nodes[node.name] then
break
end
- if not no_destroy[node.name] then
+ if not can_keep_node(node.name) then
laser_node(pos, node, player)
end
end
end
-
for _, m in pairs(mining_lasers_list) do
technic.register_power_tool("technic:laser_mk"..m[1], m[3])
minetest.register_tool("technic:laser_mk"..m[1], {
description = S("Mining Laser Mk%d"):format(m[1]),
inventory_image = "technic_mining_laser_mk"..m[1]..".png",
+ range = 0,
stack_max = 1,
wear_represents = "technic_RE_charge",
on_refill = technic.refill_RE_charge,
on_use = function(itemstack, user)
local meta = minetest.deserialize(itemstack:get_metadata())
- if not meta or not meta.charge then
+ if not meta or not meta.charge or meta.charge == 0 then
return
end
- -- If there's enough charge left, fire the laser
- if meta.charge >= m[4] then
- laser_shoot(user, m[2], "technic_laser_beam_mk"..m[1]..".png", "technic_laser_mk"..m[1])
- if not technic.creative_mode then
- meta.charge = meta.charge - m[4]
- technic.set_RE_wear(itemstack, meta.charge, m[3])
- itemstack:set_metadata(minetest.serialize(meta))
+ local range = m[2]
+ if meta.charge < m[4] then
+ if not allow_entire_discharging then
+ return
end
+ -- If charge is too low, give the laser a shorter range
+ range = range * meta.charge / m[4]
+ end
+ laser_shoot(user, range, "technic_laser_beam_mk" .. m[1] .. ".png",
+ "technic_laser_mk" .. m[1])
+ if not technic.creative_mode then
+ meta.charge = math.max(meta.charge - m[4], 0)
+ technic.set_RE_wear(itemstack, meta.charge, m[3])
+ itemstack:set_metadata(minetest.serialize(meta))
end
return itemstack
end,
})
end
-