mirror of
https://notabug.org/TenPlus1/protector.git
synced 2025-01-23 08:31:29 +01:00
Added MineClone2 support
This commit is contained in:
parent
5f6a6a201f
commit
7a6f598d19
@ -56,6 +56,7 @@ Change log:
|
||||
- 2.6 - Add protection against CSM tampering, updated Intllib support (thanks codexp), tweaked block textures
|
||||
- 2.7 - Remove protection field entity when protector has been dug
|
||||
- 2.8 - Added 'protector_show_interval' setting to minetest.conf [default is 5], make protection field glow in dark.
|
||||
- 2.9 - Added MineClone2 compatibility (missing default switches to alternate recipes etc.)
|
||||
|
||||
Lucky Blocks: 10
|
||||
|
||||
|
@ -29,7 +29,6 @@ minetest.register_chatcommand("protector_remove", {
|
||||
end
|
||||
|
||||
removal_names = param
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
@ -64,7 +63,6 @@ minetest.register_chatcommand("protector_replace", {
|
||||
end
|
||||
|
||||
replace_names = param
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
@ -106,7 +104,6 @@ minetest.register_abm({
|
||||
meta:set_string("owner", names[2])
|
||||
meta:set_string("infotext", S("Protection (owned by @1)", names[2]))
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -1,4 +1,4 @@
|
||||
default
|
||||
default?
|
||||
intllib?
|
||||
lucky_block?
|
||||
mesecons_mvps?
|
||||
|
@ -6,6 +6,9 @@
|
||||
local S = protector.intllib
|
||||
local F = minetest.formspec_escape
|
||||
|
||||
-- MineClone2 support
|
||||
local mcl = not minetest.registered_items["default:steel_ingot"]
|
||||
|
||||
-- Registers a door
|
||||
function register_door(name, def)
|
||||
def.groups.not_in_creative_inventory = 1
|
||||
@ -310,6 +313,14 @@ register_door(name, {
|
||||
sunlight = false,
|
||||
})
|
||||
|
||||
if mcl then
|
||||
minetest.register_craft({
|
||||
output = name,
|
||||
recipe = {
|
||||
{"mcl_doors:wooden_door", "mcl_core:gold_ingot"}
|
||||
}
|
||||
})
|
||||
else
|
||||
minetest.register_craft({
|
||||
output = name,
|
||||
recipe = {
|
||||
@ -325,6 +336,7 @@ minetest.register_craft({
|
||||
{"doors:door_wood", "default:copper_ingot"}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- Protected Steel Door
|
||||
|
||||
@ -343,6 +355,14 @@ register_door(name, {
|
||||
sunlight = false,
|
||||
})
|
||||
|
||||
if mcl then
|
||||
minetest.register_craft({
|
||||
output = name,
|
||||
recipe = {
|
||||
{"mcl_doors:iron_door", "mcl_core:gold_ingot"}
|
||||
}
|
||||
})
|
||||
else
|
||||
minetest.register_craft({
|
||||
output = name,
|
||||
recipe = {
|
||||
@ -358,6 +378,7 @@ minetest.register_craft({
|
||||
{"doors:door_steel", "default:copper_ingot"}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
----trapdoor----
|
||||
|
||||
@ -434,12 +455,19 @@ register_trapdoor("protector:trapdoor", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
if mcl then
|
||||
minetest.register_craft({
|
||||
output = 'protector:trapdoor 2',
|
||||
output = "protector:trapdoor",
|
||||
recipe = {
|
||||
{'group:wood', 'default:copper_ingot', 'group:wood'},
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'', '', ''},
|
||||
{"mcl_doors:trapdoor", "mcl_core:gold_ingot"}
|
||||
}
|
||||
})
|
||||
else
|
||||
minetest.register_craft({
|
||||
output = "protector:trapdoor 2",
|
||||
recipe = {
|
||||
{"group:wood", "default:copper_ingot", "group:wood"},
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
}
|
||||
})
|
||||
|
||||
@ -449,6 +477,7 @@ minetest.register_craft({
|
||||
{"doors:trapdoor", "default:copper_ingot"}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- Protected Steel Trapdoor
|
||||
|
||||
@ -465,11 +494,19 @@ register_trapdoor("protector:trapdoor_steel", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
if mcl then
|
||||
minetest.register_craft({
|
||||
output = "protector:trapdoor_steel",
|
||||
recipe = {
|
||||
{"mcl_doors:iron_trapdoor", "mcl_core:gold_ingot"}
|
||||
}
|
||||
})
|
||||
else
|
||||
minetest.register_craft({
|
||||
output = 'protector:trapdoor_steel',
|
||||
recipe = {
|
||||
{'default:copper_ingot', 'default:steel_ingot'},
|
||||
{'default:steel_ingot', 'default:steel_ingot'},
|
||||
{"default:copper_ingot", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:steel_ingot"},
|
||||
}
|
||||
})
|
||||
|
||||
@ -479,6 +516,7 @@ minetest.register_craft({
|
||||
{"doors:trapdoor_steel", "default:copper_ingot"}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- Protected Chest
|
||||
|
||||
@ -675,18 +713,27 @@ end)
|
||||
|
||||
-- Protected Chest recipes
|
||||
|
||||
if mcl then
|
||||
minetest.register_craft({
|
||||
output = 'protector:chest',
|
||||
output = "protector:chest",
|
||||
recipe = {
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{'group:wood', 'default:copper_ingot', 'group:wood'},
|
||||
{'group:wood', 'group:wood', 'group:wood'},
|
||||
{"mcl_chests:chest", "mcl_core:gold_ingot"},
|
||||
}
|
||||
})
|
||||
else
|
||||
minetest.register_craft({
|
||||
output = "protector:chest",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
{"group:wood", "default:copper_ingot", "group:wood"},
|
||||
{"group:wood", "group:wood", "group:wood"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'protector:chest',
|
||||
output = "protector:chest",
|
||||
recipe = {
|
||||
{'default:chest', 'default:copper_ingot', ''},
|
||||
{"default:chest", "default:copper_ingot"},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
10
hud.lua
10
hud.lua
@ -40,17 +40,15 @@ minetest.register_globalstep(function(dtime)
|
||||
hud_elem_type = "text",
|
||||
name = "Protector Area",
|
||||
number = 0xFFFF22,
|
||||
position = {x=0, y=0.95},
|
||||
offset = {x=8, y=-8},
|
||||
position = {x = 0, y = 0.95},
|
||||
offset = {x = 8, y = -8},
|
||||
text = hud_text,
|
||||
scale = {x=200, y=60},
|
||||
alignment = {x=1, y=-1},
|
||||
scale = {x = 200, y = 60},
|
||||
alignment = {x = 1, y = -1},
|
||||
})
|
||||
|
||||
return
|
||||
|
||||
else
|
||||
|
||||
player:hud_change(hud[name].id, "text", hud_text)
|
||||
end
|
||||
end
|
||||
|
22
init.lua
22
init.lua
@ -1,4 +1,13 @@
|
||||
|
||||
-- default support (for use with MineClone2 and other [games]
|
||||
default = default or {
|
||||
node_sound_stone_defaults = function(table) end,
|
||||
node_sound_wood_defaults = function(table) end,
|
||||
gui_bg = "",
|
||||
gui_bg_img = "",
|
||||
gui_slots = "",
|
||||
}
|
||||
|
||||
-- Load support for intllib.
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local S = dofile(MP .. "/intllib.lua")
|
||||
@ -441,6 +450,8 @@ minetest.register_node("protector:protect", {
|
||||
end,
|
||||
})
|
||||
|
||||
-- default recipe and alternative for MineClone2
|
||||
if minetest.registered_items["default:stone"] then
|
||||
minetest.register_craft({
|
||||
output = "protector:protect",
|
||||
recipe = {
|
||||
@ -449,7 +460,16 @@ minetest.register_craft({
|
||||
{"default:stone", "default:stone", "default:stone"},
|
||||
}
|
||||
})
|
||||
|
||||
else
|
||||
minetest.register_craft({
|
||||
output = "protector:protect",
|
||||
recipe = {
|
||||
{"mcl_core:stone", "mcl_core:stone", "mcl_core:stone"},
|
||||
{"mcl_core:stone", "mcl_core:gold_ingot", "mcl_core:stone"},
|
||||
{"mcl_core:stone", "mcl_core:stone", "mcl_core:stone"},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- protection logo
|
||||
minetest.register_node("protector:protect2", {
|
||||
|
12
tool.lua
12
tool.lua
@ -141,11 +141,17 @@ minetest.register_craftitem("protector:tool", {
|
||||
})
|
||||
|
||||
-- tool recipe
|
||||
local df = "default:steel_ingot"
|
||||
if not minetest.registered_items[df] then
|
||||
df = "mcl_core:iron_ingot"
|
||||
end
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
output = "protector:tool",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "protector:protect", "default:steel_ingot"},
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||
{df, df, df},
|
||||
{df, "protector:protect", df},
|
||||
{df, df, df},
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user