From 3635b848d526716acdcf765b60ba1a2ff1e3df2e Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 7 Mar 2021 00:42:34 +0100 Subject: [PATCH] add API for mcl_wip --- mods/ENTITIES/mcl_minecarts/init.lua | 8 ++ mods/ENTITIES/mcl_minecarts/mod.conf | 2 +- mods/ENTITIES/mcl_paintings/init.lua | 2 + mods/ENTITIES/mcl_paintings/mod.conf | 1 + mods/ENTITIES/mobs_mc/ender_dragon.lua | 2 + mods/ENTITIES/mobs_mc/mod.conf | 2 +- mods/ENTITIES/mobs_mc/witch.lua | 2 + mods/ENTITIES/mobs_mc/wither.lua | 2 + mods/ITEMS/REDSTONE/mcl_comparators/init.lua | 1 + mods/ITEMS/REDSTONE/mcl_comparators/mod.conf | 1 + mods/ITEMS/mcl_end/depends.txt | 5 - mods/ITEMS/mcl_end/mod.conf | 2 + mods/ITEMS/mcl_maps/init.lua | 2 + mods/ITEMS/mcl_maps/mod.conf | 1 + mods/ITEMS/mcl_potions/init.lua | 9 ++ mods/ITEMS/mcl_potions/mod.conf | 2 +- mods/ITEMS/screwdriver/init.lua | 1 + mods/ITEMS/screwdriver/mod.conf | 2 + mods/MISC/mcl_wip/init.lua | 98 ++++++++------------ mods/MISC/mcl_wip/mod.conf | 2 +- 20 files changed, 77 insertions(+), 70 deletions(-) delete mode 100644 mods/ITEMS/mcl_end/depends.txt create mode 100644 mods/ITEMS/mcl_end/mod.conf create mode 100644 mods/ITEMS/screwdriver/mod.conf diff --git a/mods/ENTITIES/mcl_minecarts/init.lua b/mods/ENTITIES/mcl_minecarts/init.lua index 6c022a9b9..2fa626479 100644 --- a/mods/ENTITIES/mcl_minecarts/init.lua +++ b/mods/ENTITIES/mcl_minecarts/init.lua @@ -653,6 +653,8 @@ register_minecart( "mcl_minecarts_minecart_chest.png", {"mcl_minecarts:minecart", "mcl_chests:chest"}, nil, nil, false) + +mcl_wip.register_wip_item("mcl_minecarts:chest_minecart") -- Minecart with Furnace register_minecart( @@ -708,6 +710,8 @@ register_minecart( end, nil, false ) +mcl_wip.register_wip_item("mcl_minecarts:furnace_minecart") + -- Minecart with Command Block register_minecart( "mcl_minecarts:command_block_minecart", @@ -729,6 +733,8 @@ register_minecart( nil, nil, false ) +mcl_wip.register_wip_item("mcl_minecarts:command_block_minecart") + -- Minecart with Hopper register_minecart( "mcl_minecarts:hopper_minecart", @@ -747,6 +753,8 @@ register_minecart( nil, nil, false ) +mcl_wip.register_wip_item("mcl_minecarts:hopper_minecart") + -- Minecart with TNT register_minecart( "mcl_minecarts:tnt_minecart", diff --git a/mods/ENTITIES/mcl_minecarts/mod.conf b/mods/ENTITIES/mcl_minecarts/mod.conf index 3fc38c271..138fd18e6 100644 --- a/mods/ENTITIES/mcl_minecarts/mod.conf +++ b/mods/ENTITIES/mcl_minecarts/mod.conf @@ -1,6 +1,6 @@ name = mcl_minecarts author = Krock description = Minecarts are vehicles to move players quickly on rails. -depends = mcl_explosions, mcl_core, mcl_sounds, mcl_player, mcl_achievements, mcl_chests, mcl_furnaces, mesecons_commandblock, mcl_hoppers, mcl_tnt, mesecons +depends = mcl_explosions, mcl_core, mcl_sounds, mcl_player, mcl_achievements, mcl_chests, mcl_furnaces, mesecons_commandblock, mcl_hoppers, mcl_tnt, mesecons, mcl_wip optional_depends = doc_identifier diff --git a/mods/ENTITIES/mcl_paintings/init.lua b/mods/ENTITIES/mcl_paintings/init.lua index 6a3ccab4d..39a513d3d 100644 --- a/mods/ENTITIES/mcl_paintings/init.lua +++ b/mods/ENTITIES/mcl_paintings/init.lua @@ -293,6 +293,8 @@ minetest.register_craftitem("mcl_paintings:painting", { end, }) +mcl_wip.register_wip_item("mcl_paintings:painting") + minetest.register_craft({ output = "mcl_paintings:painting", recipe = { diff --git a/mods/ENTITIES/mcl_paintings/mod.conf b/mods/ENTITIES/mcl_paintings/mod.conf index 0afabd293..2c6955360 100644 --- a/mods/ENTITIES/mcl_paintings/mod.conf +++ b/mods/ENTITIES/mcl_paintings/mod.conf @@ -1,4 +1,5 @@ name = mcl_paintings author = Wuzzy description = The paintings mod for MCL2 +depends = mcl_wip diff --git a/mods/ENTITIES/mobs_mc/ender_dragon.lua b/mods/ENTITIES/mobs_mc/ender_dragon.lua index 50b781903..e62b0d16b 100644 --- a/mods/ENTITIES/mobs_mc/ender_dragon.lua +++ b/mods/ENTITIES/mobs_mc/ender_dragon.lua @@ -105,3 +105,5 @@ mobs:register_arrow("mobs_mc:dragon_fireball", { }) mobs:register_egg("mobs_mc:enderdragon", S("Ender Dragon"), "mobs_mc_spawn_icon_dragon.png", 0, true) + +mcl_wip.register_wip_item("mobs_mc:enderdragon") diff --git a/mods/ENTITIES/mobs_mc/mod.conf b/mods/ENTITIES/mobs_mc/mod.conf index db0bc124a..98f48b388 100644 --- a/mods/ENTITIES/mobs_mc/mod.conf +++ b/mods/ENTITIES/mobs_mc/mod.conf @@ -1,6 +1,6 @@ name = mobs_mc author = maikerumine description = Adds Minecraft-like monsters and animals. -depends = mcl_init, mcl_particles, mcl_mobs +depends = mcl_init, mcl_particles, mcl_mobs, mcl_wip optional_depends = default, mcl_tnt, mcl_bows, mcl_throwing, mcl_fishing, bones, mesecons_materials, mobs_mc_gameconfig, doc_items diff --git a/mods/ENTITIES/mobs_mc/witch.lua b/mods/ENTITIES/mobs_mc/witch.lua index e95357564..05f5098e5 100644 --- a/mods/ENTITIES/mobs_mc/witch.lua +++ b/mods/ENTITIES/mobs_mc/witch.lua @@ -104,3 +104,5 @@ mobs:register_arrow("mobs_mc:potion_arrow", { -- spawn eggs mobs:register_egg("mobs_mc:witch", S("Witch"), "mobs_mc_spawn_icon_witch.png", 0, true) + +mcl_wip.register_wip_item("mobs_mc:witch") diff --git a/mods/ENTITIES/mobs_mc/wither.lua b/mods/ENTITIES/mobs_mc/wither.lua index 8e90ddc15..3fbf65955 100644 --- a/mods/ENTITIES/mobs_mc/wither.lua +++ b/mods/ENTITIES/mobs_mc/wither.lua @@ -106,3 +106,5 @@ mobs:register_arrow("mobs_mc:wither_skull", { --Spawn egg mobs:register_egg("mobs_mc:wither", S("Wither"), "mobs_mc_spawn_icon_wither.png", 0, true) + +mcl_wip.register_wip_item("mobs_mc:wither") \ No newline at end of file diff --git a/mods/ITEMS/REDSTONE/mcl_comparators/init.lua b/mods/ITEMS/REDSTONE/mcl_comparators/init.lua index a8fab81d7..cd194b0d1 100644 --- a/mods/ITEMS/REDSTONE/mcl_comparators/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_comparators/init.lua @@ -303,6 +303,7 @@ for _, state in pairs{mesecon.state.on, mesecon.state.off} do end minetest.register_node(nodename, nodedef) + mcl_wip.register_wip_item(nodename) end end diff --git a/mods/ITEMS/REDSTONE/mcl_comparators/mod.conf b/mods/ITEMS/REDSTONE/mcl_comparators/mod.conf index e0a6a9bbb..28d8926a0 100644 --- a/mods/ITEMS/REDSTONE/mcl_comparators/mod.conf +++ b/mods/ITEMS/REDSTONE/mcl_comparators/mod.conf @@ -1 +1,2 @@ name = mcl_comparators +depends = mcl_wip diff --git a/mods/ITEMS/mcl_end/depends.txt b/mods/ITEMS/mcl_end/depends.txt deleted file mode 100644 index 2adb4b59d..000000000 --- a/mods/ITEMS/mcl_end/depends.txt +++ /dev/null @@ -1,5 +0,0 @@ -mcl_sounds -mcl_util -doc_items -mcl_worlds -mcl_structures diff --git a/mods/ITEMS/mcl_end/mod.conf b/mods/ITEMS/mcl_end/mod.conf new file mode 100644 index 000000000..021417e86 --- /dev/null +++ b/mods/ITEMS/mcl_end/mod.conf @@ -0,0 +1,2 @@ +name = mcl_end +depends = screwdriver, mcl_sounds, mcl_util, doc_items, mcl_worlds, mcl_structures \ No newline at end of file diff --git a/mods/ITEMS/mcl_maps/init.lua b/mods/ITEMS/mcl_maps/init.lua index 893e70073..58a0a3a15 100644 --- a/mods/ITEMS/mcl_maps/init.lua +++ b/mods/ITEMS/mcl_maps/init.lua @@ -28,6 +28,8 @@ minetest.register_craftitem("mcl_maps:empty_map", { stack_max = 64, }) +mcl_wip.register_wip_item("mcl_maps:empty_map") + local function has_item_in_hotbar(player, item) -- Requirement: player carries the tool in the hotbar local inv = player:get_inventory() diff --git a/mods/ITEMS/mcl_maps/mod.conf b/mods/ITEMS/mcl_maps/mod.conf index 44c4becf0..5615dc2be 100644 --- a/mods/ITEMS/mcl_maps/mod.conf +++ b/mods/ITEMS/mcl_maps/mod.conf @@ -1 +1,2 @@ name = mcl_maps +depends = mcl_wip diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index b7f814c24..65bb0d4de 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -455,3 +455,12 @@ function mcl_potions.get_alchemy(ingr, pot) return false end + +mcl_wip.register_wip_item("mcl_potions:night_vision") +mcl_wip.register_wip_item("mcl_potions:night_vision_plus") +mcl_wip.register_wip_item("mcl_potions:night_vision_splash") +mcl_wip.register_wip_item("mcl_potions:night_vision_plus_splash") +mcl_wip.register_wip_item("mcl_potions:night_vision_lingering") +mcl_wip.register_wip_item("mcl_potions:night_vision_plus_lingering") +mcl_wip.register_wip_item("mcl_potions:night_vision_arrow") +mcl_wip.register_wip_item("mcl_potions:night_vision_plus_arrow") \ No newline at end of file diff --git a/mods/ITEMS/mcl_potions/mod.conf b/mods/ITEMS/mcl_potions/mod.conf index 3d6fd0011..bcb6d8ad3 100644 --- a/mods/ITEMS/mcl_potions/mod.conf +++ b/mods/ITEMS/mcl_potions/mod.conf @@ -1,2 +1,2 @@ name = mcl_potions -depends = mcl_core, mcl_farming, mcl_mobitems, mcl_fishing, mcl_bows, mcl_end, mcl_weather, playerphysics +depends = mcl_core, mcl_farming, mcl_mobitems, mcl_fishing, mcl_bows, mcl_end, mcl_weather, playerphysics, mcl_wip diff --git a/mods/ITEMS/screwdriver/init.lua b/mods/ITEMS/screwdriver/init.lua index ec4f1a2ad..e6aedf19c 100644 --- a/mods/ITEMS/screwdriver/init.lua +++ b/mods/ITEMS/screwdriver/init.lua @@ -187,6 +187,7 @@ minetest.register_tool("screwdriver:screwdriver", { end, }) +mcl_wip.register_wip_item("screwdriver:screwdriver") minetest.register_craft({ output = "screwdriver:screwdriver", diff --git a/mods/ITEMS/screwdriver/mod.conf b/mods/ITEMS/screwdriver/mod.conf new file mode 100644 index 000000000..a18279839 --- /dev/null +++ b/mods/ITEMS/screwdriver/mod.conf @@ -0,0 +1,2 @@ +name = screwdriver +depends = mcl_wip \ No newline at end of file diff --git a/mods/MISC/mcl_wip/init.lua b/mods/MISC/mcl_wip/init.lua index 22785d85a..0eb56dd84 100644 --- a/mods/MISC/mcl_wip/init.lua +++ b/mods/MISC/mcl_wip/init.lua @@ -2,68 +2,44 @@ local S = minetest.get_translator("mcl_wip") -local wip_items = { - "mcl_maps:empty_map", - "mcl_comparators:comparator_off_comp", - "mcl_minecarts:hopper_minecart", - "mcl_minecarts:command_block_minecart", - "mcl_minecarts:chest_minecart", - "mcl_minecarts:furnace_minecart", - "mobs_mc:enderdragon", - "mobs_mc:wither", - "mobs_mc:witch", - "screwdriver:screwdriver", - "mcl_paintings:painting", - "mcl_potions:night_vision", - "mcl_potions:night_vision_plus", - -- "mcl_potions:weakness", - -- "mcl_potions:weakness_plus", - -- "mcl_potions:strength", - -- "mcl_potions:strength_plus", - -- "mcl_potions:strength_2", - "mcl_potions:night_vision_splash", - "mcl_potions:night_vision_plus_splash", - -- "mcl_potions:weakness_splash", - -- "mcl_potions:weakness_plus_splash", - -- "mcl_potions:strength_splash", - -- "mcl_potions:strength_plus_splash", - -- "mcl_potions:strength_2_splash", - "mcl_potions:night_vision_lingering", - "mcl_potions:night_vision_plus_lingering", - -- "mcl_potions:weakness_lingering", - -- "mcl_potions:weakness_plus_lingering", - -- "mcl_potions:strength_lingering", - -- "mcl_potions:strength_plus_lingering", - -- "mcl_potions:strength_2_lingering", - "mcl_potions:night_vision_arrow", - "mcl_potions:night_vision_plus_arrow", -} -local experimental_items = { -} +mcl_wip = {} +mcl_wip.registered_wip_items = {} +mcl_wip.registered_experimental_items = {} -for i=1,#wip_items do - local def = minetest.registered_items[wip_items[i]] - if not def then - minetest.log("error", "[mcl_wip] Unknown item: "..wip_items[i]) - break - end - local new_description = def.description - local new_groups = table.copy(def.groups) - if new_description == "" then - new_description = wip_items[i] - end - new_description = new_description .. "\n"..core.colorize("#FF0000", S("(WIP)")) - --new_groups.not_in_craft_guide = 1 - minetest.override_item(wip_items[i], { description = new_description, groups = new_groups }) +function mcl_wip.register_wip_item(itemname) + table.insert(mcl_wip.registered_wip_items, itemname) --Only check for valid node name after mods loaded end -for i=1,#experimental_items do - local def = minetest.registered_items[experimental_items[i]] - if not def then - minetest.log("error", "[mcl_wip] Unknown item: "..experimental_items[i]) - break - end - local new_description = def.description - new_description = new_description .. "\n"..core.colorize("#FFFF00", S("(Temporary)")) - minetest.override_item(experimental_items[i], { description = new_description }) +function mcl_wip.register_experimental_item(itemname) + table.insert(mcl_wip.registered_experimental_items, itemname) end + +minetest.register_on_mods_loaded(function() + for _,name in pairs(mcl_wip.registered_wip_items) do + local def = minetest.registered_items[name] + if not def then + minetest.log("error", "[mcl_wip] Unknown item: "..name) + break + end + local new_description = def.description + if new_description == "" then + new_description = name + end + new_description = new_description .. "\n"..minetest.colorize(mcl_colors.RED, S("(WIP)")) + minetest.override_item(name, {description = new_description}) + end + + for _,name in pairs(mcl_wip.registered_experimental_items) do + local def = minetest.registered_items[name] + if not def then + minetest.log("error", "[mcl_wip] Unknown item: "..name) + break + end + local new_description = def.description + if new_description == "" then + new_description = name + end + new_description = new_description .. "\n"..minetest.colorize(mcl_colors.YELLOW, S("(Temporary)")) + minetest.override_item(name, {description = new_description}) + end +end) diff --git a/mods/MISC/mcl_wip/mod.conf b/mods/MISC/mcl_wip/mod.conf index 4a180e5ff..e705379a1 100644 --- a/mods/MISC/mcl_wip/mod.conf +++ b/mods/MISC/mcl_wip/mod.conf @@ -1,4 +1,4 @@ name = mcl_wip author = Wuzzy description = Development mod for MineClone 2 which add a “WIP” (Work In Progress) comment to items which are considered to be very unfinished. -depends = mcl_core, mcl_fishing, mcl_maps, mcl_minecarts, doc_identifier, mobs_mc, mcl_minecarts, mcl_paintings, mcl_potions +depends = mcl_colors