mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-12-28 20:00:27 +01:00
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:
parent
55ded7e569
commit
4fce320d9c
@ -11,7 +11,10 @@ local tube_entry = "^pipeworks_tube_connection_wooden.png"
|
|||||||
-- Chest Locals
|
-- Chest Locals
|
||||||
local open_chests = {}
|
local open_chests = {}
|
||||||
|
|
||||||
local function get_chest_formspec(pos)
|
local get_chest_formspec
|
||||||
|
|
||||||
|
if minetest.get_modpath("default") then
|
||||||
|
function get_chest_formspec(pos)
|
||||||
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
|
local spos = pos.x .. "," .. pos.y .. "," .. pos.z
|
||||||
local formspec =
|
local formspec =
|
||||||
"size[8,9]" ..
|
"size[8,9]" ..
|
||||||
@ -39,6 +42,42 @@ local function get_chest_formspec(pos)
|
|||||||
|
|
||||||
return formspec
|
return formspec
|
||||||
end
|
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)
|
local function chest_lid_obstructed(pos)
|
||||||
local above = { x = pos.x, y = pos.y + 1, z = pos.z }
|
local above = { x = pos.x, y = pos.y + 1, z = pos.z }
|
||||||
@ -71,7 +110,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
minetest.after(0.2, function()
|
minetest.after(0.2, function()
|
||||||
|
if minetest.get_modpath("default") then
|
||||||
minetest.swap_node(pos, { name = "default:" .. swap, param2 = node.param2 })
|
minetest.swap_node(pos, { name = "default:" .. swap, param2 = node.param2 })
|
||||||
|
end
|
||||||
|
|
||||||
-- Pipeworks notification
|
-- Pipeworks notification
|
||||||
pipeworks.after_place(pos)
|
pipeworks.after_place(pos)
|
||||||
@ -88,10 +129,18 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
-- Original Definitions
|
-- Original Definitions
|
||||||
local old_chest_def = table.copy(minetest.registered_items["default:chest"])
|
local old_chest_def, old_chest_open_def, old_chest_locked_def, old_chest_locked_open_def
|
||||||
local old_chest_open_def = table.copy(minetest.registered_items["default:chest_open"])
|
if minetest.get_modpath("default") then
|
||||||
local old_chest_locked_def = table.copy(minetest.registered_items["default:chest_locked"])
|
old_chest_def = table.copy(minetest.registered_items["default:chest"])
|
||||||
local old_chest_locked_open_def = table.copy(minetest.registered_items["default:chest_locked_open"])
|
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
|
-- Override Construction
|
||||||
local override_protected, override, override_open, override_protected_open
|
local override_protected, override, override_open, override_protected_open
|
||||||
@ -116,10 +165,12 @@ override_protected = {
|
|||||||
minetest.sound_play(old_chest_locked_def.sound_open, {gain = 0.3,
|
minetest.sound_play(old_chest_locked_def.sound_open, {gain = 0.3,
|
||||||
pos = pos, max_hear_distance = 10})
|
pos = pos, max_hear_distance = 10})
|
||||||
if not chest_lid_obstructed(pos) then
|
if not chest_lid_obstructed(pos) then
|
||||||
|
if minetest.get_modpath("default") then
|
||||||
minetest.swap_node(pos,
|
minetest.swap_node(pos,
|
||||||
{ name = "default:" .. "chest_locked" .. "_open",
|
{ name = "default:" .. "chest_locked" .. "_open",
|
||||||
param2 = node.param2 })
|
param2 = node.param2 })
|
||||||
end
|
end
|
||||||
|
end
|
||||||
minetest.after(0.2, minetest.show_formspec,
|
minetest.after(0.2, minetest.show_formspec,
|
||||||
clicker:get_player_name(),
|
clicker:get_player_name(),
|
||||||
"pipeworks:chest_formspec", get_chest_formspec(pos))
|
"pipeworks:chest_formspec", get_chest_formspec(pos))
|
||||||
@ -160,10 +211,12 @@ override = {
|
|||||||
minetest.sound_play(old_chest_def.sound_open, {gain = 0.3, pos = pos,
|
minetest.sound_play(old_chest_def.sound_open, {gain = 0.3, pos = pos,
|
||||||
max_hear_distance = 10})
|
max_hear_distance = 10})
|
||||||
if not chest_lid_obstructed(pos) then
|
if not chest_lid_obstructed(pos) then
|
||||||
|
if minetest.get_modpath("default") then
|
||||||
minetest.swap_node(pos, {
|
minetest.swap_node(pos, {
|
||||||
name = "default:" .. "chest" .. "_open",
|
name = "default:" .. "chest" .. "_open",
|
||||||
param2 = node.param2 })
|
param2 = node.param2 })
|
||||||
end
|
end
|
||||||
|
end
|
||||||
minetest.after(0.2, minetest.show_formspec,
|
minetest.after(0.2, minetest.show_formspec,
|
||||||
clicker:get_player_name(),
|
clicker:get_player_name(),
|
||||||
"pipeworks:chest_formspec", get_chest_formspec(pos))
|
"pipeworks:chest_formspec", get_chest_formspec(pos))
|
||||||
@ -236,8 +289,15 @@ for _,v in ipairs({override_protected, override, override_open, override_protect
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Override with the new modifications.
|
-- Override with the new modifications.
|
||||||
|
if minetest.get_modpath("default") then
|
||||||
minetest.override_item("default:chest", override)
|
minetest.override_item("default:chest", override)
|
||||||
minetest.override_item("default:chest_open", override_open)
|
minetest.override_item("default:chest_open", override_open)
|
||||||
minetest.override_item("default:chest_locked", override_protected)
|
minetest.override_item("default:chest_locked", override_protected)
|
||||||
minetest.override_item("default:chest_locked_open", override_protected_open)
|
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
|
||||||
|
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
-- this file is basically a modified copy of
|
-- this file is basically a modified copy of
|
||||||
-- minetest_game/mods/default/furnaces.lua
|
-- minetest_game/mods/default/furnaces.lua
|
||||||
|
|
||||||
local def = table.copy(minetest.registered_nodes["default:furnace"])
|
local def--, def_active
|
||||||
--local def_active = table.copy(minetest.registered_nodes["default:furnace_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"
|
local tube_entry = "^pipeworks_tube_connection_stony.png"
|
||||||
|
|
||||||
@ -16,7 +22,7 @@ groups_active["not_in_creative_inventory"] = 1
|
|||||||
-- Node definitions
|
-- Node definitions
|
||||||
--
|
--
|
||||||
|
|
||||||
minetest.override_item("default:furnace", {
|
local override = {
|
||||||
tiles = {
|
tiles = {
|
||||||
"default_furnace_top.png"..tube_entry,
|
"default_furnace_top.png"..tube_entry,
|
||||||
"default_furnace_bottom.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_place_node = pipeworks.after_place,
|
||||||
after_dig_node = pipeworks.after_dig,
|
after_dig_node = pipeworks.after_dig,
|
||||||
on_rotate = pipeworks.on_rotate
|
on_rotate = pipeworks.on_rotate
|
||||||
})
|
}
|
||||||
|
|
||||||
minetest.override_item("default:furnace_active", {
|
local override_active = {
|
||||||
tiles = {
|
tiles = {
|
||||||
"default_furnace_top.png"..tube_entry,
|
"default_furnace_top.png"..tube_entry,
|
||||||
"default_furnace_bottom.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_place_node = pipeworks.after_place,
|
||||||
after_dig_node = pipeworks.after_dig,
|
after_dig_node = pipeworks.after_dig,
|
||||||
on_rotate = pipeworks.on_rotate
|
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
|
||||||
|
|
||||||
|
19
crafts.lua
19
crafts.lua
@ -9,6 +9,7 @@ local materials = {
|
|||||||
mese = "default:mese",
|
mese = "default:mese",
|
||||||
mese_crystal = "default:mese_crystal",
|
mese_crystal = "default:mese_crystal",
|
||||||
mese_crystal_fragment = "default:mese_crystal_fragment",
|
mese_crystal_fragment = "default:mese_crystal_fragment",
|
||||||
|
teleporter = "default:mese",
|
||||||
glass = "default:glass",
|
glass = "default:glass",
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ if minetest.get_modpath("mcl_core") then
|
|||||||
mese = "default:mese",
|
mese = "default:mese",
|
||||||
mese_crystal = "default:mese_crystal",
|
mese_crystal = "default:mese_crystal",
|
||||||
mese_crystal_fragment = "mesecons:redstone",
|
mese_crystal_fragment = "mesecons:redstone",
|
||||||
|
teleporter = "default:mese",
|
||||||
-- Use iron where no equivalent
|
-- Use iron where no equivalent
|
||||||
copper_ingot = "mcl_core:iron_ingot",
|
copper_ingot = "mcl_core:iron_ingot",
|
||||||
glass = "default:glass",
|
glass = "default:glass",
|
||||||
@ -38,24 +40,29 @@ elseif minetest.get_modpath("fl_ores") and minetest.get_modpath("fl_stone") then
|
|||||||
mese = "fl_ores:iron_ingot",
|
mese = "fl_ores:iron_ingot",
|
||||||
mese_crystal = "fl_ores:iron_ingot",
|
mese_crystal = "fl_ores:iron_ingot",
|
||||||
mese_crystal_fragment = "fl_ores:iron_ingot",
|
mese_crystal_fragment = "fl_ores:iron_ingot",
|
||||||
|
teleporter = "fl_ores:iron_ingot",
|
||||||
copper_ingot = "fl_ores:copper_ingot",
|
copper_ingot = "fl_ores:copper_ingot",
|
||||||
glass = "fl_glass:framed_glass",
|
glass = "fl_glass:framed_glass",
|
||||||
}
|
}
|
||||||
elseif minetest.get_modpath("hades_core") then
|
elseif minetest.get_modpath("hades_core") then
|
||||||
materials = {
|
materials = {
|
||||||
stone = "hades_core:stone",
|
stone = "hades_core:stone",
|
||||||
desert_stone = "hades_core:desert_stone",
|
desert_stone = "hades_core:stone_baked",
|
||||||
desert_sand = "hades_core:desert_sand",
|
desert_sand = "hades_core:volcanic_sand",
|
||||||
chest = "hades_core:chest";
|
chest = "hades_chests:chest";
|
||||||
steel_ingot = "hades_core:steel_ingot",
|
steel_ingot = "hades_core:steel_ingot",
|
||||||
gold_ingot = "hades_core:gold_ingot",
|
gold_ingot = "hades_core:gold_ingot",
|
||||||
mese = "hades_core:mese",
|
mese = "hades_core:mese",
|
||||||
mese_crystal = "hades_core:mese_crystal",
|
mese_crystal = "hades_core:mese_crystal",
|
||||||
mese_crystal_fragment = "hades_core:mese_crystal_fragment",
|
mese_crystal_fragment = "hades_core:mese_crystal_fragment",
|
||||||
|
teleporter = "hades_materials:teleporter_device",
|
||||||
copper_ingot = "hades_core:copper_ingot",
|
copper_ingot = "hades_core:copper_ingot",
|
||||||
tin_ingot = "hades_core:tin_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
|
end
|
||||||
|
|
||||||
-- Crafting recipes for pipes
|
-- Crafting recipes for pipes
|
||||||
@ -219,7 +226,7 @@ minetest.register_craft( {
|
|||||||
output = "pipeworks:teleport_tube_1 2",
|
output = "pipeworks:teleport_tube_1 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "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.mese, materials.desert_stone },
|
{ materials.desert_stone, materials.teleporter, 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" }
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -318,7 +325,7 @@ if pipeworks.enable_deployer then
|
|||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "pipeworks:deployer_off",
|
output = "pipeworks:deployer_off",
|
||||||
recipe = {
|
recipe = {
|
||||||
{ "group:wood", "default:chest", "group:wood" },
|
{ "group:wood", materials.chest, "group:wood" },
|
||||||
{ materials.stone, "mesecons:piston", materials.stone },
|
{ materials.stone, "mesecons:piston", materials.stone },
|
||||||
{ materials.stone, "mesecons:mesecon", materials.stone },
|
{ materials.stone, "mesecons:mesecon", materials.stone },
|
||||||
}
|
}
|
||||||
|
2
init.lua
2
init.lua
@ -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_pipes then dofile(pipeworks.modpath.."/pipes.lua") end
|
||||||
if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.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_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-chests.lua")
|
||||||
dofile(pipeworks.modpath.."/compat-furnaces.lua")
|
dofile(pipeworks.modpath.."/compat-furnaces.lua")
|
||||||
end
|
end
|
||||||
|
2
mod.conf
2
mod.conf
@ -1,5 +1,5 @@
|
|||||||
name = pipeworks
|
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.
|
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
|
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
|
min_minetest_version = 5.2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user