Skip to content

Commit

Permalink
MineClone/MineClonia compatibility for technic core (#328)
Browse files Browse the repository at this point in the history
Co-authored-by: SX <50966843+S-S-X@users.noreply.github.com>
Co-authored-by: Freeman <freeman@gnuhacker.org>
Co-authored-by: Buckaroo Banzai <39065740+BuckarooBanzay@users.noreply.github.com>
Co-authored-by: OgelGames <olliverdc28@gmail.com>
  • Loading branch information
5 people authored Jan 10, 2024
1 parent 7393d19 commit da0378a
Show file tree
Hide file tree
Showing 57 changed files with 831 additions and 368 deletions.
5 changes: 3 additions & 2 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ read_globals = {
"mesecon", "moretrees",
"unified_inventory", "protector",
"unifieddyes", "digiline_remote",
"drawers", "mg",
"drawers", "mg", "mcl_explosions",
"craftguide", "i3", "mtt",
"vizlib", "mcl_sounds", "mcl_vars",
"mcl_worlds", "exchangeclone",
"mcl_worlds", "mcl_buckets", "mcl_formspec",
"mcl_craftguide","exchangeclone",

-- Only used in technic/machines/MV/lighting.lua (disabled)
"isprotect", "homedecor_expect_infinite_stacks",
Expand Down
70 changes: 36 additions & 34 deletions technic/crafts.lua
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
-- check if we have the necessary dependencies to allow actually using these materials in the crafts
local mesecons_materials = minetest.get_modpath("mesecons_materials")

local mat = technic.materials
local has_mcl = minetest.get_modpath("mcl_core")

-- Remove some recipes
-- Bronze
minetest.clear_craft({
type = "shapeless",
output = "default:bronze_ingot"
})
-- Restore recipe for bronze block to ingots
minetest.register_craft({
output = "default:bronze_ingot 9",
recipe = {
{"default:bronzeblock"}
}
})
if not has_mcl then
minetest.clear_craft({
type = "shapeless",
output = "default:bronze_ingot"
})
-- Restore recipe for bronze block to ingots
minetest.register_craft({
output = "default:bronze_ingot 9",
recipe = {
{"default:bronzeblock"}
}
})
end

-- Accelerator tube
if pipeworks.enable_accelerator_tube then
Expand All @@ -38,9 +42,9 @@ if pipeworks.enable_teleport_tube then
minetest.register_craft({
output = 'pipeworks:teleport_tube_1',
recipe = {
{'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'},
{mat.mese_crystal, 'technic:copper_coil', mat.mese_crystal},
{'pipeworks:tube_1', 'technic:control_logic_unit', 'pipeworks:tube_1'},
{'default:mese_crystal', 'technic:copper_coil', 'default:mese_crystal'},
{mat.mese_crystal, 'technic:copper_coil', mat.mese_crystal},
}
})
end
Expand All @@ -62,36 +66,36 @@ minetest.register_craft( {
minetest.register_craft({
output = 'technic:diamond_drill_head',
recipe = {
{'technic:stainless_steel_ingot', 'default:diamond', 'technic:stainless_steel_ingot'},
{'default:diamond', '', 'default:diamond'},
{'technic:stainless_steel_ingot', 'default:diamond', 'technic:stainless_steel_ingot'},
{'technic:stainless_steel_ingot', mat.diamond, 'technic:stainless_steel_ingot'},
{mat.diamond, '', mat.diamond},
{'technic:stainless_steel_ingot', mat.diamond, 'technic:stainless_steel_ingot'},
}
})

minetest.register_craft({
output = 'technic:green_energy_crystal',
recipe = {
{'default:gold_ingot', 'technic:battery', 'dye:green'},
{mat.gold_ingot, 'technic:battery', mat.dye_green},
{'technic:battery', 'technic:red_energy_crystal', 'technic:battery'},
{'dye:green', 'technic:battery', 'default:gold_ingot'},
{mat.dye_green, 'technic:battery', mat.gold_ingot},
}
})

minetest.register_craft({
output = 'technic:blue_energy_crystal',
recipe = {
{'moreores:mithril_ingot', 'technic:battery', 'dye:blue'},
{mat.mithril_ingot, 'technic:battery', mat.dye_blue},
{'technic:battery', 'technic:green_energy_crystal', 'technic:battery'},
{'dye:blue', 'technic:battery', 'moreores:mithril_ingot'},
{mat.dye_blue, 'technic:battery', mat.mithril_ingot},
}
})

minetest.register_craft({
output = 'technic:red_energy_crystal',
recipe = {
{'moreores:silver_ingot', 'technic:battery', 'dye:red'},
{mat.silver_ingot, 'technic:battery', mat.dye_red},
{'technic:battery', 'basic_materials:energy_crystal_simple', 'technic:battery'},
{'dye:red', 'technic:battery', 'moreores:silver_ingot'},
{mat.dye_red, 'technic:battery', mat.silver_ingot},
}
})

Expand All @@ -110,12 +114,10 @@ minetest.register_craft({
},
})

local isolation = mesecons_materials and "mesecons_materials:fiber" or "technic:rubber"

minetest.register_craft({
output = 'technic:lv_transformer',
recipe = {
{isolation, 'technic:wrought_iron_ingot', isolation},
{mat.insulation, 'technic:wrought_iron_ingot', mat.insulation},
{'technic:copper_coil', 'technic:wrought_iron_ingot', 'technic:copper_coil'},
{'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot', 'technic:wrought_iron_ingot'},
}
Expand All @@ -124,7 +126,7 @@ minetest.register_craft({
minetest.register_craft({
output = 'technic:mv_transformer',
recipe = {
{isolation, 'technic:carbon_steel_ingot', isolation},
{mat.insulation, 'technic:carbon_steel_ingot', mat.insulation},
{'technic:copper_coil', 'technic:carbon_steel_ingot', 'technic:copper_coil'},
{'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot', 'technic:carbon_steel_ingot'},
}
Expand All @@ -133,7 +135,7 @@ minetest.register_craft({
minetest.register_craft({
output = 'technic:hv_transformer',
recipe = {
{isolation, 'technic:stainless_steel_ingot', isolation},
{mat.insulation, 'technic:stainless_steel_ingot', mat.insulation},
{'technic:copper_coil', 'technic:stainless_steel_ingot', 'technic:copper_coil'},
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
}
Expand All @@ -143,7 +145,7 @@ minetest.register_craft({
output = 'technic:control_logic_unit',
recipe = {
{'', 'basic_materials:gold_wire', ''},
{'default:copper_ingot', 'technic:silicon_wafer', 'default:copper_ingot'},
{mat.bronze_ingot, 'technic:silicon_wafer', mat.bronze_ingot},
{'', 'technic:chromium_ingot', ''},
},
replacements = { {"basic_materials:gold_wire", "basic_materials:empty_spool"}, },
Expand All @@ -153,8 +155,8 @@ minetest.register_craft({
output = 'technic:mixed_metal_ingot 9',
recipe = {
{'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot', 'technic:stainless_steel_ingot'},
{'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'},
{'default:tin_ingot', 'default:tin_ingot', 'default:tin_ingot'},
{mat.bronze_ingot, mat.bronze_ingot, mat.bronze_ingot},
{mat.tin_ingot, mat.tin_ingot, mat.tin_ingot},
}
})

Expand All @@ -176,13 +178,13 @@ minetest.register_craft({


minetest.register_craft({
output = "default:dirt 2",
output = mat.dirt.." 2",
type = "shapeless",
replacements = {{"bucket:bucket_water","bucket:bucket_empty"}},
replacements = {{mat.bucket_water,mat.bucket_empty}},
recipe = {
"technic:stone_dust",
"group:leaves",
"bucket:bucket_water",
mat.bucket_water,
"group:sand",
},
})
9 changes: 9 additions & 0 deletions technic/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ technic = rawget(_G, "technic") or {}
technic.plus = true
technic.version = 1.2

if minetest.get_modpath("mcl_sounds") then
technic.sounds = mcl_sounds
else
technic.sounds = assert(default, "No suitable mod found for sounds")
end

technic.creative_mode = minetest.settings:get_bool("creative_mode")

local modpath = minetest.get_modpath("technic")
Expand All @@ -12,6 +18,9 @@ technic.modpath = modpath
local S = minetest.get_translator("technic")
technic.getter = S

-- Read materials file
dofile(modpath.."/materials.lua")

-- Read configuration file
dofile(modpath.."/config.lua")

Expand Down
14 changes: 10 additions & 4 deletions technic/items.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

local S = technic.getter

local has_mcl = minetest.get_modpath("mcl_core")

minetest.register_craftitem("technic:silicon_wafer", {
description = S("Silicon Wafer"),
inventory_image = "technic_silicon_wafer.png",
Expand Down Expand Up @@ -108,12 +110,14 @@ minetest.register_craftitem("technic:carbon_cloth", {

minetest.register_node("technic:machine_casing", {
description = S("Machine Casing"),
groups = {cracky=2},
groups = {cracky=2, pickaxey=2},
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
sunlight_propagates = true,
paramtype = "light",
drawtype = "allfaces",
tiles = {"technic_machine_casing.png"},
sounds = default.node_sound_stone_defaults(),
sounds = technic.sounds.node_sound_stone_defaults(),
})

for p = 0, 35 do
Expand Down Expand Up @@ -164,8 +168,10 @@ for p = 0, 35 do
tiles = {"technic_uranium_block.png"},
is_ground_content = true,
groups = {uranium_block=1, not_in_creative_inventory=nici,
cracky=1, level=2, radioactive=radioactivity},
sounds = default.node_sound_stone_defaults(),
cracky=1, level=has_mcl and 0 or 2, radioactive=radioactivity, pickaxey=4},
_mcl_blast_resistance = 1,
_mcl_hardness = 1,
sounds = technic.sounds.node_sound_stone_defaults(),
});
if not ov then
minetest.register_craft({
Expand Down
16 changes: 11 additions & 5 deletions technic/machines/HV/forcefield.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ local S = technic.getter

local cable_entry = "^technic_cable_connection_overlay.png"

local mat = technic.materials

minetest.register_craft({
output = "technic:forcefield_emitter_off",
recipe = {
{"default:mese", "basic_materials:motor", "default:mese" },
{mat.mese, "basic_materials:motor", mat.mese },
{"technic:deployer_off", "technic:machine_casing", "technic:deployer_off"},
{"default:mese", "technic:hv_cable", "default:mese" },
{mat.mese, "technic:hv_cable", mat.mese },
}
})

Expand Down Expand Up @@ -307,7 +309,9 @@ minetest.register_node("technic:forcefield_emitter_off", {
"technic_forcefield_emitter_off.png",
"technic_forcefield_emitter_off.png"
},
groups = {cracky = 1, technic_machine = 1, technic_hv = 1},
groups = {cracky = 1, technic_machine = 1, technic_hv = 1, pickaxey = 3},
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
on_receive_fields = forcefield_receive_fields,
on_construct = function(pos)
local meta = minetest.get_meta(pos)
Expand Down Expand Up @@ -339,7 +343,9 @@ minetest.register_node("technic:forcefield_emitter_on", {
"technic_forcefield_emitter_on.png"
},
groups = {cracky = 1, technic_machine = 1, technic_hv = 1,
not_in_creative_inventory=1},
not_in_creative_inventory=1, pickaxey = 3},
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
drop = "technic:forcefield_emitter_off",
on_receive_fields = forcefield_receive_fields,
on_destruct = function(pos)
Expand All @@ -366,7 +372,7 @@ minetest.register_node("technic:forcefield", {
drawtype = "glasslike",
groups = {not_in_creative_inventory=1},
paramtype = "light",
light_source = default.LIGHT_MAX,
light_source = minetest.LIGHT_MAX,
diggable = false,
drop = '',
tiles = {{
Expand Down
60 changes: 46 additions & 14 deletions technic/machines/HV/nuclear_reactor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ local power_supply = 100000 -- EUs
local fuel_type = "technic:uranium_fuel" -- The reactor burns this
local digiline_meltdown = technic.config:get_bool("enable_nuclear_reactor_digiline_selfdestruct")
local has_digilines = minetest.get_modpath("digilines")
local has_mcl = minetest.get_modpath("mcl_core")
local mat = technic.materials

local S = technic.getter

Expand All @@ -24,20 +26,34 @@ local cable_entry = "^technic_cable_connection_overlay.png"
minetest.register_craft({
output = 'technic:hv_nuclear_reactor_core',
recipe = {
{'technic:carbon_plate', 'default:obsidian_glass', 'technic:carbon_plate'},
{'technic:carbon_plate', mat.obsidian_glass, 'technic:carbon_plate'},
{'technic:composite_plate', 'technic:machine_casing', 'technic:composite_plate'},
{'technic:stainless_steel_ingot', 'technic:hv_cable', 'technic:stainless_steel_ingot'},
}
})

local size = minetest.get_modpath("mcl_formspec") and "size[9,9]" or "size[8,9]"
local function make_reactor_formspec(meta)
local f = "size[8,9]"..
"label[0,0;"..S("Nuclear Reactor Rod Compartment").."]"..
"list[context;src;2,1;3,2;]"..
"list[current_player;main;0,5;8,4;]"..
"listring[]"..
"button[5.5,1.5;2,1;start;"..S("Start").."]"..
"checkbox[5.5,2.5;autostart;"..S("Automatic Start")..";"..meta:get_string("autostart").."]"
local f = size..
"label[0,0;"..S("Nuclear Reactor Rod Compartment").."]"..
"list[context;src;2,1;3,2;]"..
"listring[context;src]"..
"button[5.5,1.5;2,1;start;"..S("Start").."]"..
"checkbox[5.5,2.5;autostart;"..S("Automatic Start")..";"..meta:get_string("autostart").."]"
if has_mcl then
f = f..
mcl_formspec.get_itemslot_bg(2,1,3,2)..
-- player inventory
"list[current_player;main;0,4.5;9,3;9]"..
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
"list[current_player;main;0,7.74;9,1;]"..
mcl_formspec.get_itemslot_bg(0,7.74,9,1)..
"listring[current_player;main]"
else
f = f..
"list[current_player;main;0,5;8,4;]"..
"listring[current_player;main]"
end
if not has_digilines then
return f
end
Expand Down Expand Up @@ -149,8 +165,8 @@ local function reactor_structure_badness(pos)
local c_blast_concrete = minetest.get_content_id("technic:blast_resistant_concrete")
local c_lead = minetest.get_content_id("technic:lead_block")
local c_steel = minetest.get_content_id("technic:stainless_steel_block")
local c_water_source = minetest.get_content_id("default:water_source")
local c_water_flowing = minetest.get_content_id("default:water_flowing")
local c_water_source = minetest.get_content_id(mat.water_source)
local c_water_flowing = minetest.get_content_id(mat.water_flowing)

local blast_layer, steel_layer, lead_layer, water_layer = 0, 0, 0, 0

Expand Down Expand Up @@ -209,9 +225,21 @@ local function reactor_structure_badness(pos)
return (25 - water_layer) + (96 - lead_layer) + (216 - blast_layer)
end

local mcl_expl_info = {
drop_chance = 1.0,
max_blast_resistance = 10,
sound = true,
particles = true,
fire = true,
griefing = true,
grief_protected = true,
}

local function melt_down_reactor(pos)
minetest.log("action", "A reactor melted down at "..minetest.pos_to_string(pos))
if minetest.get_modpath("mcl_explosions") then
mcl_explosions.explode(pos, 30, mcl_expl_info)
end
minetest.set_node(pos, {name = "technic:corium_source"})
end

Expand Down Expand Up @@ -417,9 +445,11 @@ minetest.register_node("technic:hv_nuclear_reactor_core", {
},
drawtype = "mesh",
mesh = "technic_reactor.obj",
groups = {cracky = 1, technic_machine = 1, technic_hv = 1},
groups = {cracky = 1, technic_machine = 1, technic_hv = 1, pickaxey = 3},
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
sounds = technic.sounds.node_sound_wood_defaults(),
paramtype = "light",
paramtype2 = "facedir",
stack_max = 1,
Expand Down Expand Up @@ -460,9 +490,11 @@ minetest.register_node("technic:hv_nuclear_reactor_core_active", {
drawtype = "mesh",
mesh = "technic_reactor.obj",
groups = {cracky = 1, technic_machine = 1, technic_hv = 1, radioactive = 4,
not_in_creative_inventory = 1},
not_in_creative_inventory = 1, pickaxey = 3},
_mcl_blast_resistance = 1,
_mcl_hardness = 0.8,
legacy_facedir_simple = true,
sounds = default.node_sound_wood_defaults(),
sounds = technic.sounds.node_sound_wood_defaults(),
drop = "technic:hv_nuclear_reactor_core",
light_source = 14,
paramtype = "light",
Expand Down
Loading

0 comments on commit da0378a

Please sign in to comment.