Skip to content

Commit

Permalink
start converting to using xcompat (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsor4035 authored Aug 10, 2024
1 parent 81414e5 commit 193773b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 99 deletions.
1 change: 1 addition & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ read_globals = {
"minetest",
"vector",
"ItemStack",
"xcompat",

-- Deps
"creative", "mesecon", "mtt"
Expand Down
25 changes: 6 additions & 19 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ travelnet.abm_enabled = minetest.settings:get_bool("travelnet.abm_e

-- change these if you want other receipes for travelnet or elevator
travelnet.travelnet_recipe = {
{ "default:glass", "default:steel_ingot", "default:glass" },
{ "default:glass", "default:mese", "default:glass" },
{ "default:glass", "default:steel_ingot", "default:glass" }
{ xcompat.materials.glass, xcompat.materials.steel_ingot, xcompat.materials.glass },
{ xcompat.materials.glass, xcompat.materials.mese, xcompat.materials.glass },
{ xcompat.materials.glass, xcompat.materials.steel_ingot, xcompat.materials.glass }
}
travelnet.elevator_recipe = {
{ "default:steel_ingot", "default:glass", "default:steel_ingot" },
{ "default:steel_ingot", "", "default:steel_ingot" },
{ "default:steel_ingot", "default:glass", "default:steel_ingot" }
{ xcompat.materials.steel_ingot, xcompat.materials.glass, xcompat.materials.steel_ingot },
{ xcompat.materials.steel_ingot, "", xcompat.materials.steel_ingot },
{ xcompat.materials.steel_ingot, xcompat.materials.glass, xcompat.materials.steel_ingot }
}
travelnet.tiles_elevator = {
"travelnet_elevator_front.png",
Expand All @@ -43,19 +43,6 @@ travelnet.tiles_elevator = {
}
travelnet.elevator_inventory_image = "travelnet_elevator_inv.png"

if minetest.get_modpath("mcl_core") then
travelnet.travelnet_recipe = {
{ "mcl_core:glass", "mcl_core:iron_ingot", "mcl_core:glass" },
{ "mcl_core:glass", "mesecons_torch:redstoneblock", "mcl_core:glass" },
{ "mcl_core:glass", "mcl_core:iron_ingot", "mcl_core:glass" }
}
travelnet.elevator_recipe = {
{ "mcl_core:iron_ingot", "mcl_core:glass", "mcl_core:iron_ingot" },
{ "mcl_core:iron_ingot", "", "mcl_core:iron_ingot" },
{ "mcl_core:iron_ingot", "mcl_core:glass", "mcl_core:iron_ingot" }
}
end

travelnet.node_box = {
type = "fixed",
fixed = {
Expand Down
25 changes: 16 additions & 9 deletions doors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,20 @@ end

-- actually register the doors
-- (but only if the materials for them exist)
if minetest.get_modpath("default") then
travelnet.register_door("travelnet:elevator_door_steel", { "default_stone.png" }, "default:steel_ingot")
travelnet.register_door("travelnet:elevator_door_glass", { "travelnet_elevator_door_glass.png" }, "default:glass")
travelnet.register_door("travelnet:elevator_door_tin", { "default_clay.png" }, "default:tin_ingot")

elseif minetest.get_modpath("mcl_core") then
travelnet.register_door("travelnet:elevator_door_steel", { "default_stone.png" }, "mcl_core:iron_ingot")
travelnet.register_door("travelnet:elevator_door_glass", { "travelnet_elevator_door_glass.png" }, "mcl_core:glass")
-- travelnet.register_door("travelnet:elevator_door_tin", { "default_clay.png" }, "default:tin_ingot")
if minetest.get_modpath("default") or minetest.get_modpath("mcl_core") then
travelnet.register_door(
"travelnet:elevator_door_steel",
{ "default_stone.png" },
xcompat.materials.steel_ingot
)
travelnet.register_door(
"travelnet:elevator_door_glass",
{ "travelnet_elevator_door_glass.png" },
xcompat.materials.glass
)
travelnet.register_door(
"travelnet:elevator_door_tin",
{ "default_clay.png" },
xcompat.materials.tin_ingot
)
end
3 changes: 2 additions & 1 deletion mod.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name = travelnet
optional_depends = mesecons, dye, mtt, mcl_core
depends = xcompat
optional_depends = mesecons, mtt
description = Network of teleporter-boxes that allows easy travelling to other boxes on the same network.
86 changes: 16 additions & 70 deletions travelnet.lua
Original file line number Diff line number Diff line change
@@ -1,76 +1,22 @@

local dye_compat = {
yellow = "group:yellow",
red = "group:red",
orange = "group:orange",
blue = "group:blue",
cyan = "group:cyan",
green = "group:green",
dark_green = "group:dark_green",
violet = "group:violet",
pink = "group:pink",
magenta = "group:magenta",
brown = "group:brown",
grey = "group:grey",
dark_grey = "group:dark_grey",
black = "group:black",
white = "group:white",
}

if minetest.get_modpath("dye") then
dye_compat.yellow = "dye:yellow"
dye_compat.red = "dye:red"
dye_compat.orange = "dye:orange"
dye_compat.blue = "dye:blue"
dye_compat.cyan = "dye:cyan"
dye_compat.green = "dye:green"
dye_compat.dark_green = "dye:dark_green"
dye_compat.violet = "dye:violet"
dye_compat.pink = "dye:pink"
dye_compat.magenta = "dye:magenta"
dye_compat.brown = "dye:brown"
dye_compat.grey = "dye:grey"
dye_compat.dark_grey = "dye:dark_grey"
dye_compat.black = "dye:black"
dye_compat.white = "dye:white"
end

if minetest.get_modpath("mcl_dye") then
dye_compat.yellow = "mcl_dye:yellow"
dye_compat.red = "mcl_dye:red"
dye_compat.orange = "mcl_dye:orange"
dye_compat.blue = "mcl_dye:blue"
dye_compat.cyan = "mcl_dye:cyan"
dye_compat.green = "mcl_dye:green"
dye_compat.dark_green = "mcl_dye:dark_green"
dye_compat.violet = "mcl_dye:violet"
dye_compat.pink = "mcl_dye:pink"
dye_compat.magenta = "mcl_dye:magenta"
dye_compat.brown = "mcl_dye:brown"
dye_compat.grey = "mcl_dye:grey"
dye_compat.dark_grey = "mcl_dye:dark_grey"
dye_compat.black = "mcl_dye:black"
dye_compat.white = "mcl_dye:white"
end

local materials = xcompat.materials

local default_travelnets = {
-- "default" travelnet box in yellow
{ nodename="travelnet:travelnet", color="#e0bb2d", dye=dye_compat.yellow, recipe=travelnet.travelnet_recipe },
{ nodename="travelnet:travelnet_red", color="#ce1a1a", dye=dye_compat.red },
{ nodename="travelnet:travelnet_orange", color="#e2621b", dye=dye_compat.orange },
{ nodename="travelnet:travelnet_blue", color="#0051c5", dye=dye_compat.blue },
{ nodename="travelnet:travelnet_cyan", color="#00a6ae", dye=dye_compat.cyan },
{ nodename="travelnet:travelnet_green", color="#53c41c", dye=dye_compat.green },
{ nodename="travelnet:travelnet_dark_green", color="#2c7f00", dye=dye_compat.dark_green },
{ nodename="travelnet:travelnet_violet", color="#660bb3", dye=dye_compat.violet },
{ nodename="travelnet:travelnet_pink", color="#ff9494", dye=dye_compat.pink },
{ nodename="travelnet:travelnet_magenta", color="#d10377", dye=dye_compat.magenta },
{ nodename="travelnet:travelnet_brown", color="#572c00", dye=dye_compat.brown },
{ nodename="travelnet:travelnet_grey", color="#a2a2a2", dye=dye_compat.grey },
{ nodename="travelnet:travelnet_dark_grey", color="#3d3d3d", dye=dye_compat.dark_grey },
{ nodename="travelnet:travelnet_black", color="#0f0f0f", dye=dye_compat.black, light_source=0 },
{ nodename="travelnet:travelnet_white", color="#ffffff", dye=dye_compat.white, light_source=minetest.LIGHT_MAX },
{ nodename="travelnet:travelnet", color="#e0bb2d", dye=materials.dye_yellow, recipe=travelnet.travelnet_recipe },
{ nodename="travelnet:travelnet_red", color="#ce1a1a", dye=materials.dye_red },
{ nodename="travelnet:travelnet_orange", color="#e2621b", dye=materials.dye_orange },
{ nodename="travelnet:travelnet_blue", color="#0051c5", dye=materials.dye_blue },
{ nodename="travelnet:travelnet_cyan", color="#00a6ae", dye=materials.dye_cyan },
{ nodename="travelnet:travelnet_green", color="#53c41c", dye=materials.dye_green },
{ nodename="travelnet:travelnet_dark_green", color="#2c7f00", dye=materials.dye_dark_green },
{ nodename="travelnet:travelnet_violet", color="#660bb3", dye=materials.dye_violet },
{ nodename="travelnet:travelnet_pink", color="#ff9494", dye=materials.dye_pink },
{ nodename="travelnet:travelnet_magenta", color="#d10377", dye=materials.dye_magenta },
{ nodename="travelnet:travelnet_brown", color="#572c00", dye=materials.dye_brown },
{ nodename="travelnet:travelnet_grey", color="#a2a2a2", dye=materials.dye_grey },
{ nodename="travelnet:travelnet_dark_grey", color="#3d3d3d", dye=materials.dye_dark_grey },
{ nodename="travelnet:travelnet_black", color="#0f0f0f", dye=materials.dye_black, light_source=0 },
{ nodename="travelnet:travelnet_white", color="#ffffff", dye=materials.dye_white, light_source=minetest.LIGHT_MAX },
}

for _, cfg in ipairs(default_travelnets) do
Expand Down

0 comments on commit 193773b

Please sign in to comment.