From ede29ba4fda37c33e2560d77c0060935497d637a Mon Sep 17 00:00:00 2001 From: VanessaE Date: Sun, 14 Feb 2021 22:48:48 -0500 Subject: [PATCH] add a new lava damage feature When enabled (gloopblocks_lava_damage = true in minetest.conf), lava will "bake" or "burn" neighboring nodes, turning them into other things. Affected volume is 3x3x3 around any given lava node. Nodes only transform from one thing to another, they do not actually catch fire (unless the game's fire mod does it). For example, sand will turn to either obsidian glass or moreblocks coal glass (to imply that it was a dirty process), sandstone will turn into a sandstone block, cobble into its respective stone, trees or wood into coal block, etc. Some things will just burn to ash straight away, others may take two or three stages before hitting their final form. Also items with "plantlike" draw type within the affected volume will simply disappear after a time (as if totally incinerated). Supported mods include cottages, castles, bakedclay, and a few more. Third-party mods can add support for lava damage by either adding entries in the form of `["oldnode"]="newnode"` to the `gloopblocks.lava_damage_nodes` table, or by adding `["somegroup"]="newnode"` to the `gloopblocks.lava_damage_nodes table` (the latter wants only a group name, without any "group:" prefix). Though I haven't tested it, it should be possible to overwrite existing entries in either table, but I highly discourage this, unless absolutely necessary. --- depends.txt | 7 ++ lava-handling.lua | 202 ++++++++++++++++++++++++++++++++ models/gloopblocks_ash_pile.obj | 197 +++++++++++++++++++++++++++++++ textures/gloopblocks_ashes.png | Bin 0 -> 564 bytes 4 files changed, 406 insertions(+) create mode 100644 models/gloopblocks_ash_pile.obj create mode 100644 textures/gloopblocks_ashes.png diff --git a/depends.txt b/depends.txt index 57849e5..dfc4299 100644 --- a/depends.txt +++ b/depends.txt @@ -13,3 +13,10 @@ nyancat? usesdirt? worldedit? signs_lib? +bakedclay? +farming? +wool? +bushes_classic? +dryplants? +bedrock? +cottages? diff --git a/lava-handling.lua b/lava-handling.lua index c9c5428..a2c083d 100644 --- a/lava-handling.lua +++ b/lava-handling.lua @@ -67,6 +67,208 @@ if minetest.setting_getbool("gloopblocks_lavacooling") ~= false then end end +-- Allows lava to "bake" neighboring nodes (or reduce them to ashes) +-- disabled by default. You probably don't want this on a creative server :-P + +if minetest.setting_getbool("gloopblocks_lava_damage") then + minetest.register_node("gloopblocks:ash_block", { + description = S("Block of ashes"), + tiles = {"gloopblocks_ashes.png"}, + groups = {crumbly = 3}, + sounds = default.node_sound_dirt_defaults(), + }) + + local cbox = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, -0.125, 0.5} + } + + minetest.register_node("gloopblocks:ash_pile", { + description = S("Pile of ashes"), + drawtype = "mesh", + mesh = "gloopblocks_ash_pile.obj", + tiles = {"gloopblocks_ashes.png"}, + selection_box = cbox, + collision_box = cbox, + groups = {crumbly = 3}, + sounds = default.node_sound_dirt_defaults(), + }) + + gloopblocks.lava_damage_nodes = { + ["default:cactus"] = "gloopblocks:ash_block", + ["default:coalblock"] = "gloopblocks:ash_block", + ["default:desert_cobble"] = "default:desert_stone", + ["default:desert_sandstone"] = "default:desert_sandstone_block", + ["default:gravel"] = "default:cobble", + ["default:ice"] = "default:snowblock", + ["default:permafrost"] = "default:dirt", + ["default:permafrost_with_moss"] = "default:dirt", + ["default:sandstone"] = "default:sandstone_block", + ["default:silver_sandstone"] = "default:silver_sandstone_block", + ["default:snowblock"] = "default:water_source", + + ["basic_materials:cement_block"] = "basic_materials:concrete_block", + ["bedrock:deepstone"] = "default:stone", + ["building_blocks:hardwood"] = "default:coalblock", + ["building_blocks:Tar"] = "gloopblocks:pavement", + ["bushes:basket_empty"] = "gloopblocks:ash_pile", + ["bushes:basket_blackberry"] = "gloopblocks:ash_pile", + ["bushes:basket_blueberry"] = "gloopblocks:ash_pile", + ["bushes:basket_gooseberry"] = "gloopblocks:ash_pile", + ["bushes:basket_mixed_berry"] = "gloopblocks:ash_pile", + ["bushes:basket_raspberry"] = "gloopblocks:ash_pile", + ["bushes:basket_strawberry"] = "gloopblocks:ash_pile", + ["caverealms:thin_ice"] = "default:water_source", + ["castle_masonry:rubble"] = "default:desert_stone", + ["usesdirt:dirt_stone"] = "default:stone", + ["usesdirt:dirt_cobble_stone"] = "default:stone", + ["wool:dark_grey"] = "gloopblocks:ash_pile" + } + + gloopblocks.lava_damage_groups = { + ["wood"] = "default:coalblock", + ["tree"] = "default:coalblock", + ["soil"] = "gloopblocks:basalt", + ["leaves"] = "gloopblocks:ash_pile", + ["fence"] = "gloopblocks:ash_pile", + ["stone"] = "default:stone", + } + + if minetest.get_modpath("cottages") then + gloopblocks.lava_damage_nodes["cottages:hay"] = "cottages:reet" + gloopblocks.lava_damage_nodes["cottages:hay_bale"] = "cottages:reet" + gloopblocks.lava_damage_nodes["cottages:hay_mat"] = "cottages:straw_mat" + gloopblocks.lava_damage_nodes["cottages:reet"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_black"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_brown"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_red"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_reet"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_straw"] = "cottages:roof_reet" + gloopblocks.lava_damage_nodes["cottages:roof_wood"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_connector_black"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_connector_brown"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_connector_red"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_connector_reet"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_connector_straw"] = "cottages:roof_connector_reet" + gloopblocks.lava_damage_nodes["cottages:roof_connector_wood"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_flat_black"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_flat_brown"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_flat_red"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_flat_reet"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_flat_straw"] = "cottages:roof_flat_reet" + gloopblocks.lava_damage_nodes["cottages:roof_flat_wood"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:straw_ground"] = "cottages:loam" + gloopblocks.lava_damage_nodes["cottages:loam"] = "default:dirt" + gloopblocks.lava_damage_nodes["cottages:feldweg"] = "default:dirt" + gloopblocks.lava_damage_nodes["cottages:feldweg_crossing"] = "default:dirt" + gloopblocks.lava_damage_nodes["cottages:feldweg_curve"] = "default:dirt" + gloopblocks.lava_damage_nodes["cottages:feldweg_end"] = "default:dirt" + gloopblocks.lava_damage_nodes["cottages:feldweg_slope"] = "default:dirt" + gloopblocks.lava_damage_nodes["cottages:feldweg_slope_long"] = "default:dirt" + gloopblocks.lava_damage_nodes["cottages:feldweg_t_junction"] = "default:dirt" + end + + if minetest.get_modpath("dryplants") then + gloopblocks.lava_damage_nodes["dryplants:wetreed"] = "dryplants:reed" + gloopblocks.lava_damage_nodes["dryplants:wetreed_slab"] = "dryplants:reed_slab" + gloopblocks.lava_damage_nodes["dryplants:wetreed_roof"] = "dryplants:reed_roof" + gloopblocks.lava_damage_nodes["dryplants:wetreed_roof_corner"] = "dryplants:reed_roof_corner" + gloopblocks.lava_damage_nodes["dryplants:wetreed_roof_corner_2"] = "dryplants:reed_roof_corner_2" + gloopblocks.lava_damage_nodes["dryplants:reed"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["dryplants:reed_slab"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["dryplants:reed_roof"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["dryplants:reed_roof_corner"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["dryplants:reed_roof_corner_2"] = "gloopblocks:ash_pile" + end + + if minetest.get_modpath("wool") then + gloopblocks.lava_damage_groups["wool"] = "wool:dark_grey" + end + + if minetest.get_modpath("bakedclay") then + gloopblocks.lava_damage_nodes["default:clay"] = "bakedclay:dark_grey" + gloopblocks.lava_damage_groups["bakedclay"] = "bakedclay:dark_grey" + else + gloopblocks.lava_damage_nodes["default:clay"] = "gloopblocks:basalt" + end + + if minetest.get_modpath("moreblocks") then + gloopblocks.lava_damage_groups["sand"] = "moreblocks:coal_glass" + else + gloopblocks.lava_damage_groups["sand"] = "default:obsidian_glass" + end + + if minetest.get_modpath("farming") then + gloopblocks.lava_damage_nodes["farming:soil_wet"] = "farming:soil" + end + + gloopblocks.lava_neighbors = { + { x=-1, y=-1, z=-1 }, + { x=-1, y=-1, z= 0 }, + { x=-1, y=-1, z= 1 }, + { x=-1, y= 0, z=-1 }, + { x=-1, y= 0, z= 0 }, + { x=-1, y= 0, z= 1 }, + { x=-1, y= 1, z=-1 }, + { x=-1, y= 1, z= 0 }, + { x=-1, y= 1, z= 1 }, + + { x= 0, y=-1, z=-1 }, + { x= 0, y=-1, z= 0 }, + { x= 0, y=-1, z= 1 }, + { x= 0, y= 0, z=-1 }, +-- { x= 0, y= 0, z= 0 }, -- will always be the lava node, so ignore this space + { x= 0, y= 0, z= 1 }, + { x= 0, y= 1, z=-1 }, + { x= 0, y= 1, z= 0 }, + { x= 0, y= 1, z= 1 }, + + { x= 1, y=-1, z=-1 }, + { x= 1, y=-1, z= 0 }, + { x= 1, y=-1, z= 1 }, + { x= 1, y= 0, z=-1 }, + { x= 1, y= 0, z= 0 }, + { x= 1, y= 0, z= 1 }, + { x= 1, y= 1, z=-1 }, + { x= 1, y= 1, z= 0 }, + { x= 1, y= 1, z= 1 }, + } + + minetest.register_abm({ + nodenames = {"default:lava_source", "default:lava_flowing"}, + interval = 5, + chance = 2, + action = function(pos, node, active_object_count, active_object_count_wider) + local r=gloopblocks.lava_neighbors[math.random(1, 26)] + local pos2 = { + x = pos.x + r.x, + y = pos.y + r.y, + z = pos.z + r.z + } + local newnode + local chknode = minetest.get_node(pos2) + local def = minetest.registered_items[chknode.name] + + if gloopblocks.lava_damage_nodes[chknode.name] then + newnode = gloopblocks.lava_damage_nodes[chknode.name] + elseif def and def.drawtype == "plantlike" then + newnode = "air" + else + for group, new in pairs(gloopblocks.lava_damage_groups) do + if minetest.get_item_group(chknode.name, group) > 0 then + newnode = new + break + end + end + end + + if newnode then + minetest.set_node(pos2, {name = newnode, param2 = chknode.param2}) + end + end + }) +end + if minetest.get_modpath("worldedit") then function gloopblocks.liquid_ungrief(pos1, pos2, name) local count diff --git a/models/gloopblocks_ash_pile.obj b/models/gloopblocks_ash_pile.obj new file mode 100644 index 0000000..5b9c084 --- /dev/null +++ b/models/gloopblocks_ash_pile.obj @@ -0,0 +1,197 @@ +# Blender v2.73 (sub 0) OBJ File: 'anthill.blend' +# www.blender.org +o Cylinder_Cylinder.001 +v 0.099056 -0.499969 -0.498228 +v 0.038417 -0.200463 -0.141682 +v 0.255808 -0.499933 -0.402046 +v 0.095605 -0.174690 -0.147239 +v 0.423075 -0.499913 -0.296918 +v 0.102439 -0.169033 -0.075679 +v 0.444026 -0.499843 -0.095234 +v 0.125298 -0.217477 -0.063343 +v 0.468682 -0.499958 0.074790 +v 0.157655 -0.214352 0.001348 +v 0.396548 -0.500000 0.246048 +v 0.133778 -0.189245 0.108513 +v 0.280708 -0.500000 0.383197 +v 0.070517 -0.218946 0.104754 +v 0.089852 -0.499943 0.434316 +v 0.048523 -0.205247 0.128681 +v -0.093309 -0.499902 0.467111 +v -0.039037 -0.211895 0.149030 +v -0.272965 -0.499875 0.396496 +v -0.108297 -0.175918 0.104100 +v -0.388317 -0.499877 0.239075 +v -0.139068 -0.179051 0.073370 +v -0.437531 -0.499999 0.063918 +v -0.141812 -0.255882 0.005117 +v -0.458429 -0.499805 -0.104397 +v -0.189265 -0.217436 -0.065303 +v -0.385597 -0.499914 -0.288584 +v -0.112692 -0.207830 -0.096879 +v -0.248347 -0.499927 -0.384586 +v -0.083136 -0.202256 -0.170048 +v -0.095346 -0.499958 -0.514449 +v -0.023049 -0.216681 -0.204058 +v 0.071880 -0.343843 -0.343933 +v 0.189128 -0.354687 -0.277980 +v 0.311273 -0.378789 -0.248498 +v 0.296760 -0.346318 -0.056661 +v 0.332231 -0.342427 0.044933 +v 0.259921 -0.360316 0.147910 +v 0.213270 -0.362883 0.253745 +v 0.059007 -0.360067 0.351374 +v -0.068448 -0.357957 0.335642 +v -0.164888 -0.343166 0.232553 +v -0.269761 -0.352370 0.140734 +v -0.367168 -0.370891 0.062326 +v -0.294491 -0.324099 -0.079712 +v -0.276314 -0.352585 -0.236032 +v -0.206169 -0.372829 -0.314307 +v -0.065547 -0.371444 -0.355380 +v 0.000709 -0.156135 -0.047193 +vt 0.572002 0.826281 +vt 0.535907 0.620231 +vt 0.597591 0.625892 +vt 0.604963 0.552988 +vt 0.830215 0.729053 +vt 0.629619 0.540419 +vt 0.814561 0.533613 +vt 0.664520 0.474514 +vt 0.638766 0.365335 +vt 0.774826 0.325198 +vt 0.570532 0.369165 +vt 0.724507 0.217375 +vt 0.546808 0.344788 +vt 0.452364 0.324057 +vt 0.420641 0.133939 +vt 0.377660 0.369831 +vt 0.316619 0.238965 +vt 0.344469 0.401138 +vt 0.203502 0.332509 +vt 0.341509 0.470674 +vt 0.290325 0.542416 +vt 0.176827 0.557096 +vt 0.372919 0.574586 +vt 0.196433 0.716353 +vt 0.404798 0.649130 +vt 0.469609 0.683778 +vt 0.272092 0.796098 +vt 0.770390 0.885486 +vt 0.973405 0.572910 +vt 0.591386 0.033412 +vt 0.226599 0.867698 +vt 0.423770 0.837943 +vt 0.601314 0.983475 +vt 0.078559 0.769893 +vt 0.000000 0.582245 +vt 0.098436 0.412390 +vt 0.075624 0.232320 +vt 0.200045 0.071942 +vt 0.558116 0.117912 +vt 0.922195 0.225217 +vt 0.852821 0.430110 +vt 0.698467 0.759089 +vt 0.495235 0.523967 +vt 0.391629 1.000000 +vt 0.022541 0.410768 +vt 0.797247 0.085491 +vt 0.393825 0.000000 +vt 0.950807 0.778383 +vt 1.000000 0.399692 +g Cylinder_Cylinder.001_None +s 1 +f 33/1 2/2 4/3 +f 4/3 6/4 35/5 +f 35/5 6/4 8/6 +f 36/7 8/6 10/8 +f 10/8 12/9 38/10 +f 12/9 14/11 39/12 +f 39/12 14/11 16/13 +f 16/13 18/14 41/15 +f 18/14 20/16 42/17 +f 20/16 22/18 43/19 +f 43/19 22/18 24/20 +f 24/20 26/21 45/22 +f 26/21 28/23 46/24 +f 46/24 28/23 30/25 +f 32/26 2/2 33/1 +f 47/27 30/25 32/26 +f 3/28 7/29 15/30 +f 29/31 47/27 48/32 +f 48/32 33/1 1/33 +f 27/34 46/24 47/27 +f 25/35 45/22 46/24 +f 44/36 45/22 25/35 +f 21/37 43/19 44/36 +f 42/17 43/19 21/37 +f 41/15 42/17 19/38 +f 15/30 40/39 41/15 +f 39/12 40/39 15/30 +f 11/40 38/10 39/12 +f 37/41 38/10 11/40 +f 7/29 36/7 37/41 +f 35/5 36/7 7/29 +f 3/28 34/42 35/5 +f 33/1 34/42 3/28 +f 4/3 2/2 49/43 +f 2/2 32/26 49/43 +f 32/26 30/25 49/43 +f 30/25 28/23 49/43 +f 28/23 26/21 49/43 +f 26/21 24/20 49/43 +f 24/20 22/18 49/43 +f 22/18 20/16 49/43 +f 20/16 18/14 49/43 +f 18/14 16/13 49/43 +f 16/13 14/11 49/43 +f 14/11 12/9 49/43 +f 12/9 10/8 49/43 +f 10/8 8/6 49/43 +f 8/6 6/4 49/43 +f 6/4 4/3 49/43 +f 34/42 33/1 4/3 +f 34/42 4/3 35/5 +f 36/7 35/5 8/6 +f 37/41 36/7 10/8 +f 37/41 10/8 38/10 +f 38/10 12/9 39/12 +f 40/39 39/12 16/13 +f 40/39 16/13 41/15 +f 41/15 18/14 42/17 +f 42/17 20/16 43/19 +f 44/36 43/19 24/20 +f 44/36 24/20 45/22 +f 45/22 26/21 46/24 +f 47/27 46/24 30/25 +f 48/32 32/26 33/1 +f 48/32 47/27 32/26 +f 29/31 31/44 1/33 +f 23/45 27/34 29/31 +f 27/34 23/45 25/35 +f 15/30 19/38 21/37 +f 11/40 13/46 15/30 +f 15/30 17/47 19/38 +f 3/28 23/45 29/31 +f 29/31 1/33 3/28 +f 3/28 5/48 7/29 +f 7/29 9/49 11/40 +f 23/45 15/30 21/37 +f 15/30 23/45 3/28 +f 15/30 7/29 11/40 +f 31/44 29/31 48/32 +f 31/44 48/32 1/33 +f 29/31 27/34 47/27 +f 27/34 25/35 46/24 +f 23/45 44/36 25/35 +f 23/45 21/37 44/36 +f 19/38 42/17 21/37 +f 17/47 41/15 19/38 +f 17/47 15/30 41/15 +f 13/46 39/12 15/30 +f 13/46 11/40 39/12 +f 9/49 37/41 11/40 +f 9/49 7/29 37/41 +f 5/48 35/5 7/29 +f 5/48 3/28 35/5 +f 1/33 33/1 3/28 diff --git a/textures/gloopblocks_ashes.png b/textures/gloopblocks_ashes.png new file mode 100644 index 0000000000000000000000000000000000000000..38a300087684b9804239eef4908ff554cdb6ea4d GIT binary patch literal 564 zcmV-40?Yl0P)nQsb0|Wgh@cuuN-az6Ax%6(aE8P2 z4u1d7_m9u#^XYVISr&$2k|b%GCI~{UR@-bgQ55k!4_4A1kru9r$B&+{mXVp;a_cmzRkxm^1F z{_%JO0ALtKQB)8FpwVb3iV{UpB9U0H*BFMGrg=J@T-P0s$G6+9*=(AoiR1X|^@0!r z2qDX|EXyVm3D5HwhDoJTj^hl6Lq$v|LgsC$v=HSoOfIw;QM|M1cD$u9uLp+ z-tTv@SoD2gQIy|1mdoY){a&e5IF7Sz8^n3X_4xw=e|i6P#;+&<0000