mirror of
https://github.com/minetest-mods/nether.git
synced 2024-11-15 15:00:40 +01:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b51b831483 | ||
|
01b6f3c56d | ||
|
a6d1f55f0a | ||
|
d16b530685 |
|
@ -27,9 +27,11 @@ read_globals = {
|
||||||
"stairsplus",
|
"stairsplus",
|
||||||
"string.split",
|
"string.split",
|
||||||
table = { fields = { "copy", "getn" } },
|
table = { fields = { "copy", "getn" } },
|
||||||
|
"toolranks",
|
||||||
"vector",
|
"vector",
|
||||||
"VoxelArea",
|
"VoxelArea",
|
||||||
"VoxelManip",
|
"VoxelManip",
|
||||||
|
"walls",
|
||||||
xpanes = { fields = { "register_pane" } },
|
xpanes = { fields = { "register_pane" } },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
mod.conf
2
mod.conf
|
@ -1,4 +1,4 @@
|
||||||
name = nether
|
name = nether
|
||||||
description = Adds a deep underground realm with different mapgen that you can reach with obsidian portals.
|
description = Adds a deep underground realm with different mapgen that you can reach with obsidian portals.
|
||||||
depends = stairs, default
|
depends = stairs, default
|
||||||
optional_depends = moreblocks, mesecons, loot, dungeon_loot, doc_basics, fire, climate_api, ethereal, xpanes, walls
|
optional_depends = toolranks, moreblocks, mesecons, loot, dungeon_loot, doc_basics, fire, climate_api, ethereal, xpanes, walls
|
||||||
|
|
|
@ -2166,22 +2166,20 @@ function nether.unregister_portal(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
function nether.register_portal_ignition_item(item_name, ignition_failure_sound)
|
function nether.register_portal_ignition_item(item_name, ignition_failure_sound)
|
||||||
|
local old_on_place = minetest.registered_items[item_name].on_place or minetest.item_place
|
||||||
minetest.override_item(item_name, {
|
minetest.override_item(item_name, {
|
||||||
on_place = function(stack, placer, pt)
|
on_place = function(stack, placer, pt, ...)
|
||||||
local done = false
|
|
||||||
if pt.under and nether.is_frame_node[minetest.get_node(pt.under).name] then
|
if pt.under and nether.is_frame_node[minetest.get_node(pt.under).name] then
|
||||||
done = ignite_portal(pt.under, placer:get_player_name())
|
local done = ignite_portal(pt.under, placer:get_player_name())
|
||||||
if done and not minetest.settings:get_bool("creative_mode") then
|
if done and not minetest.settings:get_bool("creative_mode") then
|
||||||
stack:take_item()
|
stack:take_item()
|
||||||
end
|
end
|
||||||
end
|
|
||||||
if not done and ignition_failure_sound ~= nil then
|
if not done and ignition_failure_sound ~= nil then
|
||||||
minetest.sound_play(ignition_failure_sound, {pos = pt.under, max_hear_distance = 10})
|
minetest.sound_play(ignition_failure_sound, {pos = pt.under, max_hear_distance = 10})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
return stack
|
return stack
|
||||||
|
end
|
||||||
|
return old_on_place(stack, placer, pt, ...)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
37
tools.lua
37
tools.lua
|
@ -153,6 +153,38 @@ minetest.register_craft({
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
if minetest.get_modpath("toolranks") then
|
||||||
|
|
||||||
|
local function add_toolranks(name)
|
||||||
|
local nethertool_after_use = ItemStack(name):get_definition().after_use
|
||||||
|
toolranks.add_tool(name)
|
||||||
|
local toolranks_after_use = ItemStack(name):get_definition().after_use
|
||||||
|
|
||||||
|
if nethertool_after_use == nil or nethertool_after_use == toolranks_after_use then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.override_item(name, {
|
||||||
|
after_use = function(itemstack, user, node, digparams)
|
||||||
|
-- combine nethertool_after_use and toolranks_after_use by allowing
|
||||||
|
-- nethertool_after_use() to calculate the wear...
|
||||||
|
local initial_wear = itemstack:get_wear()
|
||||||
|
itemstack = nethertool_after_use(itemstack, user, node, digparams)
|
||||||
|
local wear = itemstack:get_wear() - initial_wear
|
||||||
|
itemstack:set_wear(initial_wear) -- restore/undo the wear
|
||||||
|
|
||||||
|
-- ...and have toolranks_after_use() apply the wear.
|
||||||
|
digparams.wear = wear
|
||||||
|
return toolranks_after_use(itemstack, user, node, digparams)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
add_toolranks("nether:pick_nether")
|
||||||
|
add_toolranks("nether:shovel_nether")
|
||||||
|
add_toolranks("nether:axe_nether")
|
||||||
|
add_toolranks("nether:sword_nether")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--===========================--
|
--===========================--
|
||||||
|
@ -352,10 +384,11 @@ minetest.register_tool("nether:lightstaff_eternal", {
|
||||||
sound = {breaks = "default_tool_breaks"},
|
sound = {breaks = "default_tool_breaks"},
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
if lightstaff_on_use(user, "#23F", 0) then -- was "#8088FF" or "#13F"
|
if lightstaff_on_use(user, "#23F", 0) -- was "#8088FF" or "#13F"
|
||||||
|
and not minetest.is_creative_enabled(user) then
|
||||||
-- The staff of Eternal Light wears out, to limit how much
|
-- The staff of Eternal Light wears out, to limit how much
|
||||||
-- a player can alter the nether with it.
|
-- a player can alter the nether with it.
|
||||||
itemstack:add_wear(65535 / (nether.lightstaff_uses - 1))
|
itemstack:add_wear_by_uses(nether.lightstaff_uses)
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user