Better Hades Revisited support (#30)

* Fix spaces vs tabs in crafts.lua

* Fix recipes, add telepoter device for teleporter tube recipe.

* Override chests and furnaces in Hades as well.
This commit is contained in:
sfence 2022-05-13 04:52:17 +02:00 committed by GitHub
parent 55ded7e569
commit 4fce320d9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 215 additions and 134 deletions

View File

@ -11,33 +11,72 @@ local tube_entry = "^pipeworks_tube_connection_wooden.png"
-- Chest Locals
local open_chests = {}
local function get_chest_formspec(pos)
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
local formspec =
"size[8,9]" ..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
"list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" ..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"listring[nodemeta:" .. spos .. ";main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85)
local get_chest_formspec
-- Pipeworks Switch
formspec = formspec ..
fs_helpers.cycling_button(
minetest.get_meta(pos),
pipeworks.button_base,
"splitstacks",
{
pipeworks.button_off,
pipeworks.button_on
}
)..pipeworks.button_label
if minetest.get_modpath("default") then
function get_chest_formspec(pos)
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
local formspec =
"size[8,9]" ..
default.gui_bg ..
default.gui_bg_img ..
default.gui_slots ..
"list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" ..
"list[current_player;main;0,4.85;8,1;]" ..
"list[current_player;main;0,6.08;8,3;8]" ..
"listring[nodemeta:" .. spos .. ";main]" ..
"listring[current_player;main]" ..
default.get_hotbar_bg(0,4.85)
return formspec
-- Pipeworks Switch
formspec = formspec ..
fs_helpers.cycling_button(
minetest.get_meta(pos),
pipeworks.button_base,
"splitstacks",
{
pipeworks.button_off,
pipeworks.button_on
}
)..pipeworks.button_label
return formspec
end
else
local function get_hotbar_bg(x,y)
local out = ""
for i=0,7,1 do
out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]"
end
return out
end
function get_chest_formspec(pos)
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
local formspec =
"size[10,9]" ..
"background9[8,8;8,9;hades_chests_chestui.png;true;8]"..
"list[nodemeta:" .. spos .. ";main;0,0.3;10,4;]" ..
"list[current_player;main;0,4.85;10,1;]" ..
"list[current_player;main;0,6.08;10,3;10]" ..
"listring[nodemeta:" .. spos .. ";main]" ..
"listring[current_player;main]" ..
get_hotbar_bg(0,4.85)
-- Pipeworks Switch
formspec = formspec ..
fs_helpers.cycling_button(
minetest.get_meta(pos),
pipeworks.button_base,
"splitstacks",
{
pipeworks.button_off,
pipeworks.button_on
}
)..pipeworks.button_label
return formspec
end
end
local function chest_lid_obstructed(pos)
@ -71,7 +110,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end
minetest.after(0.2, function()
minetest.swap_node(pos, { name = "default:" .. swap, param2 = node.param2 })
if minetest.get_modpath("default") then
minetest.swap_node(pos, { name = "default:" .. swap, param2 = node.param2 })
end
-- Pipeworks notification
pipeworks.after_place(pos)
@ -88,10 +129,18 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end)
-- Original Definitions
local old_chest_def = table.copy(minetest.registered_items["default:chest"])
local old_chest_open_def = table.copy(minetest.registered_items["default:chest_open"])
local old_chest_locked_def = table.copy(minetest.registered_items["default:chest_locked"])
local old_chest_locked_open_def = table.copy(minetest.registered_items["default:chest_locked_open"])
local old_chest_def, old_chest_open_def, old_chest_locked_def, old_chest_locked_open_def
if minetest.get_modpath("default") then
old_chest_def = table.copy(minetest.registered_items["default:chest"])
old_chest_open_def = table.copy(minetest.registered_items["default:chest_open"])
old_chest_locked_def = table.copy(minetest.registered_items["default:chest_locked"])
old_chest_locked_open_def = table.copy(minetest.registered_items["default:chest_locked_open"])
elseif minetest.get_modpath("hades_chests") then
old_chest_def = table.copy(minetest.registered_items["hades_chests:chest"])
old_chest_open_def = table.copy(minetest.registered_items["hades_chests:chest"])
old_chest_locked_def = table.copy(minetest.registered_items["hades_chests:chest_locked"])
old_chest_locked_open_def = table.copy(minetest.registered_items["hades_chests:chest_locked"])
end
-- Override Construction
local override_protected, override, override_open, override_protected_open
@ -116,9 +165,11 @@ override_protected = {
minetest.sound_play(old_chest_locked_def.sound_open, {gain = 0.3,
pos = pos, max_hear_distance = 10})
if not chest_lid_obstructed(pos) then
minetest.swap_node(pos,
{ name = "default:" .. "chest_locked" .. "_open",
param2 = node.param2 })
if minetest.get_modpath("default") then
minetest.swap_node(pos,
{ name = "default:" .. "chest_locked" .. "_open",
param2 = node.param2 })
end
end
minetest.after(0.2, minetest.show_formspec,
clicker:get_player_name(),
@ -160,9 +211,11 @@ override = {
minetest.sound_play(old_chest_def.sound_open, {gain = 0.3, pos = pos,
max_hear_distance = 10})
if not chest_lid_obstructed(pos) then
minetest.swap_node(pos, {
name = "default:" .. "chest" .. "_open",
param2 = node.param2 })
if minetest.get_modpath("default") then
minetest.swap_node(pos, {
name = "default:" .. "chest" .. "_open",
param2 = node.param2 })
end
end
minetest.after(0.2, minetest.show_formspec,
clicker:get_player_name(),
@ -236,8 +289,15 @@ for _,v in ipairs({override_protected, override, override_open, override_protect
end
-- Override with the new modifications.
minetest.override_item("default:chest", override)
minetest.override_item("default:chest_open", override_open)
minetest.override_item("default:chest_locked", override_protected)
minetest.override_item("default:chest_locked_open", override_protected_open)
if minetest.get_modpath("default") then
minetest.override_item("default:chest", override)
minetest.override_item("default:chest_open", override_open)
minetest.override_item("default:chest_locked", override_protected)
minetest.override_item("default:chest_locked_open", override_protected_open)
elseif minetest.get_modpath("hades_chests") then
minetest.override_item("hades_chests:chest", override)
--minetest.override_item("hades_chests:chest_open", override_open)
minetest.override_item("hades_chests:chest_locked", override_protected)
--minetest.override_item("hades_chests:chest_locked_open", override_protected_open)
end

View File

@ -1,8 +1,14 @@
-- this file is basically a modified copy of
-- minetest_game/mods/default/furnaces.lua
local def = table.copy(minetest.registered_nodes["default:furnace"])
--local def_active = table.copy(minetest.registered_nodes["default:furnace_active"])
local def--, def_active
if minetest.get_modpath("default") then
def = table.copy(minetest.registered_nodes["default:furnace"])
--def_active = table.copy(minetest.registered_nodes["default:furnace_active"])
elseif minetest.get_modpath("hades_furnaces") then
def = table.copy(minetest.registered_nodes["hades_furnaces:furnace"])
--def_active = table.copy(minetest.registered_nodes["hades_furnaces:furnace_active"])
end
local tube_entry = "^pipeworks_tube_connection_stony.png"
@ -16,7 +22,7 @@ groups_active["not_in_creative_inventory"] = 1
-- Node definitions
--
minetest.override_item("default:furnace", {
local override = {
tiles = {
"default_furnace_top.png"..tube_entry,
"default_furnace_bottom.png"..tube_entry,
@ -59,9 +65,9 @@ minetest.override_item("default:furnace", {
after_place_node = pipeworks.after_place,
after_dig_node = pipeworks.after_dig,
on_rotate = pipeworks.on_rotate
})
}
minetest.override_item("default:furnace_active", {
local override_active = {
tiles = {
"default_furnace_top.png"..tube_entry,
"default_furnace_bottom.png"..tube_entry,
@ -110,5 +116,13 @@ minetest.override_item("default:furnace_active", {
after_place_node = pipeworks.after_place,
after_dig_node = pipeworks.after_dig,
on_rotate = pipeworks.on_rotate
})
}
if minetest.get_modpath("default") then
minetest.override_item("default:furnace", override)
minetest.override_item("default:furnace_active", override_active)
elseif minetest.get_modpath("hades_furnaces") then
minetest.override_item("hades_furnaces:furnace", override)
minetest.override_item("hades_furnaces:furnace_active", override_active)
end

View File

@ -6,10 +6,11 @@ local materials = {
copper_ingot = "default:copper_ingot",
steel_ingot = "default:steel_ingot",
gold_ingot = "default:gold_ingot",
mese = "default:mese",
mese_crystal = "default:mese_crystal",
mese = "default:mese",
mese_crystal = "default:mese_crystal",
mese_crystal_fragment = "default:mese_crystal_fragment",
glass = "default:glass",
teleporter = "default:mese",
glass = "default:glass",
}
if minetest.get_modpath("mcl_core") then
@ -20,12 +21,13 @@ if minetest.get_modpath("mcl_core") then
chest = "mcl_chests:chest_small",
steel_ingot = "mcl_core:iron_ingot",
gold_ingot = "mcl_core:gold_ingot",
mese = "default:mese",
mese_crystal = "default:mese_crystal",
mese = "default:mese",
mese_crystal = "default:mese_crystal",
mese_crystal_fragment = "mesecons:redstone",
teleporter = "default:mese",
-- Use iron where no equivalent
copper_ingot = "mcl_core:iron_ingot",
glass = "default:glass",
glass = "default:glass",
}
elseif minetest.get_modpath("fl_ores") and minetest.get_modpath("fl_stone") then
materials = {
@ -35,115 +37,120 @@ elseif minetest.get_modpath("fl_ores") and minetest.get_modpath("fl_stone") then
chest = "fl_storage:wood_chest",
steel_ingot = "fl_ores:iron_ingot",
gold_ingot = "fl_ores:gold_ingot",
mese = "fl_ores:iron_ingot",
mese_crystal = "fl_ores:iron_ingot",
mese = "fl_ores:iron_ingot",
mese_crystal = "fl_ores:iron_ingot",
mese_crystal_fragment = "fl_ores:iron_ingot",
teleporter = "fl_ores:iron_ingot",
copper_ingot = "fl_ores:copper_ingot",
glass = "fl_glass:framed_glass",
glass = "fl_glass:framed_glass",
}
elseif minetest.get_modpath("hades_core") then
materials = {
stone = "hades_core:stone",
desert_stone = "hades_core:desert_stone",
desert_sand = "hades_core:desert_sand",
chest = "hades_core:chest";
desert_stone = "hades_core:stone_baked",
desert_sand = "hades_core:volcanic_sand",
chest = "hades_chests:chest";
steel_ingot = "hades_core:steel_ingot",
gold_ingot = "hades_core:gold_ingot",
mese = "hades_core:mese",
mese_crystal = "hades_core:mese_crystal",
mese = "hades_core:mese",
mese_crystal = "hades_core:mese_crystal",
mese_crystal_fragment = "hades_core:mese_crystal_fragment",
teleporter = "hades_materials:teleporter_device",
copper_ingot = "hades_core:copper_ingot",
tin_ingot = "hades_core:tin_ingot",
glass = "default:glass",
glass = "hades_core:glass",
}
if minetest.get_modpath("hades_default") then
materials.desert_sand = "hades_default:desert_sand"
end
end
-- Crafting recipes for pipes
minetest.register_craft( {
output = "pipeworks:pipe_1_empty 12",
recipe = {
{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot },
{ "", "", "" },
{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot }
},
output = "pipeworks:pipe_1_empty 12",
recipe = {
{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot },
{ "", "", "" },
{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot }
},
})
minetest.register_craft( {
output = "pipeworks:straight_pipe_empty 3",
recipe = {
{ "pipeworks:pipe_1_empty", "pipeworks:pipe_1_empty", "pipeworks:pipe_1_empty" },
},
output = "pipeworks:straight_pipe_empty 3",
recipe = {
{ "pipeworks:pipe_1_empty", "pipeworks:pipe_1_empty", "pipeworks:pipe_1_empty" },
},
})
minetest.register_craft( {
output = "pipeworks:spigot 3",
recipe = {
{ "pipeworks:pipe_1_empty", "" },
{ "", "pipeworks:pipe_1_empty" },
},
output = "pipeworks:spigot 3",
recipe = {
{ "pipeworks:pipe_1_empty", "" },
{ "", "pipeworks:pipe_1_empty" },
},
})
minetest.register_craft( {
output = "pipeworks:entry_panel_empty 2",
recipe = {
{ "", materials.steel_ingot, "" },
{ "", "pipeworks:pipe_1_empty", "" },
{ "", materials.steel_ingot, "" },
{ "", materials.steel_ingot, "" },
{ "", "pipeworks:pipe_1_empty", "" },
{ "", materials.steel_ingot, "" },
},
})
-- Various ancillary pipe devices
minetest.register_craft( {
output = "pipeworks:pump_off 2",
recipe = {
{ materials.stone, materials.steel_ingot, materials.stone },
{ materials.copper_ingot, materials.mese_crystal_fragment, materials.copper_ingot },
{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot }
},
output = "pipeworks:pump_off 2",
recipe = {
{ materials.stone, materials.steel_ingot, materials.stone },
{ materials.copper_ingot, materials.mese_crystal_fragment, materials.copper_ingot },
{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot }
},
})
minetest.register_craft( {
output = "pipeworks:valve_off_empty 2",
recipe = {
{ "", "group:stick", "" },
{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot },
{ "", materials.steel_ingot, "" }
},
output = "pipeworks:valve_off_empty 2",
recipe = {
{ "", "group:stick", "" },
{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot },
{ "", materials.steel_ingot, "" }
},
})
minetest.register_craft( {
output = "pipeworks:storage_tank_0 2",
recipe = {
{ "", materials.steel_ingot, materials.steel_ingot },
{ materials.steel_ingot, materials.glass, materials.steel_ingot },
{ materials.steel_ingot, materials.steel_ingot, "" }
},
output = "pipeworks:storage_tank_0 2",
recipe = {
{ "", materials.steel_ingot, materials.steel_ingot },
{ materials.steel_ingot, materials.glass, materials.steel_ingot },
{ materials.steel_ingot, materials.steel_ingot, "" }
},
})
minetest.register_craft( {
output = "pipeworks:grating 2",
recipe = {
{ materials.steel_ingot, "", materials.steel_ingot },
{ "", "pipeworks:pipe_1_empty", "" },
{ materials.steel_ingot, "", materials.steel_ingot }
},
output = "pipeworks:grating 2",
recipe = {
{ materials.steel_ingot, "", materials.steel_ingot },
{ "", "pipeworks:pipe_1_empty", "" },
{ materials.steel_ingot, "", materials.steel_ingot }
},
})
minetest.register_craft( {
output = "pipeworks:flow_sensor_empty 2",
recipe = {
{ "pipeworks:pipe_1_empty", "mesecons:mesecon", "pipeworks:pipe_1_empty" },
},
output = "pipeworks:flow_sensor_empty 2",
recipe = {
{ "pipeworks:pipe_1_empty", "mesecons:mesecon", "pipeworks:pipe_1_empty" },
},
})
minetest.register_craft( {
output = "pipeworks:fountainhead 2",
recipe = {
{ "pipeworks:pipe_1_empty" },
{ "pipeworks:pipe_1_empty" }
},
output = "pipeworks:fountainhead 2",
recipe = {
{ "pipeworks:pipe_1_empty" },
{ "pipeworks:pipe_1_empty" }
},
})
-- injectors
@ -151,18 +158,18 @@ minetest.register_craft( {
minetest.register_craft( {
output = "pipeworks:filter 2",
recipe = {
{ materials.steel_ingot, materials.steel_ingot, "basic_materials:plastic_sheet" },
{ "group:stick", materials.mese_crystal, "basic_materials:plastic_sheet" },
{ materials.steel_ingot, materials.steel_ingot, "basic_materials:plastic_sheet" }
{ materials.steel_ingot, materials.steel_ingot, "basic_materials:plastic_sheet" },
{ "group:stick", materials.mese_crystal, "basic_materials:plastic_sheet" },
{ materials.steel_ingot, materials.steel_ingot, "basic_materials:plastic_sheet" }
},
})
minetest.register_craft( {
output = "pipeworks:mese_filter 2",
recipe = {
{ materials.steel_ingot, materials.steel_ingot, "basic_materials:plastic_sheet" },
{ "group:stick", materials.mese, "basic_materials:plastic_sheet" },
{ materials.steel_ingot, materials.steel_ingot, "basic_materials:plastic_sheet" }
{ materials.steel_ingot, materials.steel_ingot, "basic_materials:plastic_sheet" },
{ "group:stick", materials.mese, "basic_materials:plastic_sheet" },
{ materials.steel_ingot, materials.steel_ingot, "basic_materials:plastic_sheet" }
},
})
@ -182,9 +189,9 @@ end
minetest.register_craft( {
output = "pipeworks:autocrafter 2",
recipe = {
{ materials.steel_ingot, materials.mese_crystal, materials.steel_ingot },
{ "basic_materials:plastic_sheet", materials.steel_ingot, "basic_materials:plastic_sheet" },
{ materials.steel_ingot, materials.mese_crystal, materials.steel_ingot }
{ materials.steel_ingot, materials.mese_crystal, materials.steel_ingot },
{ "basic_materials:plastic_sheet", materials.steel_ingot, "basic_materials:plastic_sheet" },
{ materials.steel_ingot, materials.mese_crystal, materials.steel_ingot }
},
})
@ -218,9 +225,9 @@ minetest.register_craft({
minetest.register_craft( {
output = "pipeworks:teleport_tube_1 2",
recipe = {
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
{ materials.desert_stone, materials.mese, materials.desert_stone },
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
{ materials.desert_stone, materials.teleporter, materials.desert_stone },
{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
},
})
@ -296,7 +303,7 @@ if pipeworks.enable_mese_sand_tube then
output = "pipeworks:mese_sand_tube_1 2",
recipe = {
{"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" },
{"group:sand", materials.mese_crystal, "group:sand" },
{"group:sand", materials.mese_crystal, "group:sand" },
{"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }
},
})
@ -318,7 +325,7 @@ if pipeworks.enable_deployer then
minetest.register_craft({
output = "pipeworks:deployer_off",
recipe = {
{ "group:wood", "default:chest", "group:wood" },
{ "group:wood", materials.chest, "group:wood" },
{ materials.stone, "mesecons:piston", materials.stone },
{ materials.stone, "mesecons:mesecon", materials.stone },
}
@ -329,9 +336,9 @@ if pipeworks.enable_dispenser then
minetest.register_craft({
output = "pipeworks:dispenser_off",
recipe = {
{ materials.desert_sand, materials.chest, materials.desert_sand },
{ materials.stone, "mesecons:piston", materials.stone },
{ materials.stone, "mesecons:mesecon", materials.stone },
{ materials.desert_sand, materials.chest, materials.desert_sand },
{ materials.stone, "mesecons:piston", materials.stone },
{ materials.stone, "mesecons:mesecon", materials.stone },
}
})
end
@ -340,9 +347,9 @@ if pipeworks.enable_node_breaker then
minetest.register_craft({
output = "pipeworks:nodebreaker_off",
recipe = {
{ "basic_materials:gear_steel", "basic_materials:gear_steel", "basic_materials:gear_steel" },
{ "basic_materials:gear_steel", "basic_materials:gear_steel", "basic_materials:gear_steel" },
{ materials.stone, "mesecons:piston", materials.stone },
{ "group:wood", "mesecons:mesecon", "group:wood" },
{ "group:wood", "mesecons:mesecon", "group:wood" },
}
})
end

View File

@ -170,7 +170,7 @@ dofile(pipeworks.modpath..logicdir.."flowable_node_registry_install.lua")
if pipeworks.enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end
if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.lua") end
if pipeworks.enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua") end
if pipeworks.enable_redefines and minetest.get_modpath("default") then
if pipeworks.enable_redefines and (minetest.get_modpath("default") or minetest.get_modpath("hades_core")) then
dofile(pipeworks.modpath.."/compat-chests.lua")
dofile(pipeworks.modpath.."/compat-furnaces.lua")
end

View File

@ -1,5 +1,5 @@
name = pipeworks
description = This mod uses mesh nodes and nodeboxes to supply a complete set of 3D pipes and tubes, along with devices that work with them.
depends = basic_materials
optional_depends = mesecons, mesecons_mvps, digilines, signs_lib, unified_inventory, default, screwdriver, fl_mapgen, sound_api, i3
optional_depends = mesecons, mesecons_mvps, digilines, signs_lib, unified_inventory, default, screwdriver, fl_mapgen, sound_api, i3, hades_core, hades_furnaces, hades_chests
min_minetest_version = 5.2.0