Skip to content

Commit

Permalink
Treasures (#50)
Browse files Browse the repository at this point in the history
* Add Netherrack slabs and walls

Also adds deep netherrack stairs, and deep nether brick stairs, slabs, inner stairs and outer stairs.
Adds 9 new nodes in total.

* Treasure: Nether pickaxe takes 10x less wear damage when mining netherrack

cracky-3 mining time of Nether pickaxe reduced from 0.4 to 0.3 to mine netherrack faster.
maxlevel of nether pickaxe dropped from 3 to 2 to increase wear damage with non-netherrack nodes.

* Treasure: Nether staff of light

Adds "Nether staff of Light" and "Nether staff of Eternal Light"
One is limited to 60 uses, and the other has unlimited uses but the glowstone it creates will only last for 40 seconds.
There are no crafting recipes as I hope these to eventually be treasure that can be found in the nether.

See the pull request (#50) for more discussion
  • Loading branch information
Treer committed Nov 27, 2021
1 parent 247ca08 commit d8e6a6a
Show file tree
Hide file tree
Showing 7 changed files with 409 additions and 21 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ right-click/used on the frame to activate it.

See portal_api.txt for how to create custom portals to your own realms.

Nether Portals can allow surface fast-travel.

This mod provides Nether basalts (natural, hewn, and chiseled) as nodes which
require a player to journey to the magma ocean to obtain, so these can be used
for gating progression through a game. For example, a portal to another realm
Expand All @@ -24,8 +26,7 @@ the nether first, or basalt might be a crafting ingredient required to reach
a particular branch of the tech-tree.

Netherbrick tools are provided (pick, shovel, axe, & sword), see tools.lua

Nether Portals can allow surface fast-travel.
The Nether pickaxe has a 10x bonus again wear when mining netherrack.


## License of source code:
Expand All @@ -50,9 +51,11 @@ SOFTWARE.
### [Public Domain Dedication (CC0 1.0)](https://creativecommons.org/publicdomain/zero/1.0/)

* `nether_portal_teleport.ogg` is a timing adjusted version of "teleport" by [outroelison](https://freesound.org/people/outroelison), used under CC0 1.0
* `nether_rack_destroy.ogg` is from "Rock destroy" by [Bertsz](https://freesound.org/people/Bertsz/), used under CC0 1.0

### [Attribution 3.0 Unported (CC BY 3.0)](https://creativecommons.org/licenses/by/3.0/)

* `nether_lightstaff.ogg` is "Fire Burst" by [SilverIllusionist](https://freesound.org/people/SilverIllusionist/), 2019
* `nether_portal_ambient.ogg` & `nether_portal_ambient.0.ogg` are extractions from "Deep Cinematic Rumble Stereo" by [Patrick Lieberkind](http://www.lieberkindvisuals.dk), used under CC BY 3.0
* `nether_portal_extinguish.ogg` is an extraction from "Tight Laser Weapon Hit Scifi" by [damjancd](https://freesound.org/people/damjancd), used under CC BY 3.0
* `nether_portal_ignite.ogg` is a derivative of "Flame Ignition" by [hykenfreak](https://freesound.org/people/hykenfreak), used under CC BY 3.0. "Nether Portal ignite" is licensed under CC BY 3.0 by Treer.
Expand All @@ -64,6 +67,7 @@ SOFTWARE.
* `nether_fumarole.ogg`: Treer, 2020
* `nether_lava_bubble`* (files starting with "nether_lava_bubble"): Treer, 2020
* `nether_lava_crust_animated.png`: Treer, 2019-2020
* `nether_lightstaff.png`: Treer, 2021
* `nether_particle_anim`* (files starting with "nether_particle_anim"): Treer, 2019
* `nether_portal_ignition_failure.ogg`: Treer, 2019
* `nether_smoke_puff.png`: Treer, 2020
Expand Down
2 changes: 1 addition & 1 deletion mod.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = nether
description = Adds a deep underground realm with different mapgen that you can reach with obsidian portals.
depends = stairs, default
optional_depends = moreblocks, mesecons, loot, dungeon_loot, doc_basics, fire, climate_api, ethereal
optional_depends = moreblocks, mesecons, loot, dungeon_loot, doc_basics, fire, climate_api, ethereal, walls
190 changes: 175 additions & 15 deletions nodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,118 @@ nether.register_wormhole_node("nether:portal_alt", {
})


--== Transmogrification functions ==--
-- Functions enabling selected nodes to be temporarily transformed into other nodes.
-- (so the light staff can temporarily turn netherrack into glowstone)

-- Swaps the node at `nodePos` with `newNode`, unless `newNode` is nil in which
-- case the node is swapped back to its original type.
-- `monoSimpleSoundSpec` is optional.
-- returns true if a node was transmogrified
nether.magicallyTransmogrify_node = function(nodePos, playerName, newNode, monoSimpleSoundSpec, isPermanent)

local meta = minetest.get_meta(nodePos)
local playerEyePos = nodePos -- fallback value in case the player no longer exists
local player = minetest.get_player_by_name(playerName)
if player ~= nil then
local playerPos = player:get_pos()
playerEyePos = vector.add(playerPos, {x = 0, y = 1.5, z = 0}) -- not always the cameraPos, e.g. 3rd person mode.
end

local oldNode = minetest.get_node(nodePos)
if oldNode.name == "air" then
-- the node has been mined or otherwise destroyed, abort the operation
return false
end
local oldNodeDef = minetest.registered_nodes[oldNode.name] or minetest.registered_nodes["air"]

local specialFXSize = 1 -- a specialFXSize of 1 is for full SFX, 0.5 is half-sized
local returningToNormal = newNode == nil
if returningToNormal then
-- This is the transmogrified node returning back to normal - a more subdued animation
specialFXSize = 0.5
-- read what the node used to be from the metadata
newNode = {
name = meta:get_string("transmogrified_name"),
param1 = meta:get_string("transmogrified_param1"),
param2 = meta:get_string("transmogrified_param2")
}
if newNode.name == "" then
minetest.log("warning", "nether.magicallyTransmogrify_node() invoked to restore node which wasn't transmogrified")
return false
end
end

local soundSpec = monoSimpleSoundSpec
if soundSpec == nil and oldNodeDef.sounds ~= nil then
soundSpec = oldNodeDef.sounds.dug or oldNodeDef.sounds.dig
if soundSpec == "__group" then soundSpec = "default_dig_cracky" end
end
if soundSpec ~= nil then
minetest.sound_play(soundSpec, {pos = nodePos, max_hear_distance = 50})
end

-- Start the particlespawner nearer the player's side of the node to create
-- more initial occlusion for an illusion of the old node breaking apart / falling away.
local dirToPlayer = vector.normalize(vector.subtract(playerEyePos, nodePos))
local impactPos = vector.add(nodePos, vector.multiply(dirToPlayer, 0.5))
local velocity = 1 + specialFXSize
minetest.add_particlespawner({
amount = 50 * specialFXSize,
time = 0.1,
minpos = vector.add(impactPos, -0.3),
maxpos = vector.add(impactPos, 0.3),
minvel = {x = -velocity, y = -velocity, z = -velocity},
maxvel = {x = velocity, y = 3 * velocity, z = velocity}, -- biased upward to counter gravity in the initial stages
minacc = {x=0, y=-10, z=0},
maxacc = {x=0, y=-10, z=0},
minexptime = 1.5 * specialFXSize,
maxexptime = 3 * specialFXSize,
minsize = 0.5,
maxsize = 5,
node = {name = oldNodeDef.name},
glow = oldNodeDef.light_source
})

if returningToNormal or isPermanent then
-- clear the metadata that indicates the node is transformed
meta:set_string("transmogrified_name", "")
meta:set_int("transmogrified_param1", 0)
meta:set_int("transmogrified_param2", 0)
else
-- save the original node so it can be restored
meta:set_string("transmogrified_name", oldNode.name)
meta:set_int("transmogrified_param1", oldNode.param1)
meta:set_int("transmogrified_param2", oldNode.param2)
end

minetest.swap_node(nodePos, newNode)
return true
end


local function transmogrified_can_dig (pos, player)
if minetest.get_meta(pos):get_string("transmogrified_name") ~= "" then
-- This node was temporarily transformed into its current form
-- revert it back, rather than allow the player to mine transmogrified nodes.
local playerName = ""
if player ~= nil then playerName = player:get_player_name() end
nether.magicallyTransmogrify_node(pos, playerName)
return false
end
return true
end



-- Nether nodes

minetest.register_node("nether:rack", {
description = S("Netherrack"),
tiles = {"nether_rack.png"},
is_ground_content = true,
groups = {cracky = 3, level = 2},
-- setting workable_with_nether_tools reduces the wear on nether:pick_nether when mining this node
groups = {cracky = 3, level = 2, workable_with_nether_tools = 3},
sounds = default.node_sound_stone_defaults(),
})

Expand All @@ -81,7 +186,8 @@ minetest.register_node("nether:rack_deep", {
_doc_items_longdesc = S("Netherrack from deep in the mantle"),
tiles = {"nether_rack_deep.png"},
is_ground_content = true,
groups = {cracky = 3, level = 2},
-- setting workable_with_nether_tools reduces the wear on nether:pick_nether when mining this node
groups = {cracky = 3, level = 2, workable_with_nether_tools = 3},
sounds = default.node_sound_stone_defaults(),
})

Expand All @@ -103,6 +209,7 @@ minetest.register_node("nether:glowstone", {
paramtype = "light",
groups = {cracky = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_glass_defaults(),
can_dig = transmogrified_can_dig, -- to ensure glowstone temporarily created by the lightstaff can't be kept
})

-- Deep glowstone, found in the mantle / central magma layers
Expand All @@ -114,6 +221,7 @@ minetest.register_node("nether:glowstone_deep", {
paramtype = "light",
groups = {cracky = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_glass_defaults(),
can_dig = transmogrified_can_dig, -- to ensure glowstone temporarily created by the lightstaff can't be kept
})

minetest.register_node("nether:brick", {
Expand Down Expand Up @@ -175,37 +283,89 @@ minetest.register_node("nether:brick_deep", {

-- Register stair and slab

stairs.register_stair_and_slab(
"nether_brick",
"nether:brick",
{cracky = 2, level = 2},
{"nether_brick.png"},
S("Nether Stair"),
S("Nether Slab"),
default.node_sound_stone_defaults(),
nil,
S("Inner Nether Stair"),
S("Outer Nether Stair")
-- Nether bricks can be made into stairs, slabs, inner stairs, and outer stairs

stairs.register_stair_and_slab( -- this function also registers inner and outer stairs
"nether_brick", -- subname
"nether:brick", -- recipeitem
{cracky = 2, level = 2}, -- groups
{"nether_brick.png"}, -- images
S("Nether Stair"), -- desc_stair
S("Nether Slab"), -- desc_slab
minetest.registered_nodes["nether:brick"].sounds, -- sounds
false, -- worldaligntex
S("Inner Nether Stair"), -- desc_stair_inner
S("Outer Nether Stair") -- desc_stair_outer
)

stairs.register_stair_and_slab( -- this function also registers inner and outer stairs
"nether_brick_deep", -- subname
"nether:brick_deep", -- recipeitem
{cracky = 2, level = 2}, -- groups
{"nether_brick_deep.png"}, -- images
S("Deep Nether Stair"), -- desc_stair
S("Deep Nether Slab"), -- desc_slab
minetest.registered_nodes["nether:brick_deep"].sounds, -- sounds
false, -- worldaligntex
S("Inner Deep Nether Stair"), -- desc_stair_inner
S("Outer Deep Nether Stair") -- desc_stair_outer
)

-- Netherrack can be shaped into stairs, slabs and walls

stairs.register_stair(
"netherrack",
"nether:rack",
{cracky = 2, level = 2},
{"nether_rack.png"},
S("Netherrack stair"),
default.node_sound_stone_defaults()
minetest.registered_nodes["nether:rack"].sounds
)
stairs.register_slab( -- register a slab without adding inner and outer stairs
"netherrack",
"nether:rack",
{cracky = 2, level = 2},
{"nether_rack.png"},
S("Deep Netherrack slab"),
minetest.registered_nodes["nether:rack"].sounds
)

stairs.register_stair(
"netherrack_deep",
"nether:rack_deep",
{cracky = 2, level = 2},
{"nether_rack_deep.png"},
S("Deep Netherrack stair"),
minetest.registered_nodes["nether:rack_deep"].sounds
)
stairs.register_slab( -- register a slab without adding inner and outer stairs
"netherrack_deep",
"nether:rack_deep",
{cracky = 2, level = 2},
{"nether_rack_deep.png"},
S("Deep Netherrack slab"),
minetest.registered_nodes["nether:rack_deep"].sounds
)

-- Connecting walls
if minetest.get_modpath("walls") and minetest.global_exists("walls") and walls.register ~= nil then
walls.register("nether:rack_wall", "A Netherrack wall", "nether_rack.png", "nether:rack", minetest.registered_nodes["nether:rack"].sounds)
walls.register("nether:rack_deep_wall", "A Deep Netherrack wall", "nether_rack_deep.png", "nether:rack_deep", minetest.registered_nodes["nether:rack_deep"].sounds)
end

-- StairsPlus

if minetest.get_modpath("moreblocks") then
-- Registers about 49 different shapes of nether brick, replacing the stairs & slabs registered above.
-- (This could also be done for deep nether brick, but I've left that out to avoid a precedent of 49 new
-- nodes every time the nether gets a new material. Nether structures won't be able to use them because
-- they can't depend on moreblocks)
stairsplus:register_all(
"nether", "brick", "nether:brick", {
description = S("Nether Brick"),
groups = {cracky = 2, level = 2},
tiles = {"nether_brick.png"},
sounds = default.node_sound_stone_defaults(),
sounds = minetest.registered_nodes["nether:brick"].sounds,
})
end

Expand Down
Binary file added sounds/nether_lightstaff.ogg
Binary file not shown.
Binary file added sounds/nether_rack_destroy.ogg
Binary file not shown.
Binary file added textures/nether_lightstaff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d8e6a6a

Please sign in to comment.