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 -- Dripping Water Mod
-- by kddekadenz -- by kddekadenz
local math = math
-- License of code, textures & sounds: CC0 -- License of code, textures & sounds: CC0
local function register_drop(liquid, glow, sound, nodes) local math_random = math.random
minetest.register_entity("mcl_dripping:drop_" .. liquid, {
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, hp_max = 1,
physical = true, physical = true,
collide_with_objects = false, 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, glow = glow,
pointable = false, pointable = false,
visual = "sprite", visual = "sprite",
@ -22,11 +30,18 @@ local function register_drop(liquid, glow, sound, nodes)
_dropped = false, _dropped = false,
on_activate = function(self) on_activate = function(self)
self.object:set_properties({ 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, end,
on_step = function(self, dtime) on_step = function(self, dtime)
local k = math.random(1, 222) local k = math_random(1, 222)
local ownpos = self.object:get_pos() local ownpos = self.object:get_pos()
if k == 1 then if k == 1 then
self.object:set_acceleration(vector.new(0, -5, 0)) self.object:set_acceleration(vector.new(0, -5, 0))
@ -38,14 +53,20 @@ local function register_drop(liquid, glow, sound, nodes)
local ent = self.object:get_luaentity() local ent = self.object:get_luaentity()
if not ent._dropped then if not ent._dropped then
ent._dropped = true ent._dropped = true
if sound then
minetest.sound_play({name = "drippingwater_" .. sound .. "drip"}, {pos = ownpos, gain = 0.5, max_hear_distance = 8}, true) minetest.sound_play({name = "drippingwater_" .. sound .. "drip"}, {pos = ownpos, gain = 0.5, max_hear_distance = 8}, true)
end end
end
if k < 3 then if k < 3 then
self.object:remove() self.object:remove()
end end
end end
end, end,
}) })
end
local function register_liquid_drop(liquid, glow, sound, nodes)
register_drop_entity(liquid, glow, sound)
minetest.register_abm({ minetest.register_abm({
label = "Create drops", label = "Create drops",
nodenames = nodes, nodenames = nodes,
@ -55,12 +76,31 @@ local function register_drop(liquid, glow, sound, nodes)
action = function(pos) action = function(pos)
if minetest.get_item_group(minetest.get_node(vector.offset(pos, 0, 1, 0)).name, liquid) ~= 0 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 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) minetest.add_entity(vector.offset(pos, x, -0.520, z), "mcl_dripping:drop_" .. liquid)
end end
end, end,
}) })
end end
register_drop("water", 1, "", {"group:opaque", "group:leaves"}) register_liquid_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("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

@ -2,6 +2,7 @@ Dripping Mod
by kddekadenz by kddekadenz
modified for MineClone 2 by Wuzzy and NO11 modified for MineClone 2 by Wuzzy and NO11
modified for MineClone 5 by kay27
Installing instructions: Installing instructions:

View File

@ -155,6 +155,8 @@ Oak Wood Planks=
Oak leaves are grown from oak trees.= Oak leaves are grown from oak trees.=
Obsidian= Obsidian=
Obsidian is an extremely hard mineral with an enourmous blast-resistance. Obsidian is formed when water meets lava.= 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.= 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= Orange Stained Glass=
Packed Ice= Packed Ice=

View File

@ -826,6 +826,19 @@ minetest.register_node("mcl_core:obsidian", {
end, 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", { minetest.register_node("mcl_core:ice", {
description = S("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."), _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