0
0
Fork 0

Merge pull request 'master' (#4) from MineClone2/MineClone2:master into master

Reviewed-on: NO11/MineClone2#4
This commit is contained in:
NO11 2021-07-23 12:18:22 +00:00
commit 0a9ea7e46a
7 changed files with 55 additions and 7 deletions

View File

@ -52,17 +52,17 @@ Each mod must provide `mod.conf`.
Each mod which add API functions should store functions inside a global table named like the mod. Each mod which add API functions should store functions inside a global table named like the mod.
Public functions should not use self references but rather just access the table directly. Public functions should not use self references but rather just access the table directly.
Functions should be defined in this way: Functions should be defined in this way:
``` ```lua
function mcl_xyz.stuff(param) end function mcl_xyz.stuff(param) end
``` ```
Insteed of this way: Insteed of this way:
``` ```lua
mcl_xyz.stuff = function(param) end mcl_xyz.stuff = function(param) end
``` ```
Indentation must be unified, more likely with tabs. Indentation must be unified, more likely with tabs.
Time sensitive mods should make a local copy of most used API functions to improve performances. Time sensitive mods should make a local copy of most used API functions to improve performances.
``` ```lua
local vector = vector local vector = vector
local get_node = minetest.get_node local get_node = minetest.get_node
``` ```

View File

@ -0,0 +1,39 @@
local game = "mineclone"
local same_id = {
heads = { "skeleton", "zombie", "creeper", "wither_skeleton" },
mobitems = { "rabbit", "chicken" },
walls = {
"andesite", "brick", "cobble", "diorite", "endbricks",
"granite", "mossycobble", "netherbrick", "prismarine",
"rednetherbrick", "redsandstone", "sandstone",
"stonebrick", "stonebrickmossy",
},
wool = {
"black", "blue", "brown", "cyan", "green",
"grey", "light_blue", "lime", "magenta", "orange",
"pink", "purple", "red", "silver", "white", "yellow",
},
}
tt.register_snippet(function(itemstring)
local def = minetest.registered_items[itemstring]
local desc = def.description
local item_split = itemstring:find(":")
local new_id = game .. itemstring:sub(item_split)
for mod, ids in pairs(same_id) do
for _, id in pairs(ids) do
if itemstring == "mcl_" .. mod .. ":" .. id then
new_id = game .. ":" .. id .. "_" .. mod:gsub("s", "")
end
end
end
if new_id ~= game .. ":book_enchanted" then
minetest.register_alias_force(new_id, itemstring)
end
if minetest.settings:get_bool("mcl_item_id_debug", false) then
return new_id, "#555555"
end
end)
minetest.register_alias_force(game .. ":book_enchanted", "mcl_enchanting:book_enchanted")

View File

@ -0,0 +1,3 @@
name = mcl_item_id
author = NO11
depends = tt

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 409 B

View File

@ -1,4 +1,4 @@
name = mcl_portals name = mcl_portals
description = Adds buildable portals to the Nether and End dimensions. description = Adds buildable portals to the Nether and End dimensions.
depends = mcl_nether, mcl_end, mcl_particles, mcl_spawn depends = mcl_nether, mcl_end, mcl_particles, mcl_spawn, mcl_credits
optional_depends = awards, doc optional_depends = awards, doc

View File

@ -4,6 +4,8 @@ local table = table
local vector = vector local vector = vector
local math = math local math = math
local has_doc = minetest.get_modpath("doc")
-- Parameters -- Parameters
--local SPAWN_MIN = mcl_vars.mg_end_min+70 --local SPAWN_MIN = mcl_vars.mg_end_min+70
--local SPAWN_MAX = mcl_vars.mg_end_min+98 --local SPAWN_MAX = mcl_vars.mg_end_min+98
@ -339,7 +341,7 @@ minetest.register_node("mcl_portals:end_portal_frame_eye", {
_mcl_hardness = -1, _mcl_hardness = -1,
}) })
if minetest.get_modpath("doc") then if has_doc then
doc.add_entry_alias("nodes", "mcl_portals:end_portal_frame", "nodes", "mcl_portals:end_portal_frame_eye") doc.add_entry_alias("nodes", "mcl_portals:end_portal_frame", "nodes", "mcl_portals:end_portal_frame_eye")
end end
@ -366,7 +368,7 @@ minetest.override_item("mcl_end:ender_eye", {
end end
minetest.set_node(pointed_thing.under, { name = "mcl_portals:end_portal_frame_eye", param2 = node.param2 }) minetest.set_node(pointed_thing.under, { name = "mcl_portals:end_portal_frame_eye", param2 = node.param2 })
if minetest.get_modpath("doc") then if has_doc then
doc.mark_entry_as_revealed(user:get_player_name(), "nodes", "mcl_portals:end_portal_frame") doc.mark_entry_as_revealed(user:get_player_name(), "nodes", "mcl_portals:end_portal_frame")
end end
minetest.sound_play( minetest.sound_play(
@ -381,7 +383,7 @@ minetest.override_item("mcl_end:ender_eye", {
-- Epic 'portal open' sound effect that can be heard everywhere -- Epic 'portal open' sound effect that can be heard everywhere
minetest.sound_play("mcl_portals_open_end_portal", {gain=0.8}, true) minetest.sound_play("mcl_portals_open_end_portal", {gain=0.8}, true)
end_portal_area(ppos) end_portal_area(ppos)
if minetest.get_modpath("doc") then if has_doc then
doc.mark_entry_as_revealed(user:get_player_name(), "nodes", "mcl_portals:portal_end") doc.mark_entry_as_revealed(user:get_player_name(), "nodes", "mcl_portals:portal_end")
end end
end end

View File

@ -153,3 +153,7 @@ fix_doubleplants (Mcimport double plant fixes) bool true
# Allow players to create Minecraft-like maps. # Allow players to create Minecraft-like maps.
enable_real_maps (Enable Real Maps) bool true enable_real_maps (Enable Real Maps) bool true
[Debugging]
# If enabled, this will show the itemstring of an item in the description.
mcl_item_id_debug (Item ID Debug) bool false