diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bdba7d4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,44 @@ +# Compiled Lua sources +luac.out + +# luarocks build files +*.src.rock +*.zip +*.tar.gz + +# Object files +*.o +*.os +*.ko +*.obj +!models/*.obj +*.elf + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo +*.def +*.exp + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +*.tr.old + diff --git a/craft.lua b/craft.lua index 8862bea..d4b9992 100644 --- a/craft.lua +++ b/craft.lua @@ -1,94 +1,234 @@ --- trainblocks/craft.lua --- Crafting recipes for trainblocks ---[[ - Copyright (C) 2018 maxx, LuLa, gpcf - Copyright (C) 2024 1F616EMO - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -]] - -minetest.register_craft({ - output = 'trainblocks:subwayblock', - recipe = { - { '', 'dye:blue', '' }, - { 'dye:white', 'default:glass', 'dye:white' }, - { '', 'dye:blue', '' }, - } -}) - -minetest.register_craft({ - output = 'trainblocks:sbahnblock', - recipe = { - { '', 'dye:green', '' }, - { 'dye:white', 'default:glass', 'dye:white' }, - { '', 'dye:green', '' }, - } -}) - ---lineblocks from 1 to 10 -local dyes1 = { "blue", "red", "violet", "green", "orange", "yellow", "gray", "magenta", "cyan", "black" } -local dyes2 = { "white", "white", "white", "white", "white", "black", "white", "white", "white", "white" } - -for count = 1, 10, 1 do - minetest.register_craft({ - output = "trainblocks:line" .. count .. " 4", - recipe = { - { '', "dye:" .. dyes1[count], '' }, - { "dye:" .. dyes2[count], 'default:glass', '' }, - { '', '', '' }, - } - }) -end - - - ---subway direction signs - -minetest.register_craft({ - output = 'trainblocks:subwaysignL 2', - recipe = { - { '', '', '' }, - { 'dye:white', 'default:glass', 'dye:blue' }, - { '', '', '' }, - } -}) - -minetest.register_craft({ - output = 'trainblocks:subwaysignR 2', - recipe = { - { '', '', '' }, - { 'dye:blue', 'default:glass', 'dye:white' }, - { '', '', '' }, - } -}) - ---sbahn direction signs - -minetest.register_craft({ - output = 'trainblocks:sbahnsignL 2', - recipe = { - { '', '', '' }, - { 'dye:white', 'default:glass', 'dye:green' }, - { '', '', '' }, - } -}) - -minetest.register_craft({ - output = 'trainblocks:sbahnsignR 2', - recipe = { - { '', '', '' }, - { 'dye:blue', 'default:glass', 'dye:green' }, - { '', '', '' }, - } -}) +-- trainblocks/craft.lua +-- Crafting recipes for trainblocks +--[[ + Copyright (C) 2018 maxx, LuLa, gpcf + Copyright (C) 2024 1F616EMO + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +]] + +minetest.register_craft({ + output = 'trainblocks:subwayblock', + recipe = { + { '', 'dye:blue', '' }, + { 'dye:white', 'default:glass', 'dye:white' }, + { '', 'dye:blue', '' }, + } +}) + +minetest.register_craft({ + output = 'trainblocks:sbahnblock', + recipe = { + { '', 'dye:green', '' }, + { 'dye:white', 'default:glass', 'dye:white' }, + { '', 'dye:green', '' }, + } +}) + +-- lineblocks from 1 to 10 +-- gray -> grey from https://github.com/Montandalar/trainblocks/commit/5e6f906f7d5716127a4b760df8bc6ea1f61c84ea +-- Bonus: Line 0 +local dyes1 = { "blue", "blue", "red", "violet", "green", "orange", "yellow", "grey", "magenta", "cyan", "black" } +local dyes2 = { "blue", "white", "white", "white", "white", "white", "black", "white", "white", "white", "white" } + +for count = 0, 10, 1 do + minetest.register_craft({ + output = "trainblocks:line" .. count .. " 4", + recipe = { + { '', "dye:" .. dyes1[count + 1], '' }, + { "dye:" .. dyes2[count + 1], 'default:glass', '' }, + } + }) +end + + + +--subway direction signs + +minetest.register_craft({ + output = 'trainblocks:subwaysignL 2', + recipe = { + { 'dye:white', 'default:glass', 'dye:blue' } + } +}) + +minetest.register_craft({ + output = 'trainblocks:subwaysignR 2', + recipe = { + { 'dye:blue', 'default:glass', 'dye:white' }, + } +}) + +--sbahn direction signs + +minetest.register_craft({ + output = 'trainblocks:sbahnsignL 2', + recipe = { + { 'dye:white', 'default:glass', 'dye:green' }, + } +}) + +minetest.register_craft({ + output = 'trainblocks:sbahnsignR 2', + recipe = { + { 'dye:blue', 'default:glass', 'dye:green' }, + } +}) + +-- Switch betwen modern station direction signs and older style +-- from https://github.com/Montandalar/trainblocks/commit/4f4f6004e1e5067969fcc0efd8785a55ef36a6e2 + +minetest.register_craft({ + type = "shapeless", + output = 'trainblocks:stationsignR_modern', + recipe = {'trainblocks:stationsignR'} +}) +minetest.register_craft({ + type = "shapeless", + output = 'trainblocks:stationsignL_modern', + recipe = {'trainblocks:stationsignL'} +}) +minetest.register_craft({ + type = "shapeless", + recipe = {'trainblocks:stationsignR_modern'}, + output = 'trainblocks:stationsignR' +}) +minetest.register_craft({ + type = "shapeless", + recipe = {'trainblocks:stationsignL_modern'}, + output = 'trainblocks:stationsignL' +}) + +-- Platform signs 0-10 +-- from https://github.com/Montandalar/trainblocks/commit/f5e86f18f437ba3cb3337369d0b009e94dd5a8f5 + +minetest.register_craft({ + output = "trainblocks:platformsign0", + recipe = { + {'dye:blue', 'default:glass', ''}, + {'', 'dye:white', ''}, + } +}) + +minetest.register_craft({ + output = "trainblocks:platformsign1", + recipe = { + {'dye:blue', 'default:glass', 'dye:white'}, + {'', '', 'dye:white'}, + {'', '' ,'dye:white'} + } +}) + +minetest.register_craft({ + output = "trainblocks:platformsign2", + recipe = { + {'dye:blue', 'default:glass', ''}, + {'dye:white', 'dye:white', ''}, + } +}) + +minetest.register_craft({ + output = "trainblocks:platformsign3", + recipe = { + {'dye:blue', 'default:glass', ''}, + {'dye:white', 'dye:white', 'dye:white'}, + } +}) + +minetest.register_craft({ + output = "trainblocks:platformsign4", + recipe = { + {'dye:blue', 'default:glass', ''}, + {'dye:white', 'dye:white', ''}, + {'dye:white', 'dye:white' ,''} + } +}) + +minetest.register_craft({ + output = "trainblocks:platformsign5", + recipe = { + {'dye:blue', 'default:glass', ''}, + {'dye:white', 'dye:white', 'dye:white'}, + {'dye:white', 'dye:white' ,''} + } +}) + +minetest.register_craft({ + output = "trainblocks:platformsign6", + recipe = { + {'dye:blue', 'default:glass', ''}, + {'dye:white', 'dye:white', 'dye:white'}, + {'dye:white', 'dye:white' ,'dye:white'} + } +}) + +minetest.register_craft({ + output = "trainblocks:platformsign7", + recipe = { + {'dye:blue', 'default:glass', 'dye:white'}, + {'', '', 'dye:white'}, + {'', 'dye:white' ,''} + } +}) + +minetest.register_craft({ + output = "trainblocks:platformsign8", + recipe = { + {'dye:blue', 'default:glass', 'dye:white'}, + {'dye:white', '', 'dye:white'}, + {'dye:white', 'dye:white' ,'dye:white'} + } +}) + +minetest.register_craft({ + output = "trainblocks:platformsign9", + recipe = { + {'dye:blue', 'default:glass', 'dye:white'}, + {'', 'dye:white', 'dye:white'}, + {'', '' ,'dye:white'} + } +}) + +minetest.register_craft({ + output = "trainblocks:platformsign10", + recipe = { + {'dye:blue', 'default:glass', ''}, + {'dye:white', '', ''}, + {'dye:white', '' ,'dye:white'} + } +}) + +-- Recipies for (modern) station blocks +-- from https://github.com/Montandalar/trainblocks/commit/735e61288ad55317d4fffcdb4e58b5feebc419d0 + +minetest.register_craft({ + output = 'trainblocks:station_block', + recipe = { + {'', 'dye:black', ''}, + {'dye:white', 'default:glass', 'dye:white'}, + {'', 'dye:black', ''}, + } +}) + +minetest.register_craft({ + type = 'shapeless', + output = 'trainblocks:station_block_modern', + recipe = {'trainblocks:station_block'} +}) + +minetest.register_craft({ + type = 'shapeless', + recipe = {'trainblocks:station_block_modern'}, + output = 'trainblocks:station_block' +}) \ No newline at end of file diff --git a/init.lua b/init.lua index 53ae257..335f3a9 100644 --- a/init.lua +++ b/init.lua @@ -2,6 +2,7 @@ -- Adds signs fitting the advtrains theme --[[ Copyright (C) 2018 maxx, LuLa, gpcf + Copyright (C) 2020, 2021 Montandalar/Blockhead Copyright (C) 2024 1F616EMO This program is free software: you can redistribute it and/or modify @@ -36,23 +37,35 @@ minetest.register_node("trainblocks:subwayblock", { drop = "trainblocks:subwayblock" }) -minetest.register_node("trainblocks:sbahnblock", { - description = S("S-Bahn block"), - light_source = 8, - tiles = { - "down_sbahnblock.png", - "down_sbahnblock.png", - "front_sbahnblock.png", - "front_sbahnblock.png", - "front_sbahnblock.png", - "front_sbahnblock.png" - }, - is_ground_content = true, - groups = { cracky = 3 }, - drop = "trainblocks:sbahnblock" -}) +do + -- Add a setting for legacy sbahnblock textures + -- from https://github.com/Montandalar/trainblocks/commit/0fa3f52123bfe5aea386f987e7204c94aba72725 -for count = 1, 10, 1 do + local sbahncolorize = "" + if minetest.settings:get_bool("trainblocks_legacy_sbahnblock", false) then + sbahncolorize = "^[colorize:#00DF11FF" + end --00E876FF + + minetest.register_node("trainblocks:sbahnblock", { + description = S("S-Bahn block"), + light_source = 8, + tiles = { + "down_sbahnblock.png", + "down_sbahnblock.png" .. sbahncolorize, + "front_sbahnblock.png", + "front_sbahnblock.png", + "front_sbahnblock.png", + "front_sbahnblock.png" + }, + is_ground_content = true, + groups = { cracky = 3 }, + drop = "trainblocks:sbahnblock" + }) +end + +-- Platform 0 from https://github.com/Montandalar/trainblocks/commit/12a365d1c280d2b106621a8088229ee50937c488 +-- Bonus: Line 0 +for count = 0, 10, 1 do minetest.register_node("trainblocks:line" .. count, { description = S("Line sign @1", count), tiles = { "front_line" .. count .. ".png" }, @@ -76,7 +89,6 @@ for count = 1, 10, 1 do wall_top = { -0.5, -0.25, -0.25, -0.4375, 0.25, 0.25 }, wall_bottom = { -0.5, -0.25, -0.25, -0.4375, 0.25, 0.25 }, wall_side = { -0.5, -0.25, -0.25, -0.4375, 0.25, 0.25 }, - } }) @@ -296,6 +308,114 @@ minetest.register_node("trainblocks:mr", { drop = "trainblocks:sbahnblock" }) +-- Modern station blocks +-- from https://github.com/Montandalar/trainblocks/commit/12a365d1c280d2b106621a8088229ee50937c488 + +minetest.register_node("trainblocks:stationsignL_modern", { + description = S("Modern Station Sign (Left)"), + tiles = { + "station_sign3.png", + "station_sign3.png", + "station_sign3.png", + "station_sign3.png", + "station_sign2_modern.png", + "station_sign2_modern.png^[transformFX", + }, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + { -8 / 16, -5 / 16, 6 / 16, 8 / 16, 5 / 16, 8 / 16 }, + }, + }, + + paramtype2 = "facedir", + paramtype = 'light', + light_source = 6, + is_ground_content = false, + groups = { cracky = 3 }, +}) + +minetest.register_node("trainblocks:stationsignR_modern", { + description = S("Modern Station Sign (Right)"), + tiles = { + "station_sign3.png", + "station_sign3.png", + "station_sign3.png", + "station_sign3.png", + "station_sign2_modern.png", + "station_sign2_modern.png", + }, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + { -8 / 16, -5 / 16, 6 / 16, 8 / 16, 5 / 16, 8 / 16 }, + }, + }, + + paramtype2 = "facedir", + paramtype = 'light', + light_source = 6, + is_ground_content = false, + groups = { cracky = 3 }, +}) + +minetest.register_node("trainblocks:station_block_modern", { + description = S("Modern Station Block"), + light_source = 8, + tiles = { + "down_station_sign.png", + "down_station_sign.png", + "front_station_sign_modern.png", + "front_station_sign_modern.png", + "front_station_sign_modern.png", + "front_station_sign_modern.png", + }, + is_ground_content = true, + groups = { cracky = 3 }, + drop = "trainblocks:station_block" +}) + +-- "No Pedestrains" signs +-- from https://github.com/Montandalar/trainblocks/commit/3e00d5cf40759c085deccc915f1fa6fb2c092523 +-- train blocking fix from https://github.com/Montandalar/trainblocks/commit/a312afc27c2967e0ba04d6b4da3a074cf54f73df + +local box_flat = { + type = "fixed", + fixed = { -0.5000, -0.4375, -0.5000, 0.5000, -0.4375, 0.5000 } +} + +local pedsigns = { + { name = "no_pedestrians", desc = S("No Pedestrians Sign") }, + { name = "durchgang_verboten", desc = S("No Pedestrians Sign (German)") } +} + +for _, v in pairs(pedsigns) do + minetest.register_node("trainblocks:" .. v.name, { + description = v.desc, + light_source = 2, + drawtype = "signlike", + paramtype = "light", + paramtype2 = "wallmounted", + tiles = { v.name .. ".png" }, + inventory_image = v.name .. ".png", + wield_image = v.name .. ".png", + groups = { + cracky = 3, + not_blocking_trains = 1, + }, + drop = "trainblocks:" .. v.name, + is_ground_content = true, + node_box = box_flat, + selection_box = box_flat, + }) +end + +-- Add a setting to disable crafting recipes +-- from https://github.com/Montandalar/trainblocks/commit/15e2b88f44671aa68d1a758a6aca363b602a1282 +if not minetest.settings:get_bool('trainblocks_disable_recipes', false) then + dofile(minetest.get_modpath("trainblocks") .. "/craft.lua") +end -dofile(minetest.get_modpath("trainblocks") .. "/craft.lua") dofile(minetest.get_modpath("trainblocks") .. "/alias.lua") diff --git a/locale/template.txt b/locale/template.txt index 2fb23a7..d3d6408 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -1,4 +1,6 @@ # textdomain: trainblocks + +### init.lua ### Subway block= S-Bahn block= Line sign @1= @@ -11,3 +13,6 @@ Station Sign (Left)= Station Sign (Right)= Station Block= Mountain Railway Block= +Modern Station Sign (Left)= +Modern Station Sign (Right)= +Modern Station Block= diff --git a/locale/trainblocks.zh_TW.tr b/locale/trainblocks.zh_TW.tr index fda0297..ec08352 100644 --- a/locale/trainblocks.zh_TW.tr +++ b/locale/trainblocks.zh_TW.tr @@ -1,4 +1,6 @@ # textdomain: trainblocks + +### init.lua ### Subway block=地鐵方塊 S-Bahn block=城鐵方塊 Line sign @1=路線告示牌 @1 @@ -11,3 +13,6 @@ Station Sign (Left)=車站告示牌(左) Station Sign (Right)=車站告示牌(右) Station Block=車站方塊 Mountain Railway Block=山區鐵路方塊 +Modern Station Sign (Left)=現代車站告示牌(左) +Modern Station Sign (Right)=現代車站告示牌(右) +Modern Station Block=現代車站方塊 diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..850812a --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1,7 @@ +# Disable crafting recipes. Server admins may want to disable crafting of the +# blocks in this mod to restrict their use. +trainblocks_disable_recipes (Disable crafting recipes) bool false + +# Puts a vibrant green texture on top of the s-bahn block, which used to be a +# missing texture. +trainblocks_legacy_sbahnblock (Legacy S-Bahn block) bool false \ No newline at end of file diff --git a/textures/durchgang_verboten.png b/textures/durchgang_verboten.png new file mode 100644 index 0000000..635ea65 Binary files /dev/null and b/textures/durchgang_verboten.png differ diff --git a/textures/front_line0.png b/textures/front_line0.png new file mode 100644 index 0000000..a160081 Binary files /dev/null and b/textures/front_line0.png differ diff --git a/textures/front_platform0.png b/textures/front_platform0.png new file mode 100644 index 0000000..6ed8057 Binary files /dev/null and b/textures/front_platform0.png differ diff --git a/textures/front_station_sign_modern.png b/textures/front_station_sign_modern.png new file mode 100644 index 0000000..8bf4063 Binary files /dev/null and b/textures/front_station_sign_modern.png differ diff --git a/textures/inventory_line0.png b/textures/inventory_line0.png new file mode 100644 index 0000000..2b94d6f Binary files /dev/null and b/textures/inventory_line0.png differ diff --git a/textures/inventory_platform0.png b/textures/inventory_platform0.png new file mode 100644 index 0000000..82e0021 Binary files /dev/null and b/textures/inventory_platform0.png differ diff --git a/textures/no_pedestrians.png b/textures/no_pedestrians.png new file mode 100644 index 0000000..c1beebc Binary files /dev/null and b/textures/no_pedestrians.png differ diff --git a/textures/station_sign2_modern.png b/textures/station_sign2_modern.png new file mode 100644 index 0000000..e5f5c44 Binary files /dev/null and b/textures/station_sign2_modern.png differ