From 9db3b97202bbd6894525df6b5f0dd6bd31296c4d Mon Sep 17 00:00:00 2001 From: kay27 Date: Tue, 22 Feb 2022 03:12:45 +0400 Subject: [PATCH] Add crying obsidian --- mods/ENTITIES/mcl_dripping/init.lua | 64 ++++++++++++++---- mods/ENTITIES/mcl_dripping/readme.txt | 59 ++++++++-------- mods/ITEMS/mcl_core/locale/template.txt | 2 + mods/ITEMS/mcl_core/nodes_base.lua | 13 ++++ .../textures/mcl_core_crying_obsidian.png | Bin 0 -> 250 bytes 5 files changed, 97 insertions(+), 41 deletions(-) create mode 100644 mods/ITEMS/mcl_core/textures/mcl_core_crying_obsidian.png diff --git a/mods/ENTITIES/mcl_dripping/init.lua b/mods/ENTITIES/mcl_dripping/init.lua index 57ba7ecfe..b1cf79796 100644 --- a/mods/ENTITIES/mcl_dripping/init.lua +++ b/mods/ENTITIES/mcl_dripping/init.lua @@ -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"}) \ No newline at end of file +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, +}) diff --git a/mods/ENTITIES/mcl_dripping/readme.txt b/mods/ENTITIES/mcl_dripping/readme.txt index afe35608e..583cb65d7 100644 --- a/mods/ENTITIES/mcl_dripping/readme.txt +++ b/mods/ENTITIES/mcl_dripping/readme.txt @@ -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) diff --git a/mods/ITEMS/mcl_core/locale/template.txt b/mods/ITEMS/mcl_core/locale/template.txt index da500ab8c..57b15ef82 100644 --- a/mods/ITEMS/mcl_core/locale/template.txt +++ b/mods/ITEMS/mcl_core/locale/template.txt @@ -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= diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index fe1ee58c2..ebae759ac 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -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."), diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_crying_obsidian.png b/mods/ITEMS/mcl_core/textures/mcl_core_crying_obsidian.png new file mode 100644 index 0000000000000000000000000000000000000000..6229fe08add9b25be90417e112520c5333b38758 GIT binary patch literal 250 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85sEXfH33KJw={CLG}_)Usv`g99-Od7E2_Q5`aQgo-U3d7N?UF z7BHx6So`n1M`v29nm3zUlBkh^fx(r36ArH1H}mny|18_C{{JX><;+Kx)i%ODNe9;l zEQ)as5SZ@Gv2((L;6g^X8ny>KCP|As6E83(Es|coD6LQZ|3+2=;cW~@rm4OAXYKd5 oLD|bz&vnP1mPLZ|nPwbh$V>5Na1*?97U&8FPgg&ebxsLQ06)1_&j0`b literal 0 HcmV?d00001