Add crying obsidian

This commit is contained in:
kay27 2022-02-22 03:12:45 +04:00
parent 1a4ec50939
commit 9db3b97202
5 changed files with 97 additions and 41 deletions

View File

@ -1,16 +1,24 @@
-- Dripping Water Mod
-- by kddekadenz
local math = math
-- License of code, textures & sounds: CC0
local function register_drop(liquid, glow, sound, nodes)
minetest.register_entity("mcl_dripping:drop_" .. liquid, {
local math_random = math.random
local all_dirs = {
{x = 0, y = 0, z = 1},
{x = 0, y = 1, z = 0},
{x = 1, y = 0, z = 0},
{x = 0, y = 0, z =-1},
{x = 0, y =-1, z = 0},
{x =-1, y = 0, z = 0},
}
local function register_drop_entity(substance, glow, sound, texture_file_name)
minetest.register_entity("mcl_dripping:drop_" .. substance, {
hp_max = 1,
physical = true,
collide_with_objects = false,
collisionbox = {-0.01, 0.01, -0.01, 0.01, 0.01, 0.01},
collisionbox = {-0.01, -0.01, -0.01, 0.01, 0.01, 0.01},
glow = glow,
pointable = false,
visual = "sprite",
@ -22,11 +30,18 @@ local function register_drop(liquid, glow, sound, nodes)
_dropped = false,
on_activate = function(self)
self.object:set_properties({
textures = {"[combine:2x2:" .. -math.random(1, 16) .. "," .. -math.random(1, 16) .. "=default_" .. liquid .. "_source_animated.png"}
textures = {
"[combine:2x2:"
.. -math_random(1, 16)
.. ","
.. -math_random(1, 16)
.. "="
.. (texture_file_name or ("default_" .. substance .. "_source_animated.png"))
}
})
end,
on_step = function(self, dtime)
local k = math.random(1, 222)
local k = math_random(1, 222)
local ownpos = self.object:get_pos()
if k == 1 then
self.object:set_acceleration(vector.new(0, -5, 0))
@ -38,7 +53,9 @@ local function register_drop(liquid, glow, sound, nodes)
local ent = self.object:get_luaentity()
if not ent._dropped then
ent._dropped = true
minetest.sound_play({name = "drippingwater_" .. sound .. "drip"}, {pos = ownpos, gain = 0.5, max_hear_distance = 8}, true)
if sound then
minetest.sound_play({name = "drippingwater_" .. sound .. "drip"}, {pos = ownpos, gain = 0.5, max_hear_distance = 8}, true)
end
end
if k < 3 then
self.object:remove()
@ -46,6 +63,10 @@ local function register_drop(liquid, glow, sound, nodes)
end
end,
})
end
local function register_liquid_drop(liquid, glow, sound, nodes)
register_drop_entity(liquid, glow, sound)
minetest.register_abm({
label = "Create drops",
nodenames = nodes,
@ -55,12 +76,31 @@ local function register_drop(liquid, glow, sound, nodes)
action = function(pos)
if minetest.get_item_group(minetest.get_node(vector.offset(pos, 0, 1, 0)).name, liquid) ~= 0
and minetest.get_node(vector.offset(pos, 0, -1, 0)).name == "air" then
local x, z = math.random(-45, 45) / 100, math.random(-45, 45) / 100
local x, z = math_random(-45, 45) / 100, math_random(-45, 45) / 100
minetest.add_entity(vector.offset(pos, x, -0.520, z), "mcl_dripping:drop_" .. liquid)
end
end,
})
end
register_drop("water", 1, "", {"group:opaque", "group:leaves"})
register_drop("lava", math.max(7, minetest.registered_nodes["mcl_core:lava_source"].light_source - 3), "lava", {"group:opaque"})
register_liquid_drop("water", 1, "", {"group:opaque", "group:leaves"})
register_liquid_drop("lava", math.max(7, minetest.registered_nodes["mcl_core:lava_source"].light_source - 3), "lava", {"group:opaque"})
register_drop_entity("crying_obsidian", 10, nil, "mcl_core_crying_obsidian.png")
minetest.register_abm({
label = "Create crying obsidian drops",
nodenames = {"mcl_core:crying_obsidian"},
neighbors = {"air"},
interval = 2,
chance = 22,
action = function(pos)
local i0 = math_random(1, 6)
for i = i0, i0 + 5 do
local dir = all_dirs[(i % 6) + 1]
if minetest.get_node(vector.add(pos, dir)).name == "air" then
minetest.add_entity(vector.offset(pos, dir.x * 0.52, dir.y * 0.52, dir.z * 0.52), "mcl_dripping:drop_crying_obsidian")
return
end
end
end,
})

View File

@ -1,29 +1,30 @@
Dripping Mod
by kddekadenz
modified for MineClone 2 by Wuzzy and NO11
Installing instructions:
1. Copy the mcl_dripping mod folder into games/gamemode/mods
2. Start game and enjoy :)
Manual:
-> drops are generated rarely under solid nodes
-> they will stay some time at the generated block and than they fall down
-> when they collide with the ground, a sound is played and they are destroyed
License:
code & sounds: CC0
Changelog:
16.04.2012 - first release
28.04.2012 - drops are now 3D; added lava drops; fixed generating of drops (not at edges now)
Dripping Mod
by kddekadenz
modified for MineClone 2 by Wuzzy and NO11
modified for MineClone 5 by kay27
Installing instructions:
1. Copy the mcl_dripping mod folder into games/gamemode/mods
2. Start game and enjoy :)
Manual:
-> drops are generated rarely under solid nodes
-> they will stay some time at the generated block and than they fall down
-> when they collide with the ground, a sound is played and they are destroyed
License:
code & sounds: CC0
Changelog:
16.04.2012 - first release
28.04.2012 - drops are now 3D; added lava drops; fixed generating of drops (not at edges now)

View File

@ -155,6 +155,8 @@ Oak Wood Planks=
Oak leaves are grown from oak trees.=
Obsidian=
Obsidian is an extremely hard mineral with an enourmous blast-resistance. Obsidian is formed when water meets lava.=
Crying Obsidian=
Crying obsidian is a luminous obsidian that can generate as part of ruined portals.=
One of the most common blocks in the world, almost the entire underground consists of stone. It sometimes contains ores. Stone may be created when water meets lava.=
Orange Stained Glass=
Packed Ice=

View File

@ -826,6 +826,19 @@ minetest.register_node("mcl_core:obsidian", {
end,
})
minetest.register_node("mcl_core:crying_obsidian", {
description = S("Crying Obsidian"),
_doc_items_longdesc = S("Crying obsidian is a luminous obsidian that can generate as part of ruined portals."),
tiles = {"default_obsidian.png^mcl_core_crying_obsidian.png"},
is_ground_content = false,
light_source = 10,
sounds = mcl_sounds.node_sound_stone_defaults(),
stack_max = 64,
groups = {pickaxey=5, building_block=1, material_stone=1},
_mcl_blast_resistance = 1200,
_mcl_hardness = 50,
})
minetest.register_node("mcl_core:ice", {
description = S("Ice"),
_doc_items_longdesc = S("Ice is a solid block usually found in cold areas. It melts near block light sources at a light level of 12 or higher. When it melts or is broken while resting on top of another block, it will turn into a water source."),

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B