0
0
Fork 0

Merge pull request 'mcl_wip (API and refactoring)' (#1265) from AFCMS/MineClone2:mcl-wip-refactoring into master

Reviewed-on: MineClone2/MineClone2#1265
This commit is contained in:
AFCMS 2021-03-07 19:51:49 +00:00
commit d274f6f444
21 changed files with 78 additions and 70 deletions

View File

@ -654,6 +654,8 @@ register_minecart(
{"mcl_minecarts:minecart", "mcl_chests:chest"},
nil, nil, false)
mcl_wip.register_wip_item("mcl_minecarts:chest_minecart")
-- Minecart with Furnace
register_minecart(
"mcl_minecarts:furnace_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",

View File

@ -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

View File

@ -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 = {

View File

@ -1,4 +1,5 @@
name = mcl_paintings
author = Wuzzy
description = The paintings mod for MCL2
depends = mcl_wip

View File

@ -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")

View File

@ -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

View File

@ -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")

View File

@ -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")

View File

@ -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

View File

@ -1 +1,2 @@
name = mcl_comparators
depends = mcl_wip

View File

@ -1,5 +0,0 @@
mcl_sounds
mcl_util
doc_items
mcl_worlds
mcl_structures

View File

@ -0,0 +1,2 @@
name = mcl_end
depends = screwdriver, mcl_sounds, mcl_util, doc_items, mcl_worlds, mcl_structures

View File

@ -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()

View File

@ -1 +1,2 @@
name = mcl_maps
depends = mcl_wip

View File

@ -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")

View File

@ -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

View File

@ -187,6 +187,7 @@ minetest.register_tool("screwdriver:screwdriver", {
end,
})
mcl_wip.register_wip_item("screwdriver:screwdriver")
minetest.register_craft({
output = "screwdriver:screwdriver",

View File

@ -0,0 +1,2 @@
name = screwdriver
depends = mcl_wip

View File

@ -106,4 +106,5 @@ if minetest.is_creative_enabled("") then
build_a_settlement(minp, maxp, math.random(0,32767))
end
})
mcl_wip.register_experimental_item("mcl_villages:tool")
end

View File

@ -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]]
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
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: "..wip_items[i])
minetest.log("error", "[mcl_wip] Unknown item: "..name)
break
end
local new_description = def.description
local new_groups = table.copy(def.groups)
if new_description == "" then
new_description = wip_items[i]
new_description = name
end
new_description = new_description .. "\n"..minetest.colorize(mcl_colors.RED, S("(WIP)"))
minetest.override_item(name, {description = new_description})
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 })
end
for i=1,#experimental_items do
local def = minetest.registered_items[experimental_items[i]]
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: "..experimental_items[i])
minetest.log("error", "[mcl_wip] Unknown item: "..name)
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 })
end
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)

View File

@ -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