From 063595ac3c59ac22933324a240cb3a3a0a9145b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Wed, 15 Apr 2020 13:27:29 +0200 Subject: [PATCH 01/30] Change blast resistance of nodes in mcl_core The new blast resistance values are copied from the Minecraft wiki. https://minecraft.gamepedia.com/Explosion --- mods/ITEMS/mcl_core/nodes_base.lua | 106 +++++++++++------------ mods/ITEMS/mcl_core/nodes_cactuscane.lua | 2 +- mods/ITEMS/mcl_core/nodes_climb.lua | 4 +- mods/ITEMS/mcl_core/nodes_glass.lua | 4 +- mods/ITEMS/mcl_core/nodes_liquid.lua | 8 +- mods/ITEMS/mcl_core/nodes_misc.lua | 8 +- mods/ITEMS/mcl_core/nodes_trees.lua | 8 +- 7 files changed, 70 insertions(+), 70 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index 6c47dd3f3..a8efc0cad 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -20,7 +20,7 @@ minetest.register_node("mcl_core:stone", { groups = {pickaxey=1, stone=1, building_block=1, material_stone=1}, drop = 'mcl_core:cobble', sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -34,7 +34,7 @@ minetest.register_node("mcl_core:stone_with_coal", { groups = {pickaxey=1, building_block=1, material_stone=1}, drop = 'mcl_core:coal_lump', sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, _mcl_hardness = 3, }) @@ -47,7 +47,7 @@ minetest.register_node("mcl_core:stone_with_iron", { groups = {pickaxey=3, building_block=1, material_stone=1}, drop = 'mcl_core:stone_with_iron', sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, _mcl_hardness = 3, }) @@ -61,7 +61,7 @@ minetest.register_node("mcl_core:stone_with_gold", { groups = {pickaxey=4, building_block=1, material_stone=1}, drop = "mcl_core:stone_with_gold", sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, _mcl_hardness = 3, }) @@ -93,7 +93,7 @@ minetest.register_node("mcl_core:stone_with_redstone", { sounds = mcl_sounds.node_sound_stone_defaults(), on_punch = redstone_ore_activate, on_walk_over = redstone_ore_activate, -- Uses walkover mod - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, _mcl_hardness = 3, }) @@ -131,7 +131,7 @@ minetest.register_node("mcl_core:stone_with_redstone_lit", { on_timer = function(pos, elapsed) minetest.swap_node(pos, {name="mcl_core:stone_with_redstone"}) end, - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, _mcl_hardness = 3, }) @@ -153,7 +153,7 @@ minetest.register_node("mcl_core:stone_with_lapis", { } }, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, _mcl_hardness = 3, }) @@ -166,7 +166,7 @@ minetest.register_node("mcl_core:stone_with_emerald", { groups = {pickaxey=4, building_block=1, material_stone=1}, drop = "mcl_core:emerald", sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, _mcl_hardness = 3, }) @@ -179,7 +179,7 @@ minetest.register_node("mcl_core:stone_with_diamond", { groups = {pickaxey=4, building_block=1, material_stone=1}, drop = "mcl_core:diamond", sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, _mcl_hardness = 3, }) @@ -191,7 +191,7 @@ minetest.register_node("mcl_core:stonebrick", { groups = {pickaxey=1, stone=1, stonebrick=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), is_ground_content = false, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -203,7 +203,7 @@ minetest.register_node("mcl_core:stonebrickcarved", { groups = {pickaxey=1, stone=1, stonebrick=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), is_ground_content = false, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -215,7 +215,7 @@ minetest.register_node("mcl_core:stonebrickcracked", { groups = {pickaxey=1, stone=1, stonebrick=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), is_ground_content = false, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -227,7 +227,7 @@ minetest.register_node("mcl_core:stonebrickmossy", { groups = {pickaxey=1, stone=1, stonebrick=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), is_ground_content = false, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -239,7 +239,7 @@ minetest.register_node("mcl_core:stone_smooth", { groups = {pickaxey=1, stone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), is_ground_content = false, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -251,7 +251,7 @@ minetest.register_node("mcl_core:granite", { stack_max = 64, groups = {pickaxey=1, stone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -263,7 +263,7 @@ minetest.register_node("mcl_core:granite_smooth", { is_ground_content = false, groups = {pickaxey=1, stone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -275,7 +275,7 @@ minetest.register_node("mcl_core:andesite", { stack_max = 64, groups = {pickaxey=1, stone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -299,7 +299,7 @@ minetest.register_node("mcl_core:diorite", { stack_max = 64, groups = {pickaxey=1, stone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -311,7 +311,7 @@ minetest.register_node("mcl_core:diorite_smooth", { stack_max = 64, groups = {pickaxey=1, stone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -344,7 +344,7 @@ minetest.register_node("mcl_core:dirt_with_grass", { return mcl_core.on_snowable_construct(pos) end, _mcl_snowed = "mcl_core:dirt_with_grass_snow", - _mcl_blast_resistance = 3, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.6, }) mcl_core.register_snowed_node("mcl_core:dirt_with_grass_snow", "mcl_core:dirt_with_grass", nil, nil, true) @@ -368,7 +368,7 @@ minetest.register_node("mcl_core:grass_path", { sounds = mcl_sounds.node_sound_dirt_defaults({ footstep = {name="default_grass_footstep", gain=0.4}, }), - _mcl_blast_resistance = 3.25, + _mcl_blast_resistance = 0.65, _mcl_hardness = 0.6, }) @@ -387,7 +387,7 @@ minetest.register_node("mcl_core:mycelium", { on_construct = mcl_core.on_snowable_construct, _mcl_snowed = "mcl_core:mycelium_snow", - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.6, }) mcl_core.register_snowed_node("mcl_core:mycelium_snow", "mcl_core:mycelium") @@ -403,7 +403,7 @@ minetest.register_node("mcl_core:podzol", { sounds = mcl_sounds.node_sound_dirt_defaults(), on_construct = mcl_core.on_snowable_construct, _mcl_snowed = "mcl_core:podzol_snow", - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.6, }) mcl_core.register_snowed_node("mcl_core:podzol_snow", "mcl_core:podzol") @@ -417,7 +417,7 @@ minetest.register_node("mcl_core:dirt", { stack_max = 64, groups = {handy=1,shovely=1, dirt=1,soil=1, soil_sapling=2, soil_sugarcane=1, cultivatable=2, enderman_takable=1, building_block=1}, sounds = mcl_sounds.node_sound_dirt_defaults(), - _mcl_blast_resistance = 3, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) @@ -429,7 +429,7 @@ minetest.register_node("mcl_core:coarse_dirt", { stack_max = 64, groups = {handy=1,shovely=1, dirt=3,soil=1, soil_sugarcane=1, cultivatable=1, enderman_takable=1, building_block=1}, sounds = mcl_sounds.node_sound_dirt_defaults(), - _mcl_blast_resistance = 3, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) @@ -450,7 +450,7 @@ minetest.register_node("mcl_core:gravel", { sounds = mcl_sounds.node_sound_dirt_defaults({ footstep = {name="default_gravel_footstep", gain=0.45}, }), - _mcl_blast_resistance = 3, + _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, }) @@ -464,7 +464,7 @@ minetest.register_node("mcl_core:sand", { stack_max = 64, groups = {handy=1,shovely=1, falling_node=1, sand=1, soil_sugarcane=1, enderman_takable=1, building_block=1, material_sand=1}, sounds = mcl_sounds.node_sound_sand_defaults(), - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) @@ -477,7 +477,7 @@ minetest.register_node("mcl_core:sandstone", { stack_max = 64, groups = {pickaxey=1, sandstone=1, normal_sandstone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 0.8, _mcl_hardness = 0.8, }) @@ -489,7 +489,7 @@ minetest.register_node("mcl_core:sandstonesmooth", { stack_max = 64, groups = {pickaxey=1, sandstone=1, normal_sandstone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 0.8, _mcl_hardness = 0.8, }) @@ -501,7 +501,7 @@ minetest.register_node("mcl_core:sandstonecarved", { stack_max = 64, groups = {pickaxey=1, sandstone=1, normal_sandstone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 0.8, _mcl_hardness = 0.8, }) @@ -514,7 +514,7 @@ minetest.register_node("mcl_core:sandstonesmooth2", { stack_max = 64, groups = {pickaxey=1, sandstone=1, normal_sandstone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 0.8, _mcl_hardness = 0.8, }) @@ -528,7 +528,7 @@ minetest.register_node("mcl_core:redsand", { stack_max = 64, groups = {handy=1,shovely=1, falling_node=1, sand=1, soil_sugarcane=1, enderman_takable=1, building_block=1, material_sand=1}, sounds = mcl_sounds.node_sound_sand_defaults(), - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) @@ -540,7 +540,7 @@ minetest.register_node("mcl_core:redsandstone", { stack_max = 64, groups = {pickaxey=1, sandstone=1, red_sandstone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 0.8, _mcl_hardness = 0.8, }) @@ -552,7 +552,7 @@ minetest.register_node("mcl_core:redsandstonesmooth", { stack_max = 64, groups = {pickaxey=1, sandstone=1, red_sandstone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 0.8, _mcl_hardness = 0.8, }) @@ -564,7 +564,7 @@ minetest.register_node("mcl_core:redsandstonecarved", { stack_max = 64, groups = {pickaxey=1, sandstone=1, red_sandstone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 0.8, _mcl_hardness = 0.8, }) @@ -576,7 +576,7 @@ minetest.register_node("mcl_core:redsandstonesmooth2", { stack_max = 64, groups = {pickaxey=1, sandstone=1, red_sandstone=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 0.8, _mcl_hardness = 0.8, }) @@ -592,7 +592,7 @@ minetest.register_node("mcl_core:clay", { groups = {handy=1,shovely=1, enderman_takable=1, building_block=1}, drop = 'mcl_core:clay_lump 4', sounds = mcl_sounds.node_sound_dirt_defaults(), - _mcl_blast_resistance = 3, + _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, }) @@ -605,7 +605,7 @@ minetest.register_node("mcl_core:brick_block", { stack_max = 64, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 2, }) @@ -621,7 +621,7 @@ minetest.register_node("mcl_core:bedrock", { is_ground_content = false, on_blast = function() end, drop = '', - _mcl_blast_resistance = 18000000, + _mcl_blast_resistance = 3600000, _mcl_hardness = -1, -- Eternal fire on top of bedrock, if in the End dimension @@ -658,7 +658,7 @@ minetest.register_node("mcl_core:cobble", { stack_max = 64, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 2, }) @@ -670,7 +670,7 @@ minetest.register_node("mcl_core:mossycobble", { stack_max = 64, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 2, }) @@ -682,7 +682,7 @@ minetest.register_node("mcl_core:coalblock", { stack_max = 64, groups = {pickaxey=1, flammable=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 5, }) @@ -694,7 +694,7 @@ minetest.register_node("mcl_core:ironblock", { stack_max = 64, groups = {pickaxey=2, building_block=1}, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 5, }) @@ -706,7 +706,7 @@ minetest.register_node("mcl_core:goldblock", { stack_max = 64, groups = {pickaxey=4, building_block=1}, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 5, }) @@ -718,7 +718,7 @@ minetest.register_node("mcl_core:diamondblock", { stack_max = 64, groups = {pickaxey=4, building_block=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 5, }) @@ -730,7 +730,7 @@ minetest.register_node("mcl_core:lapisblock", { stack_max = 64, groups = {pickaxey=3, building_block=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, _mcl_hardness = 3, }) @@ -742,7 +742,7 @@ minetest.register_node("mcl_core:emeraldblock", { stack_max = 64, groups = {pickaxey=4, building_block=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 5, }) @@ -754,7 +754,7 @@ minetest.register_node("mcl_core:obsidian", { sounds = mcl_sounds.node_sound_stone_defaults(), stack_max = 64, groups = {pickaxey=5, building_block=1, material_stone=1}, - _mcl_blast_resistance = 6000, + _mcl_blast_resistance = 1200, _mcl_hardness = 50, }) @@ -774,7 +774,7 @@ minetest.register_node("mcl_core:ice", { after_dig_node = function(pos, oldnode) mcl_core.melt_ice(pos) end, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) @@ -787,7 +787,7 @@ minetest.register_node("mcl_core:packed_ice", { groups = {handy=1,pickaxey=1, slippery=3, building_block=1}, drop = "", sounds = mcl_sounds.node_sound_glass_defaults(), - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) @@ -851,7 +851,7 @@ for i=0,3 do local timer = minetest.get_node_timer(pos) timer:start(1.5) end, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) @@ -970,7 +970,7 @@ for i=1,8 do on_place = on_place, after_destruct = mcl_core.after_snow_destruct, drop = "mcl_throwing:snowball "..(i+1), - _mcl_blast_resistance = 0.5, + _mcl_blast_resistance = 0.1, _mcl_hardness = 0.1, }) end @@ -987,7 +987,7 @@ minetest.register_node("mcl_core:snowblock", { on_construct = mcl_core.on_snow_construct, after_destruct = mcl_core.after_snow_destruct, drop = "mcl_throwing:snowball 4", - _mcl_blast_resistance = 1, + _mcl_blast_resistance = 0.2, _mcl_hardness = 0.2, }) diff --git a/mods/ITEMS/mcl_core/nodes_cactuscane.lua b/mods/ITEMS/mcl_core/nodes_cactuscane.lua index e8555f148..277cc565f 100644 --- a/mods/ITEMS/mcl_core/nodes_cactuscane.lua +++ b/mods/ITEMS/mcl_core/nodes_cactuscane.lua @@ -42,7 +42,7 @@ minetest.register_node("mcl_core:cactus", { if not node_below then return false end return (node_below.name == "mcl_core:cactus" or minetest.get_item_group(node_below.name, "sand") == 1) end), - _mcl_blast_resistance = 2, + _mcl_blast_resistance = 0.4, _mcl_hardness = 0.4, }) diff --git a/mods/ITEMS/mcl_core/nodes_climb.lua b/mods/ITEMS/mcl_core/nodes_climb.lua index 5167d0828..8839b0120 100644 --- a/mods/ITEMS/mcl_core/nodes_climb.lua +++ b/mods/ITEMS/mcl_core/nodes_climb.lua @@ -81,7 +81,7 @@ minetest.register_node("mcl_core:ladder", { return itemstack end, - _mcl_blast_resistance = 2, + _mcl_blast_resistance = 0.4, _mcl_hardness = 0.4, on_rotate = rotate_climbable, }) @@ -164,7 +164,7 @@ minetest.register_node("mcl_core:vine", { end, - _mcl_blast_resistance = 1, + _mcl_blast_resistance = 0.2, _mcl_hardness = 0.2, on_rotate = false, }) diff --git a/mods/ITEMS/mcl_core/nodes_glass.lua b/mods/ITEMS/mcl_core/nodes_glass.lua index 3ac2cb394..87e9a7863 100644 --- a/mods/ITEMS/mcl_core/nodes_glass.lua +++ b/mods/ITEMS/mcl_core/nodes_glass.lua @@ -14,7 +14,7 @@ minetest.register_node("mcl_core:glass", { groups = {handy=1, glass=1, building_block=1, material_glass=1}, sounds = mcl_sounds.node_sound_glass_defaults(), drop = "", - _mcl_blast_resistance = 1.5, + _mcl_blast_resistance = 0.3, _mcl_hardness = 0.3, }) @@ -49,7 +49,7 @@ function mcl_core.add_stained_glass(desc, recipeitem, colorgroup, color) groups = {handy=1, glass=1, building_block=1, material_glass=1}, sounds = mcl_sounds.node_sound_glass_defaults(), drop = "", - _mcl_blast_resistance = 1.5, + _mcl_blast_resistance = 0.3, _mcl_hardness = 0.3, }) diff --git a/mods/ITEMS/mcl_core/nodes_liquid.lua b/mods/ITEMS/mcl_core/nodes_liquid.lua index 85ba4c9ef..ac938c80d 100644 --- a/mods/ITEMS/mcl_core/nodes_liquid.lua +++ b/mods/ITEMS/mcl_core/nodes_liquid.lua @@ -49,7 +49,7 @@ minetest.register_node("mcl_core:water_flowing", { liquid_range = 7, post_effect_color = {a=209, r=0x03, g=0x3C, b=0x5C}, groups = { water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1, freezes=1, melt_around=1, dig_by_piston=1}, - _mcl_blast_resistance = 500, + _mcl_blast_resistance = 100, -- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode _mcl_hardness = -1, }) @@ -93,7 +93,7 @@ S("• When water is directly below lava, the water turns into stone."), post_effect_color = {a=209, r=0x03, g=0x3C, b=0x5C}, stack_max = 64, groups = { water=3, liquid=3, puts_out_fire=1, freezes=1, not_in_creative_inventory=1, dig_by_piston=1}, - _mcl_blast_resistance = 500, + _mcl_blast_resistance = 100, -- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode _mcl_hardness = -1, }) @@ -139,7 +139,7 @@ minetest.register_node("mcl_core:lava_flowing", { _mcl_node_death_message = lava_death_messages, post_effect_color = {a=255, r=208, g=73, b=10}, groups = { lava=3, liquid=2, destroys_items=1, not_in_creative_inventory=1, dig_by_piston=1}, - _mcl_blast_resistance = 500, + _mcl_blast_resistance = 100, -- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode _mcl_hardness = -1, }) @@ -194,7 +194,7 @@ S("• When lava is directly above water, the water turns into stone."), post_effect_color = {a=255, r=208, g=73, b=10}, stack_max = 64, groups = { lava=3, liquid=2, destroys_items=1, not_in_creative_inventory=1, dig_by_piston=1}, - _mcl_blast_resistance = 500, + _mcl_blast_resistance = 100, -- Hardness intentionally set to infinite instead of 100 (Minecraft value) to avoid problems in creative mode _mcl_hardness = -1, }) diff --git a/mods/ITEMS/mcl_core/nodes_misc.lua b/mods/ITEMS/mcl_core/nodes_misc.lua index 43161b446..a252bf931 100644 --- a/mods/ITEMS/mcl_core/nodes_misc.lua +++ b/mods/ITEMS/mcl_core/nodes_misc.lua @@ -17,7 +17,7 @@ minetest.register_node("mcl_core:bone_block", { groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), on_rotate = on_rotate, - _mcl_blast_resistance = 10, + _mcl_blast_resistance = 2, _mcl_hardness = 2, }) @@ -76,7 +76,7 @@ minetest.register_node("mcl_core:cobweb", { drop = "mcl_mobitems:string", _mcl_shears_drop = true, sounds = mcl_sounds.node_sound_leaves_defaults(), - _mcl_blast_resistance = 20, + _mcl_blast_resistance = 4, _mcl_hardness = 4, }) @@ -135,7 +135,7 @@ minetest.register_node("mcl_core:barrier", { groups = {creative_breakable=1, not_in_creative_inventory = 1, not_solid = 1 }, on_blast = function() end, drop = "", - _mcl_blast_resistance = 18000003, + _mcl_blast_resistance = 36000008, _mcl_hardness = -1, after_place_node = function (pos, placer, itemstack, pointed_thing) if placer == nil then @@ -195,7 +195,7 @@ minetest.register_node("mcl_core:realm_barrier", { groups = {not_in_creative_inventory = 1, not_solid = 1 }, on_blast = function() end, drop = "", - _mcl_blast_resistance = 18000003, + _mcl_blast_resistance = 36000008, _mcl_hardness = -1, -- Prevent placement to protect player from screwing up the world, because the node is not pointable and hard to get rid of. node_placement_prediction = "", diff --git a/mods/ITEMS/mcl_core/nodes_trees.lua b/mods/ITEMS/mcl_core/nodes_trees.lua index ad162e5b6..ea18132e2 100644 --- a/mods/ITEMS/mcl_core/nodes_trees.lua +++ b/mods/ITEMS/mcl_core/nodes_trees.lua @@ -20,7 +20,7 @@ local register_tree_trunk = function(subname, description_trunk, description_bar groups = {handy=1,axey=1, tree=1, flammable=2, building_block=1, material_wood=1}, sounds = mcl_sounds.node_sound_wood_defaults(), on_rotate = on_rotate, - _mcl_blast_resistance = 10, + _mcl_blast_resistance = 2, _mcl_hardness = 2, }) @@ -35,7 +35,7 @@ local register_tree_trunk = function(subname, description_trunk, description_bar sounds = mcl_sounds.node_sound_wood_defaults(), is_ground_content = false, on_rotate = on_rotate, - _mcl_blast_resistance = 10, + _mcl_blast_resistance = 2, _mcl_hardness = 2, }) @@ -58,7 +58,7 @@ local register_wooden_planks = function(subname, description, tiles) is_ground_content = false, groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1, material_wood=1}, sounds = mcl_sounds.node_sound_wood_defaults(), - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, _mcl_hardness = 2, }) end @@ -108,7 +108,7 @@ local register_leaves = function(subname, description, longdesc, tiles, drop1, d drop = drop, _mcl_shears_drop = true, sounds = mcl_sounds.node_sound_leaves_defaults(), - _mcl_blast_resistance = 1, + _mcl_blast_resistance = 0.2, _mcl_hardness = 0.2, }) end From 1d5c11f68391caad31bffbe474b56160cd7af2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Wed, 15 Apr 2020 14:15:07 +0200 Subject: [PATCH 02/30] Add mcl_explosions for ray traced explosions Code has been adapted from the Minetest explosions API mod to have Minecraft-like explosion mechanics and work with MineClone 2. --- mods/CORE/mcl_explosions/description.txt | 1 + mods/CORE/mcl_explosions/init.lua | 266 +++++++++++++++++++++++ 2 files changed, 267 insertions(+) create mode 100644 mods/CORE/mcl_explosions/description.txt create mode 100644 mods/CORE/mcl_explosions/init.lua diff --git a/mods/CORE/mcl_explosions/description.txt b/mods/CORE/mcl_explosions/description.txt new file mode 100644 index 000000000..a9d5288b5 --- /dev/null +++ b/mods/CORE/mcl_explosions/description.txt @@ -0,0 +1 @@ +This mod adds a common API to create explosions. diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua new file mode 100644 index 000000000..6909bdc6a --- /dev/null +++ b/mods/CORE/mcl_explosions/init.lua @@ -0,0 +1,266 @@ +--[[ .__ .__ + ____ ___ _________ | | ____ _____|__| ____ ____ ______ + _/ __ \\ \/ /\____ \| | / _ \/ ___/ |/ _ \ / \ / ___/ + \ ___/ > < | |_> > |_( <_> )___ \| ( <_> ) | \\___ \ + \___ >__/\_ \| __/|____/\____/____ >__|\____/|___| /____ > + \/ \/|__| \/ \/ \/ + + Explosion API mod for Minetest (adapted to MineClone 2) + + This mod is based on the Minetest explosion API mod, but has been changed + to have the same explosion mechanics as Minecraft and work with MineClone. + The computation-intensive parts of the mod has been optimized to allow for + larger explosions and faster world updating. + + This mod was created by Elias Astrom and is released + under the LGPLv2.1 license. +--]] + + +mcl_explosions = {} + +-- Saved sphere explosion shapes for various radiuses +local sphere_shapes = {} + +-- Saved node definitions in table using cid-keys for faster look-up. +local node_br = {} + +local AIR_CID = minetest.get_content_id('air') + +-- The step length for the rays (Minecraft uses 0.3) +local STEP_LENGTH = 0.3 + +minetest.after(0, function() + -- Store blast resistance values by content ids to improve performance. + for name, def in pairs(minetest.registered_nodes) do + node_br[minetest.get_content_id(name)] = def._mcl_blast_resistance or 0 + end +end) + +-- Compute the rays which make up a sphere with radius. Returns a list of rays +-- which can be used to trace explosions. This function is not efficient +-- (especially for larger radiuses), so the generated rays for various radiuses +-- should be cached and reused. +-- +-- Should be possible to improve by using a midpoint circle algorithm multiple +-- times to create the sphere, currently uses more of a brute-force approach. +local function compute_sphere_rays(radius) + local rays = {} + local sphere = {} + + for y = -radius, radius do + for z = -radius, radius do + for x = -radius, 0, 1 do + local d = x * x + y * y + z * z + if d <= radius * radius then + local pos = { x = x, y = y, z = z } + sphere[minetest.hash_node_position(pos)] = pos + break + end + end + end + end + + for y = -radius, radius do + for z = -radius, radius do + for x = radius, 0, -1 do + local d = x * x + y * y + z * z + if d <= radius * radius then + local pos = { x = x, y = y, z = z } + sphere[minetest.hash_node_position(pos)] = pos + break + end + end + end + end + + for x = -radius, radius do + for z = -radius, radius do + for y = -radius, 0, 1 do + local d = x * x + y * y + z * z + if d <= radius * radius then + local pos = { x = x, y = y, z = z } + sphere[minetest.hash_node_position(pos)] = pos + break + end + end + end + end + + for x = -radius, radius do + for z = -radius, radius do + for y = radius, 0, -1 do + local d = x * x + y * y + z * z + if d <= radius * radius then + local pos = { x = x, y = y, z = z } + sphere[minetest.hash_node_position(pos)] = pos + break + end + end + end + end + + for x = -radius, radius do + for y = -radius, radius do + for z = -radius, 0, 1 do + local d = x * x + y * y + z * z + if d <= radius * radius then + local pos = { x = x, y = y, z = z } + sphere[minetest.hash_node_position(pos)] = pos + break + end + end + end + end + + for x = -radius, radius do + for y = -radius, radius do + for z = radius, 0, -1 do + local d = x * x + y * y + z * z + if d <= radius * radius then + local pos = { x = x, y = y, z = z } + sphere[minetest.hash_node_position(pos)] = pos + break + end + end + end + end + + for _, pos in pairs(sphere) do + rays[#rays + 1] = vector.normalize(pos) + end + + return rays +end + +-- Get position from hash. This should be identical to +-- 'minetest.get_position_from_hash' but is used in case the hashing function +-- would change. +local function get_position_from_hash(hash) + local pos = {} + pos.x = (hash % 65536) - 32768 + hash = math.floor(hash / 65536) + pos.y = (hash % 65536) - 32768 + hash = math.floor(hash / 65536) + pos.z = (hash % 65536) - 32768 + return pos +end + +-- Traces the rays of an explosion, and updates the environment. +-- +-- Parameters: +-- pos - Where the rays in the explosion should start from +-- strength - The strength of each ray +-- raydirs - The directions for each ray +-- radius - The maximum distance each ray will go +-- drop_chance - Chance that destroy nodes drop their items +-- (becomes '1.0 / strength' if unspecified) +-- +-- Note that this function has been optimized, it contains code which has been +-- inlined to avoid function calls and unnecessary table creation. This was +-- measured to give a significant performance increase. +local function trace_explode(pos, strength, raydirs, radius, drop_chance) + local vm = minetest.get_voxel_manip() + + local emin, emax = vm:read_from_map(vector.subtract(pos, radius), + vector.add(pos, radius)) + local emin_x = emin.x + local emin_y = emin.y + local emin_z = emin.z + + local ystride = (emax.x - emin_x + 1) + local zstride = ystride * (emax.y - emin_y + 1) + local pos_x = pos.x + local pos_y = pos.y + local pos_z = pos.z + + local area = VoxelArea:new { + MinEdge = emin, + MaxEdge = emax + } + local data = vm:get_data() + local destroy = {} + + -- Trace rays + for i = 1, #raydirs do + local rpos_x = pos.x + local rpos_y = pos.y + local rpos_z = pos.z + local rdir_x = raydirs[i].x + local rdir_y = raydirs[i].y + local rdir_z = raydirs[i].z + local rstr = (0.7 + math.random() * 0.6) * strength + + for r = 0, math.ceil(radius * (1.0 / STEP_LENGTH)) do + local npos_x = math.floor(rpos_x + 0.5) + local npos_y = math.floor(rpos_y + 0.5) + local npos_z = math.floor(rpos_z + 0.5) + local idx = (npos_z - emin_z) * zstride + (npos_y - emin_y) * ystride + + npos_x - emin_x + 1 + + local cid = data[idx] + local br = node_br[cid] + local hash = (npos_z + 32768) * 65536 * 65536 + + (npos_y + 32768) * 65536 + + npos_x + 32768 + + rpos_x = rpos_x + STEP_LENGTH * rdir_x + rpos_y = rpos_y + STEP_LENGTH * rdir_y + rpos_z = rpos_z + STEP_LENGTH * rdir_z + + rstr = rstr - 0.75 * STEP_LENGTH - (br + 0.3) * STEP_LENGTH + + if rstr <= 0 then + break + end + + if cid ~= AIR_CID then + destroy[hash] = idx + end + end + end + + if drop_chance == nil then + drop_chance = 1 / strength + end + + -- Remove destroyed blocks and drop items + for hash, idx in pairs(destroy) do + if math.random() <= drop_chance then + local name = minetest.get_name_from_content_id(data[idx]) + local drop = minetest.get_node_drops(name, "") + for _, item in ipairs(drop) do + if type(item) == "string" then + minetest.add_item(get_position_from_hash(hash), item) + end + end + end + data[idx] = AIR_CID + end + + -- Log explosion + minetest.log('action', 'Explosion at ' .. minetest.pos_to_string(pos) .. + ' with strength ' .. strength .. ' and radius ' .. radius) + + -- Update environment + vm:set_data(data) + vm:write_to_map(data) + vm:update_liquids() +end + +-- Create an explosion with strength at pos. +-- +-- Parameters: +-- pos - The position where the explosion originates from +-- strength - The blast strength of the explosion (a TNT explosion uses 4) +function mcl_explosions.explode(pos, strength) + -- The maximum blast radius (in the air) + local radius = math.ceil(1.3 * strength / (0.3 * 0.75) * 0.3) + + if not sphere_shapes[radius] then + sphere_shapes[radius] = compute_sphere_rays(radius) + end + shape = sphere_shapes[radius] + + trace_explode(pos, strength, shape, radius) +end From 77c95fe8c31c2b71d0be439a81d6cc69e20bda36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Wed, 15 Apr 2020 20:30:12 +0200 Subject: [PATCH 03/30] Add particles and sounds from explosions --- mods/CORE/mcl_explosions/init.lua | 51 ++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 6909bdc6a..a18f56513 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -133,6 +133,29 @@ local function compute_sphere_rays(radius) return rays end +-- Add particles from explosion +-- +-- Parameters: +-- pos - The position of the explosion +-- radius - The radius of the explosion +local function add_particles(pos, radius) + minetest.add_particlespawner({ + amount = 64, + time = 0.125, + minpos = pos, + maxpos = pos, + minvel = {x = -radius, y = -radius, z = -radius}, + maxvel = {x = radius, y = radius, z = radius}, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 0.5, + maxexptime = 1.0, + minsize = radius * 0.5, + maxsize = radius * 1.0, + texture = "tnt_smoke.png", + }) +end + -- Get position from hash. This should be identical to -- 'minetest.get_position_from_hash' but is used in case the hashing function -- would change. @@ -153,8 +176,7 @@ end -- strength - The strength of each ray -- raydirs - The directions for each ray -- radius - The maximum distance each ray will go --- drop_chance - Chance that destroy nodes drop their items --- (becomes '1.0 / strength' if unspecified) +-- drop_chance - The chance that destroyed nodes will drop their items -- -- Note that this function has been optimized, it contains code which has been -- inlined to avoid function calls and unnecessary table creation. This was @@ -220,10 +242,6 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) end end - if drop_chance == nil then - drop_chance = 1 / strength - end - -- Remove destroyed blocks and drop items for hash, idx in pairs(destroy) do if math.random() <= drop_chance then @@ -253,7 +271,14 @@ end -- Parameters: -- pos - The position where the explosion originates from -- strength - The blast strength of the explosion (a TNT explosion uses 4) -function mcl_explosions.explode(pos, strength) +-- info - Table containing information about explosion. +-- +-- Values in info: +-- drop_chance - If specified becomes the drop chance of all nodes in the +-- explosion (defaults to 1.0 / strength) +-- no_sound - If true then the explosion will not play a sound +-- no_particle - If true then the explosion will not create particles +function mcl_explosions.explode(pos, strength, info) -- The maximum blast radius (in the air) local radius = math.ceil(1.3 * strength / (0.3 * 0.75) * 0.3) @@ -262,5 +287,15 @@ function mcl_explosions.explode(pos, strength) end shape = sphere_shapes[radius] - trace_explode(pos, strength, shape, radius) + trace_explode(pos, strength, shape, radius, (info and info.drop_chance) or 1 / strength) + + if not (info and info.no_sound) then + add_particles(pos, radius) + end + if not (info and info.no_particle) then + minetest.sound_play("tnt_explode", { + pos = pos, gain = 1.0, + max_hear_distance = strength * 16 + }, true) + end end From ca7c8c23c79c0c892cdea53ade613fcaf44892e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Thu, 16 Apr 2020 23:05:50 +0200 Subject: [PATCH 04/30] Add entity damage and player knockback Could not find a way to add knockback to entities. After adding a velocity to them they will just slide around indefinitely. Because of this, knockback is only enabled on players for now. --- mods/CORE/mcl_explosions/init.lua | 128 +++++++++++++++++++++++++++--- mods/ITEMS/mcl_tnt/init.lua | 5 ++ 2 files changed, 123 insertions(+), 10 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index a18f56513..225c2e770 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -24,16 +24,21 @@ local sphere_shapes = {} -- Saved node definitions in table using cid-keys for faster look-up. local node_br = {} +local node_on_blast = {} local AIR_CID = minetest.get_content_id('air') -- The step length for the rays (Minecraft uses 0.3) local STEP_LENGTH = 0.3 +-- How many rays to compute entity exposure to explosion +local N_EXPOSURE_RAYS = 16 + minetest.after(0, function() -- Store blast resistance values by content ids to improve performance. for name, def in pairs(minetest.registered_nodes) do node_br[minetest.get_content_id(name)] = def._mcl_blast_resistance or 0 + node_on_blast[minetest.get_content_id(name)] = def.on_blast end end) @@ -203,7 +208,7 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) local data = vm:get_data() local destroy = {} - -- Trace rays + -- Trace rays for environment destruction for i = 1, #raydirs do local rpos_x = pos.x local rpos_y = pos.y @@ -237,23 +242,126 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) end if cid ~= AIR_CID then - destroy[hash] = idx + destroy[hash] = idx + end + end + end + + -- Entities in radius of explosion + local punch_radius = 2 * strength + local objs = minetest.get_objects_inside_radius(pos, punch_radius) + + -- Trace rays for entity damage + for _, obj in pairs(objs) do + -- Object position and direction to explosion center + local opos = obj:get_pos() + + if obj:get_luaentity() ~= nil or obj:is_player() then + local collisionbox = nil + + if obj:is_player() then + collisionbox = { -0.3, 0.0, -0.3, 0.3, 1.77, 0.3 } + elseif obj:get_luaentity().name then + local def = minetest.registered_entities[obj:get_luaentity().name] + collisionbox = def.collisionbox + end + + if collisionbox then + -- Create rays from random points in the collision box + local x1 = collisionbox[1] * 2 + local y1 = collisionbox[2] * 2 + local z1 = collisionbox[3] * 2 + local x2 = collisionbox[4] * 2 + local y2 = collisionbox[5] * 2 + local z2 = collisionbox[6] * 2 + local x_len = math.abs(x2 - x1) + local y_len = math.abs(y2 - y1) + local z_len = math.abs(z2 - z1) + + -- Move object position to the center of its bounding box + opos.x = opos.x + x1 + x2 + opos.y = opos.y + y1 + y2 + opos.z = opos.z + z1 + z2 + + -- Count number of rays from collision box which are unobstructed + local count = N_EXPOSURE_RAYS + + for i = 1, N_EXPOSURE_RAYS do + local rpos_x = opos.x + math.random() * x_len - x_len / 2 + local rpos_y = opos.y + math.random() * y_len - y_len / 2 + local rpos_z = opos.z + math.random() * z_len - z_len / 2 + local rdir_x = pos.x - rpos_x + local rdir_y = pos.y - rpos_y + local rdir_z = pos.z - rpos_z + local rdir_len = math.hypot(rdir_x, math.hypot(rdir_y, rdir_z)) + rdir_x = rdir_x / rdir_len + rdir_y = rdir_y / rdir_len + rdir_z = rdir_z / rdir_len + + for i=0, rdir_len / STEP_LENGTH do + rpos_x = rpos_x + rdir_x * STEP_LENGTH + rpos_y = rpos_y + rdir_y * STEP_LENGTH + rpos_z = rpos_z + rdir_z * STEP_LENGTH + local npos_x = math.floor(rpos_x + 0.5) + local npos_y = math.floor(rpos_y + 0.5) + local npos_z = math.floor(rpos_z + 0.5) + local idx = (npos_z - emin_z) * zstride + (npos_y - emin_y) * ystride + + npos_x - emin_x + 1 + + + local cid = data[idx] + local br = node_br[cid] + + if br ~= 0 then + count = count - 1 + break + end + end + end + + -- Punch entity with damage depending on explosion exposure and + -- distance to explosion + local exposure = count / N_EXPOSURE_RAYS + local punch_vec = vector.subtract(pos, opos) + local punch_dir = vector.normalize(punch_vec) + local impact = (1 - vector.length(punch_vec) / punch_radius) * exposure + if impact < 0 then + impact = 0 + end + local damage = math.floor((impact * impact + impact) * 7 * strength + 1) + obj:punch(obj, nil, { damage_groups = { fleshy = damage } }, punch_dir) + + if obj:is_player() then + obj:add_player_velocity(vector.multiply(punch_dir, -exposure * 20)) + end end end end -- Remove destroyed blocks and drop items for hash, idx in pairs(destroy) do - if math.random() <= drop_chance then - local name = minetest.get_name_from_content_id(data[idx]) - local drop = minetest.get_node_drops(name, "") - for _, item in ipairs(drop) do - if type(item) == "string" then - minetest.add_item(get_position_from_hash(hash), item) - end + local do_drop = math.random() <= drop_chance + local on_blast = node_on_blast[data[idx]] + local remove = true + + if do_drop or on_blast ~= nil then + local npos = get_position_from_hash(hash) + if on_blast ~= nil then + remove = on_blast(npos, 1.0) + else + local name = minetest.get_name_from_content_id(data[idx]) + local drop = minetest.get_node_drops(name, "") + + for _, item in ipairs(drop) do + if type(item) == "string" then + minetest.add_item(npos, item) + end + end end end - data[idx] = AIR_CID + if remove then + data[idx] = AIR_CID + end end -- Log explosion diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index c63d118bd..ed47f6973 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -103,6 +103,11 @@ minetest.register_node("mcl_tnt:tnt", { _doc_items_usagehelp = S("Place the TNT and ignite it with one of the methods above. Quickly get in safe distance. The TNT will start to be affected by gravity and explodes in 4 seconds."), groups = { dig_immediate = 3, tnt = 1, enderman_takable=1 }, mesecons = tnt_mesecons, + on_blast = function(pos) + minetest.chat_send_all("on_blast " .. minetest.pos_to_string(pos)) + spawn_tnt(pos, "mcl_tnt:tnt") + return true + end, _on_ignite = function(player, pointed_thing) tnt.ignite(pointed_thing.under) return true From fd05259202250dceb547a1f9bf11d391d7daafab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Fri, 17 Apr 2020 20:36:39 +0200 Subject: [PATCH 05/30] Make TNT and TNT Minecart use the explosions API The old api from mcl_tnt is still left in the code, and used by the mobs. --- mods/ENTITIES/mcl_minecarts/depends.txt | 1 + mods/ENTITIES/mcl_minecarts/init.lua | 4 ++-- mods/ITEMS/mcl_tnt/depends.txt | 1 + mods/ITEMS/mcl_tnt/init.lua | 3 +-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/ENTITIES/mcl_minecarts/depends.txt b/mods/ENTITIES/mcl_minecarts/depends.txt index 51e65fb89..cdf7feb54 100644 --- a/mods/ENTITIES/mcl_minecarts/depends.txt +++ b/mods/ENTITIES/mcl_minecarts/depends.txt @@ -1,3 +1,4 @@ +mcl_explosions mcl_core mcl_sounds mcl_player diff --git a/mods/ENTITIES/mcl_minecarts/init.lua b/mods/ENTITIES/mcl_minecarts/init.lua index 14f70d246..3aa1ec4ca 100644 --- a/mods/ENTITIES/mcl_minecarts/init.lua +++ b/mods/ENTITIES/mcl_minecarts/init.lua @@ -206,7 +206,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o -- Explode if already ignited if self._boomtimer then self.object:remove() - tnt.boom(pos) + mcl_explosions.explode(pos, 4, { drop_chance = 1.0 }) return end @@ -249,7 +249,7 @@ local function register_entity(entity_id, mesh, textures, drop, on_rightclick, o local pos = self.object:get_pos() if self._boomtimer <= 0 then self.object:remove() - tnt.boom(pos) + mcl_explosions.explode(pos, 4, { drop_chance = 1.0 }) return else tnt.smoke_step(pos) diff --git a/mods/ITEMS/mcl_tnt/depends.txt b/mods/ITEMS/mcl_tnt/depends.txt index 548dace5d..e4c208ea6 100644 --- a/mods/ITEMS/mcl_tnt/depends.txt +++ b/mods/ITEMS/mcl_tnt/depends.txt @@ -1,3 +1,4 @@ +mcl_explosions mcl_sounds? mcl_mobitems? mcl_death_messages? diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index ed47f6973..5f53afaf8 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -104,7 +104,6 @@ minetest.register_node("mcl_tnt:tnt", { groups = { dig_immediate = 3, tnt = 1, enderman_takable=1 }, mesecons = tnt_mesecons, on_blast = function(pos) - minetest.chat_send_all("on_blast " .. minetest.pos_to_string(pos)) spawn_tnt(pos, "mcl_tnt:tnt") return true end, @@ -209,7 +208,7 @@ function TNT:on_step(dtime) self.blinkstatus = not self.blinkstatus end if self.timer > tnt.BOOMTIMER then - tnt.boom(self.object:get_pos(), nil, self.object) + mcl_explosions.explode(self.object:get_pos(), 4, { drop_chance = 1.0 }) self.object:remove() end end From 8d67824e42debea5da23326c976b3139d480983c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Fri, 17 Apr 2020 21:02:46 +0200 Subject: [PATCH 06/30] Add to list of contributors in README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 303d0f5bd..1e8a73c63 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,7 @@ There are so many people to list (sorry). Check out the respective mod directori * [ex-bart](https://github.com/ex-bart): Redstone comparators * [Rootyjr](https://github.com/Rootyjr): Fishing rod and bugfixes * [aligator](https://github.com/aligator): Improvement of doors +* [ryvnf](https://github.com/ryvnf): Explosion mechanics * Lots of other people: TO BE WRITTEN (see mod directories for details) ### Textures From 6315490b14ec1c125fe963613ddfcfdcbbd77504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Fri, 17 Apr 2020 21:40:13 +0200 Subject: [PATCH 07/30] Update the rest of the blast resistance values The values have been updated according to this list: https://minecraft.gamepedia.com/Module:Blast_resistance_values --- mods/ITEMS/REDSTONE/mcl_dispensers/init.lua | 2 +- mods/ITEMS/REDSTONE/mcl_droppers/init.lua | 2 +- mods/ITEMS/REDSTONE/mcl_droppers/init_new.lua | 2 +- mods/ITEMS/REDSTONE/mcl_observers/init.lua | 6 ++-- mods/ITEMS/REDSTONE/mesecons_button/init.lua | 4 +-- .../REDSTONE/mesecons_commandblock/init.lua | 4 +-- .../REDSTONE/mesecons_lightstone/init.lua | 4 +-- .../REDSTONE/mesecons_noteblock/init.lua | 2 +- mods/ITEMS/REDSTONE/mesecons_pistons/init.lua | 36 +++++++++---------- .../REDSTONE/mesecons_pressureplates/init.lua | 2 +- .../REDSTONE/mesecons_solarpanel/init.lua | 8 ++--- mods/ITEMS/REDSTONE/mesecons_torch/init.lua | 2 +- .../REDSTONE/mesecons_walllever/init.lua | 4 +-- mods/ITEMS/mcl_anvils/init.lua | 2 +- mods/ITEMS/mcl_banners/init.lua | 4 +-- mods/ITEMS/mcl_books/init.lua | 2 +- mods/ITEMS/mcl_cake/init.lua | 4 +-- mods/ITEMS/mcl_cauldrons/init.lua | 4 +-- mods/ITEMS/mcl_cocoas/init.lua | 2 +- mods/ITEMS/mcl_colorblocks/init.lua | 10 +++--- mods/ITEMS/mcl_crafting_table/init.lua | 2 +- mods/ITEMS/mcl_doors/register.lua | 18 +++++----- mods/ITEMS/mcl_end/building.lua | 10 +++--- mods/ITEMS/mcl_end/chorus_plant.lua | 2 +- mods/ITEMS/mcl_farming/melon.lua | 2 +- mods/ITEMS/mcl_farming/pumpkin.lua | 4 +-- mods/ITEMS/mcl_farming/soil.lua | 4 +-- mods/ITEMS/mcl_farming/wheat.lua | 2 +- mods/ITEMS/mcl_furnaces/init.lua | 4 +-- mods/ITEMS/mcl_heads/init.lua | 4 +-- mods/ITEMS/mcl_hoppers/init.lua | 4 +-- mods/ITEMS/mcl_jukebox/init.lua | 2 +- mods/ITEMS/mcl_mobspawners/init.lua | 2 +- mods/ITEMS/mcl_monster_eggs/init.lua | 2 +- mods/ITEMS/mcl_mushrooms/huge.lua | 2 +- mods/ITEMS/mcl_nether/init.lua | 24 ++++++------- mods/ITEMS/mcl_ocean/corals.lua | 4 +-- mods/ITEMS/mcl_ocean/prismarine.lua | 8 ++--- mods/ITEMS/mcl_portals/portal_end.lua | 6 ++-- mods/ITEMS/mcl_signs/init.lua | 4 +-- mods/ITEMS/mcl_sponges/init.lua | 6 ++-- mods/ITEMS/mcl_walls/init.lua | 8 ++--- mods/ITEMS/mcl_wool/init.lua | 4 +-- mods/ITEMS/xpanes/init.lua | 4 +-- 44 files changed, 119 insertions(+), 119 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua index 464bc4bd8..b6d0d2ef6 100644 --- a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua @@ -94,7 +94,7 @@ local dispenserdef = { end meta:from_table(meta2:to_table()) end, - _mcl_blast_resistance = 17.5, + _mcl_blast_resistance = 3.5, _mcl_hardness = 3.5, mesecons = {effector = { -- Dispense random item when triggered diff --git a/mods/ITEMS/REDSTONE/mcl_droppers/init.lua b/mods/ITEMS/REDSTONE/mcl_droppers/init.lua index 6ca92b335..715a85f3d 100644 --- a/mods/ITEMS/REDSTONE/mcl_droppers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_droppers/init.lua @@ -94,7 +94,7 @@ local dropperdef = { return stack:get_count() end end, - _mcl_blast_resistance = 17.5, + _mcl_blast_resistance = 3.5, _mcl_hardness = 3.5, mesecons = {effector = { -- Drop random item when triggered diff --git a/mods/ITEMS/REDSTONE/mcl_droppers/init_new.lua b/mods/ITEMS/REDSTONE/mcl_droppers/init_new.lua index fc7238c47..1bf968a82 100644 --- a/mods/ITEMS/REDSTONE/mcl_droppers/init_new.lua +++ b/mods/ITEMS/REDSTONE/mcl_droppers/init_new.lua @@ -92,7 +92,7 @@ local dropperdef = { return stack:get_count() end end, - _mcl_blast_resistance = 17.5, + _mcl_blast_resistance = 3.5, _mcl_hardness = 3.5, mesecons = {effector = { -- Drop random item when triggered diff --git a/mods/ITEMS/REDSTONE/mcl_observers/init.lua b/mods/ITEMS/REDSTONE/mcl_observers/init.lua index 7c0eb3a2f..885e8599e 100644 --- a/mods/ITEMS/REDSTONE/mcl_observers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_observers/init.lua @@ -82,7 +82,7 @@ mesecon.register_node("mcl_observers:observer", sounds = mcl_sounds.node_sound_stone_defaults(), paramtype2 = "facedir", on_rotate = false, - _mcl_blast_resistance = 17.5, + _mcl_blast_resistance = 3.5, _mcl_hardness = 3.5, }, { @@ -139,7 +139,7 @@ mesecon.register_node("mcl_observers:observer_down", sounds = mcl_sounds.node_sound_stone_defaults(), groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 }, on_rotate = false, - _mcl_blast_resistance = 17.5, + _mcl_blast_resistance = 3.5, _mcl_hardness = 3.5, drop = "mcl_observers:observer_off", }, @@ -188,7 +188,7 @@ mesecon.register_node("mcl_observers:observer_up", sounds = mcl_sounds.node_sound_stone_defaults(), groups = {pickaxey=1, material_stone=1, not_opaque=1, not_in_creative_inventory=1 }, on_rotate = false, - _mcl_blast_resistance = 17.5, + _mcl_blast_resistance = 3.5, _mcl_hardness = 3.5, drop = "mcl_observers:observer_off", }, diff --git a/mods/ITEMS/REDSTONE/mesecons_button/init.lua b/mods/ITEMS/REDSTONE/mesecons_button/init.lua index e1a5c5980..5ff15eccb 100644 --- a/mods/ITEMS/REDSTONE/mesecons_button/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_button/init.lua @@ -133,7 +133,7 @@ mesecon.register_button = function(basename, description, texture, recipeitem, s _mcl_button_basename = basename, _mcl_button_timer = button_timer, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) @@ -184,7 +184,7 @@ mesecon.register_button = function(basename, description, texture, recipeitem, s end end, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) diff --git a/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua b/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua index 8a36210ad..44db17a4a 100644 --- a/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_commandblock/init.lua @@ -242,7 +242,7 @@ S("Example 2:\n give @@n mcl_core:apple 5\nGives the nearest player 5 apples" action_on = commandblock_action_on, rules = mesecon.rules.alldirs, }}, - _mcl_blast_resistance = 18000000, + _mcl_blast_resistance = 3600000, _mcl_hardness = -1, }) @@ -261,7 +261,7 @@ minetest.register_node("mesecons_commandblock:commandblock_on", { action_off = commandblock_action_off, rules = mesecon.rules.alldirs, }}, - _mcl_blast_resistance = 18000000, + _mcl_blast_resistance = 3600000, _mcl_hardness = -1, }) diff --git a/mods/ITEMS/REDSTONE/mesecons_lightstone/init.lua b/mods/ITEMS/REDSTONE/mesecons_lightstone/init.lua index 0e01d52b9..c09bcf592 100644 --- a/mods/ITEMS/REDSTONE/mesecons_lightstone/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_lightstone/init.lua @@ -16,7 +16,7 @@ minetest.register_node("mesecons_lightstone:lightstone_off", { end, rules = mesecon.rules.alldirs, }}, - _mcl_blast_resistance = 1.5, + _mcl_blast_resistance = 0.3, _mcl_hardness = 0.3, }) @@ -34,7 +34,7 @@ minetest.register_node("mesecons_lightstone:lightstone_on", { end, rules = mesecon.rules.alldirs, }}, - _mcl_blast_resistance = 1.5, + _mcl_blast_resistance = 0.3, _mcl_hardness = 0.3, }) diff --git a/mods/ITEMS/REDSTONE/mesecons_noteblock/init.lua b/mods/ITEMS/REDSTONE/mesecons_noteblock/init.lua index 5ac18ea42..439342d34 100644 --- a/mods/ITEMS/REDSTONE/mesecons_noteblock/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_noteblock/init.lua @@ -48,7 +48,7 @@ S("The note block will only play a note when it is below air, otherwise, it stay end, rules = mesecon.rules.alldirs, }}, - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 0.8, _mcl_hardness = 0.8, }) diff --git a/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua b/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua index 8536cff9a..eb69d3380 100644 --- a/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_pistons/init.lua @@ -200,7 +200,7 @@ minetest.register_node("mesecons_pistons:piston_normal_off", { action_on = piston_on, rules = piston_get_rules }}, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then @@ -235,7 +235,7 @@ minetest.register_node("mesecons_pistons:piston_normal_on", { action_off = piston_off, rules = piston_get_rules }}, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = false, }) @@ -262,7 +262,7 @@ minetest.register_node("mesecons_pistons:piston_pusher_normal", { selection_box = piston_pusher_box, node_box = piston_pusher_box, sounds = mcl_sounds.node_sound_wood_defaults(), - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, on_rotate = false, }) @@ -304,7 +304,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_off", { action_on = piston_on, rules = piston_get_rules }}, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then @@ -339,7 +339,7 @@ minetest.register_node("mesecons_pistons:piston_sticky_on", { action_off = piston_off, rules = piston_get_rules }}, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = false, }) @@ -366,7 +366,7 @@ minetest.register_node("mesecons_pistons:piston_pusher_sticky", { selection_box = piston_pusher_box, node_box = piston_pusher_box, sounds = mcl_sounds.node_sound_wood_defaults(), - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, on_rotate = false, }) @@ -423,7 +423,7 @@ minetest.register_node("mesecons_pistons:piston_up_normal_off", { sounds = mcl_sounds.node_sound_stone_defaults({ footstep = mcl_sounds.node_sound_wood_defaults().footstep }), - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then @@ -459,7 +459,7 @@ minetest.register_node("mesecons_pistons:piston_up_normal_on", { action_off = piston_off, rules = piston_up_rules, }}, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = false, }) @@ -486,7 +486,7 @@ minetest.register_node("mesecons_pistons:piston_up_pusher_normal", { selection_box = piston_up_pusher_box, node_box = piston_up_pusher_box, sounds = mcl_sounds.node_sound_wood_defaults(), - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, on_rotate = false, }) @@ -526,7 +526,7 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_off", { action_on = piston_on, rules = piston_up_rules, }}, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then @@ -562,7 +562,7 @@ minetest.register_node("mesecons_pistons:piston_up_sticky_on", { action_off = piston_off, rules = piston_up_rules, }}, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = false, }) @@ -589,7 +589,7 @@ minetest.register_node("mesecons_pistons:piston_up_pusher_sticky", { selection_box = piston_up_pusher_box, node_box = piston_up_pusher_box, sounds = mcl_sounds.node_sound_wood_defaults(), - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, on_rotate = false, }) @@ -646,7 +646,7 @@ minetest.register_node("mesecons_pistons:piston_down_normal_off", { action_on = piston_on, rules = piston_down_rules, }}, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then @@ -682,7 +682,7 @@ minetest.register_node("mesecons_pistons:piston_down_normal_on", { action_off = piston_off, rules = piston_down_rules, }}, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = false, }) @@ -709,7 +709,7 @@ minetest.register_node("mesecons_pistons:piston_down_pusher_normal", { selection_box = piston_down_pusher_box, node_box = piston_down_pusher_box, sounds = mcl_sounds.node_sound_wood_defaults(), - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, on_rotate = false, }) @@ -744,7 +744,7 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_off", { action_on = piston_on, rules = piston_down_rules, }}, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = function(pos, node, user, mode) if mode == screwdriver.ROTATE_AXIS then @@ -780,7 +780,7 @@ minetest.register_node("mesecons_pistons:piston_down_sticky_on", { action_off = piston_off, rules = piston_down_rules, }}, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, on_rotate = false, }) @@ -807,7 +807,7 @@ minetest.register_node("mesecons_pistons:piston_down_pusher_sticky", { selection_box = piston_down_pusher_box, node_box = piston_down_pusher_box, sounds = mcl_sounds.node_sound_wood_defaults(), - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, on_rotate = false, }) diff --git a/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua b/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua index 2c8c20bf5..2e161ae4d 100644 --- a/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_pressureplates/init.lua @@ -125,7 +125,7 @@ function mesecon.register_pressure_plate(basename, description, textures_off, te is_ground_content = false, pressureplate_basename = basename, pressureplate_activated_by = activated_by, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, },{ node_box = pp_box_off, diff --git a/mods/ITEMS/REDSTONE/mesecons_solarpanel/init.lua b/mods/ITEMS/REDSTONE/mesecons_solarpanel/init.lua index eb5eafdbc..c9d051574 100644 --- a/mods/ITEMS/REDSTONE/mesecons_solarpanel/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_solarpanel/init.lua @@ -36,7 +36,7 @@ minetest.register_node("mesecons_solarpanel:solar_panel_on", { minetest.swap_node(pos, {name = "mesecons_solarpanel:solar_panel_inverted_off"}) mesecon.receptor_off(pos, mesecon.rules.pplate) end, - _mcl_blast_resistance = 1, + _mcl_blast_resistance = 0.2, _mcl_hardness = 0.2, }) @@ -76,7 +76,7 @@ minetest.register_node("mesecons_solarpanel:solar_panel_off", { minetest.swap_node(pos, {name = "mesecons_solarpanel:solar_panel_inverted_on"}) mesecon.receptor_on(pos, mesecon.rules.pplate) end, - _mcl_blast_resistance = 1, + _mcl_blast_resistance = 0.2, _mcl_hardness = 0.2, }) @@ -154,7 +154,7 @@ minetest.register_node("mesecons_solarpanel:solar_panel_inverted_on", { minetest.swap_node(pos, {name = "mesecons_solarpanel:solar_panel_off"}) mesecon.receptor_off(pos, mesecon.rules.pplate) end, - _mcl_blast_resistance = 1, + _mcl_blast_resistance = 0.2, _mcl_hardness = 0.2, }) @@ -192,7 +192,7 @@ minetest.register_node("mesecons_solarpanel:solar_panel_inverted_off", { minetest.swap_node(pos, {name = "mesecons_solarpanel:solar_panel_on"}) mesecon.receptor_on(pos, mesecon.rules.pplate) end, - _mcl_blast_resistance = 1, + _mcl_blast_resistance = 0.2, _mcl_hardness = 0.2, }) diff --git a/mods/ITEMS/REDSTONE/mesecons_torch/init.lua b/mods/ITEMS/REDSTONE/mesecons_torch/init.lua index fda96121f..20a1ca6d4 100644 --- a/mods/ITEMS/REDSTONE/mesecons_torch/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_torch/init.lua @@ -204,7 +204,7 @@ minetest.register_node("mesecons_torch:redstoneblock", { state = mesecon.state.on, rules = mesecon.rules.alldirs, }}, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 5, }) diff --git a/mods/ITEMS/REDSTONE/mesecons_walllever/init.lua b/mods/ITEMS/REDSTONE/mesecons_walllever/init.lua index 8894f4ad1..053990ed4 100644 --- a/mods/ITEMS/REDSTONE/mesecons_walllever/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_walllever/init.lua @@ -128,7 +128,7 @@ minetest.register_node("mesecons_walllever:wall_lever_off", { state = mesecon.state.off }}, on_rotate = on_rotate, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) minetest.register_node("mesecons_walllever:wall_lever_on", { @@ -160,7 +160,7 @@ minetest.register_node("mesecons_walllever:wall_lever_on", { state = mesecon.state.on }}, on_rotate = on_rotate, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) diff --git a/mods/ITEMS/mcl_anvils/init.lua b/mods/ITEMS/mcl_anvils/init.lua index 76cd0f3ee..bfeed83ff 100644 --- a/mods/ITEMS/mcl_anvils/init.lua +++ b/mods/ITEMS/mcl_anvils/init.lua @@ -275,7 +275,7 @@ local anvildef = { } }, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 6000, + _mcl_blast_resistance = 1200, _mcl_hardness = 5, _mcl_after_falling = damage_anvil_by_falling, diff --git a/mods/ITEMS/mcl_banners/init.lua b/mods/ITEMS/mcl_banners/init.lua index 8c8869d60..31853b11d 100644 --- a/mods/ITEMS/mcl_banners/init.lua +++ b/mods/ITEMS/mcl_banners/init.lua @@ -230,7 +230,7 @@ S("You can copy the pattern of a banner by placing two banners of the same color respawn_banner_entity(pos, node) end, _mcl_hardness = 1, - _mcl_blast_resistance = 5, + _mcl_blast_resistance = 1, on_rotate = function(pos, node, user, mode, param2) if mode == screwdriver.ROTATE_FACE then local meta = minetest.get_meta(pos) @@ -274,7 +274,7 @@ minetest.register_node("mcl_banners:hanging_banner", { respawn_banner_entity(pos, node) end, _mcl_hardness = 1, - _mcl_blast_resistance = 5, + _mcl_blast_resistance = 1, on_rotate = function(pos, node, user, mode, param2) if mode == screwdriver.ROTATE_FACE then local r = screwdriver.rotate.wallmounted(pos, node, mode) diff --git a/mods/ITEMS/mcl_books/init.lua b/mods/ITEMS/mcl_books/init.lua index 50eadec6d..82ec64d71 100644 --- a/mods/ITEMS/mcl_books/init.lua +++ b/mods/ITEMS/mcl_books/init.lua @@ -342,7 +342,7 @@ minetest.register_node("mcl_books:bookshelf", { groups = {handy=1,axey=1, flammable=3,building_block=1, material_wood=1}, drop = "mcl_books:book 3", sounds = wood_sound, - _mcl_blast_resistance = 7.5, + _mcl_blast_resistance = 1.5, _mcl_hardness = 1.5, }) diff --git a/mods/ITEMS/mcl_cake/init.lua b/mods/ITEMS/mcl_cake/init.lua index 33cad6195..9f9dd2049 100644 --- a/mods/ITEMS/mcl_cake/init.lua +++ b/mods/ITEMS/mcl_cake/init.lua @@ -70,7 +70,7 @@ minetest.register_node("mcl_cake:cake", { _food_particles = false, _mcl_saturation = 0.4, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) @@ -130,7 +130,7 @@ local register_slice = function(level, nodebox, desc) _food_particles = false, _mcl_saturation = 0.4, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) diff --git a/mods/ITEMS/mcl_cauldrons/init.lua b/mods/ITEMS/mcl_cauldrons/init.lua index bc65e9662..7f0592b2a 100644 --- a/mods/ITEMS/mcl_cauldrons/init.lua +++ b/mods/ITEMS/mcl_cauldrons/init.lua @@ -63,7 +63,7 @@ minetest.register_node("mcl_cauldrons:cauldron", { }, sounds = mcl_sounds.node_sound_metal_defaults(), _mcl_hardness = 2, - _mcl_blast_resistance = 10, + _mcl_blast_resistance = 2, }) -- Template function for cauldrons with water @@ -94,7 +94,7 @@ local register_filled_cauldron = function(water_level, description, river_water) sounds = mcl_sounds.node_sound_metal_defaults(), drop = "mcl_cauldrons:cauldron", _mcl_hardness = 2, - _mcl_blast_resistance = 10, + _mcl_blast_resistance = 2, }) -- Add entry aliases for the Help diff --git a/mods/ITEMS/mcl_cocoas/init.lua b/mods/ITEMS/mcl_cocoas/init.lua index 7f809fc06..8b70c1ad6 100644 --- a/mods/ITEMS/mcl_cocoas/init.lua +++ b/mods/ITEMS/mcl_cocoas/init.lua @@ -111,7 +111,7 @@ local crop_def = { }, sounds = mcl_sounds.node_sound_wood_defaults(), on_rotate = false, - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, _mcl_hardness = 0.2, } diff --git a/mods/ITEMS/mcl_colorblocks/init.lua b/mods/ITEMS/mcl_colorblocks/init.lua index f55003e02..1965c9024 100644 --- a/mods/ITEMS/mcl_colorblocks/init.lua +++ b/mods/ITEMS/mcl_colorblocks/init.lua @@ -37,7 +37,7 @@ minetest.register_node("mcl_colorblocks:hardened_clay", { stack_max = 64, groups = {pickaxey=1, hardened_clay=1,building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 21, + _mcl_blast_resistance = 4.2, _mcl_hardness = 1.25, }) @@ -87,7 +87,7 @@ for _, row in ipairs(block.dyes) do groups = {pickaxey=1, hardened_clay=1,building_block=1, material_stone=1}, stack_max = 64, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 21, + _mcl_blast_resistance = 4.2, _mcl_hardness = 1.25, }) @@ -128,7 +128,7 @@ for _, row in ipairs(block.dyes) do -- Specify the node to which this node will convert after getting in contact with water _mcl_colorblocks_harden_to = "mcl_colorblocks:concrete_"..name, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) @@ -142,7 +142,7 @@ for _, row in ipairs(block.dyes) do stack_max = 64, is_ground_content = false, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 9, + _mcl_blast_resistance = 1.8, _mcl_hardness = 1.8, }) @@ -159,7 +159,7 @@ for _, row in ipairs(block.dyes) do stack_max = 64, is_ground_content = false, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 7, + _mcl_blast_resistance = 4.2, _mcl_hardness = 1.4, on_rotate = on_rotate, }) diff --git a/mods/ITEMS/mcl_crafting_table/init.lua b/mods/ITEMS/mcl_crafting_table/init.lua index 3c19e2882..2339f2c60 100644 --- a/mods/ITEMS/mcl_crafting_table/init.lua +++ b/mods/ITEMS/mcl_crafting_table/init.lua @@ -35,7 +35,7 @@ minetest.register_node("mcl_crafting_table:crafting_table", { minetest.show_formspec(player:get_player_name(), "main", form) end, sounds = mcl_sounds.node_sound_wood_defaults(), - _mcl_blast_resistance = 12.5, + _mcl_blast_resistance = 2.5, _mcl_hardness = 2.5, }) diff --git a/mods/ITEMS/mcl_doors/register.lua b/mods/ITEMS/mcl_doors/register.lua index e8f990f9b..aca60e8ff 100644 --- a/mods/ITEMS/mcl_doors/register.lua +++ b/mods/ITEMS/mcl_doors/register.lua @@ -13,7 +13,7 @@ mcl_doors:register_door("mcl_doors:wooden_door", { inventory_image = "doors_item_wood.png", groups = {handy=1,axey=1, material_wood=1}, _mcl_hardness = 3, - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, tiles_bottom = {"mcl_doors_door_wood_lower.png", "mcl_doors_door_wood_side_lower.png"}, tiles_top = {"mcl_doors_door_wood_upper.png", "mcl_doors_door_wood_side_upper.png"}, sounds = mcl_sounds.node_sound_wood_defaults(), @@ -36,7 +36,7 @@ mcl_doors:register_door("mcl_doors:acacia_door", { inventory_image = "mcl_doors_door_acacia.png", groups = {handy=1,axey=1, material_wood=1}, _mcl_hardness = 3, - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, tiles_bottom = {"mcl_doors_door_acacia_lower.png", "mcl_doors_door_acacia_side_lower.png"}, tiles_top = {"mcl_doors_door_acacia_upper.png", "mcl_doors_door_acacia_side_upper.png"}, sounds = mcl_sounds.node_sound_wood_defaults(), @@ -59,7 +59,7 @@ mcl_doors:register_door("mcl_doors:birch_door", { inventory_image = "mcl_doors_door_birch.png", groups = {handy=1,axey=1, material_wood=1}, _mcl_hardness = 3, - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, tiles_bottom = {"mcl_doors_door_birch_lower.png", "mcl_doors_door_birch_side_lower.png"}, tiles_top = {"mcl_doors_door_birch_upper.png", "mcl_doors_door_birch_side_upper.png"}, sounds = mcl_sounds.node_sound_wood_defaults(), @@ -82,7 +82,7 @@ mcl_doors:register_door("mcl_doors:dark_oak_door", { inventory_image = "mcl_doors_door_dark_oak.png", groups = {handy=1,axey=1, material_wood=1}, _mcl_hardness = 3, - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, tiles_bottom = {"mcl_doors_door_dark_oak_lower.png", "mcl_doors_door_dark_oak_side_lower.png"}, tiles_top = {"mcl_doors_door_dark_oak_upper.png", "mcl_doors_door_dark_oak_side_upper.png"}, sounds = mcl_sounds.node_sound_wood_defaults(), @@ -105,7 +105,7 @@ mcl_doors:register_door("mcl_doors:jungle_door", { inventory_image = "mcl_doors_door_jungle.png", groups = {handy=1,axey=1, material_wood=1}, _mcl_hardness = 3, - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, tiles_bottom = {"mcl_doors_door_jungle_lower.png", "mcl_doors_door_jungle_side_lower.png"}, tiles_top = {"mcl_doors_door_jungle_upper.png", "mcl_doors_door_jungle_side_upper.png"}, sounds = mcl_sounds.node_sound_wood_defaults(), @@ -128,7 +128,7 @@ mcl_doors:register_door("mcl_doors:spruce_door", { inventory_image = "mcl_doors_door_spruce.png", groups = {handy=1,axey=1, material_wood=1}, _mcl_hardness = 3, - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, tiles_bottom = {"mcl_doors_door_spruce_lower.png", "mcl_doors_door_spruce_side_lower.png"}, tiles_top = {"mcl_doors_door_spruce_upper.png", "mcl_doors_door_spruce_side_upper.png"}, sounds = mcl_sounds.node_sound_wood_defaults(), @@ -182,7 +182,7 @@ mcl_doors:register_door("mcl_doors:iron_door", { inventory_image = "doors_item_steel.png", groups = {pickaxey=1, mesecon_effector_on=1}, _mcl_hardness = 5, - _mcl_blast_resistance = 25, + _mcl_blast_resistance = 5, tiles_bottom = {"mcl_doors_door_iron_lower.png^[transformFX", "mcl_doors_door_iron_side_lower.png"}, tiles_top = {"mcl_doors_door_iron_upper.png^[transformFX", "mcl_doors_door_iron_side_upper.png"}, sounds = mcl_sounds.node_sound_metal_defaults(), @@ -224,7 +224,7 @@ for w=1, #woods do wield_image = woods[w][3], groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1}, _mcl_hardness = 3, - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, sounds = mcl_sounds.node_sound_wood_defaults(), }) @@ -251,7 +251,7 @@ mcl_doors:register_trapdoor("mcl_doors:iron_trapdoor", { wield_image = "doors_trapdoor_steel.png", groups = {pickaxey=1, mesecon_effector_on=1}, _mcl_hardness = 5, - _mcl_blast_resistance = 25, + _mcl_blast_resistance = 5, sounds = mcl_sounds.node_sound_metal_defaults(), sound_open = "doors_steel_door_open", sound_close = "doors_steel_door_close", diff --git a/mods/ITEMS/mcl_end/building.lua b/mods/ITEMS/mcl_end/building.lua index 9b0022e9f..3dcf0671e 100644 --- a/mods/ITEMS/mcl_end/building.lua +++ b/mods/ITEMS/mcl_end/building.lua @@ -15,7 +15,7 @@ minetest.register_node("mcl_end:end_stone", { groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), after_dig_node = mcl_end.check_detach_chorus_plant, - _mcl_blast_resistance = 45, + _mcl_blast_resistance = 9, _mcl_hardness = 3, }) @@ -27,7 +27,7 @@ minetest.register_node("mcl_end:end_bricks", { stack_max = 64, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 9, _mcl_hardness = 0.8, }) @@ -39,7 +39,7 @@ minetest.register_node("mcl_end:purpur_block", { stack_max = 64, groups = {pickaxey=1, building_block=1, material_stone=1, purpur_block=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -54,7 +54,7 @@ minetest.register_node("mcl_end:purpur_pillar", { groups = {pickaxey=1, building_block=1, material_stone=1, purpur_block=1}, sounds = mcl_sounds.node_sound_stone_defaults(), on_rotate = on_rotate, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 1.5, }) @@ -167,7 +167,7 @@ minetest.register_node("mcl_end:dragon_egg", { }, groups = {handy=1, falling_node = 1, deco_block = 1, not_in_creative_inventory = 1, dig_by_piston = 1 }, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 45, + _mcl_blast_resistance = 9, _mcl_hardness = 3, -- TODO: Make dragon egg teleport on punching }) diff --git a/mods/ITEMS/mcl_end/chorus_plant.lua b/mods/ITEMS/mcl_end/chorus_plant.lua index e29a6fecd..171ff37b6 100644 --- a/mods/ITEMS/mcl_end/chorus_plant.lua +++ b/mods/ITEMS/mcl_end/chorus_plant.lua @@ -200,7 +200,7 @@ minetest.register_node("mcl_end:chorus_flower", { end, after_dig_node = mcl_end.check_detach_chorus_plant, on_blast = mcl_end.check_blast_chorus_plant, - _mcl_blast_resistance = 2, + _mcl_blast_resistance = 0.4, _mcl_hardness = 0.4, }) diff --git a/mods/ITEMS/mcl_farming/melon.lua b/mods/ITEMS/mcl_farming/melon.lua index 0734b35d2..43ff7b0f8 100644 --- a/mods/ITEMS/mcl_farming/melon.lua +++ b/mods/ITEMS/mcl_farming/melon.lua @@ -33,7 +33,7 @@ local melon_base_def = { } }, sounds = mcl_sounds.node_sound_wood_defaults(), - _mcl_blast_resistance = 5, + _mcl_blast_resistance = 1, _mcl_hardness = 1, } diff --git a/mods/ITEMS/mcl_farming/pumpkin.lua b/mods/ITEMS/mcl_farming/pumpkin.lua index f77d6f0d6..72b4e5412 100644 --- a/mods/ITEMS/mcl_farming/pumpkin.lua +++ b/mods/ITEMS/mcl_farming/pumpkin.lua @@ -101,7 +101,7 @@ local pumpkin_base_def = { groups = {handy=1,axey=1, plant=1,building_block=1, dig_by_piston=1, enderman_takable=1}, sounds = mcl_sounds.node_sound_wood_defaults(), on_rotate = on_rotate, - _mcl_blast_resistance = 5, + _mcl_blast_resistance = 1, _mcl_hardness = 1, } minetest.register_node("mcl_farming:pumpkin", pumpkin_base_def) @@ -148,7 +148,7 @@ minetest.register_node("mcl_farming:pumpkin_face_light", { mobs_mc.tools.check_snow_golem_summon(pos) end, on_rotate = on_rotate, - _mcl_blast_resistance = 5, + _mcl_blast_resistance = 1, _mcl_hardness = 1, }) diff --git a/mods/ITEMS/mcl_farming/soil.lua b/mods/ITEMS/mcl_farming/soil.lua index 87dcbe22b..0c0e3b832 100644 --- a/mods/ITEMS/mcl_farming/soil.lua +++ b/mods/ITEMS/mcl_farming/soil.lua @@ -21,7 +21,7 @@ minetest.register_node("mcl_farming:soil", { end, groups = {handy=1,shovely=1, dirtifies_below_solid=1, dirtifier=1, soil=2, soil_sapling=1, deco_block=1 }, sounds = mcl_sounds.node_sound_dirt_defaults(), - _mcl_blast_resistance = 3, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.6, }) @@ -44,7 +44,7 @@ minetest.register_node("mcl_farming:soil_wet", { end, groups = {handy=1,shovely=1, not_in_creative_inventory=1, dirtifies_below_solid=1, dirtifier=1, soil=3, soil_sapling=1 }, sounds = mcl_sounds.node_sound_dirt_defaults(), - _mcl_blast_resistance = 3, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.6, }) diff --git a/mods/ITEMS/mcl_farming/wheat.lua b/mods/ITEMS/mcl_farming/wheat.lua index 0bf8724e4..850838b2b 100644 --- a/mods/ITEMS/mcl_farming/wheat.lua +++ b/mods/ITEMS/mcl_farming/wheat.lua @@ -149,7 +149,7 @@ minetest.register_node("mcl_farming:hay_block", { groups = {handy=1, flammable=2, building_block=1, fall_damage_add_percent=-80}, sounds = mcl_sounds.node_sound_leaves_defaults(), on_rotate = on_rotate, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) diff --git a/mods/ITEMS/mcl_furnaces/init.lua b/mods/ITEMS/mcl_furnaces/init.lua index 17c404dd4..c76b379e6 100644 --- a/mods/ITEMS/mcl_furnaces/init.lua +++ b/mods/ITEMS/mcl_furnaces/init.lua @@ -359,7 +359,7 @@ minetest.register_node("mcl_furnaces:furnace", { allow_metadata_inventory_take = allow_metadata_inventory_take, on_metadata_inventory_take = on_metadata_inventory_take, on_receive_fields = receive_fields, - _mcl_blast_resistance = 17.5, + _mcl_blast_resistance = 3.5, _mcl_hardness = 3.5, on_rotate = on_rotate, }) @@ -402,7 +402,7 @@ minetest.register_node("mcl_furnaces:furnace_active", { allow_metadata_inventory_take = allow_metadata_inventory_take, on_metadata_inventory_take = on_metadata_inventory_take, on_receive_fields = receive_fields, - _mcl_blast_resistance = 17.5, + _mcl_blast_resistance = 3.5, _mcl_hardness = 3.5, on_rotate = on_rotate, }) diff --git a/mods/ITEMS/mcl_heads/init.lua b/mods/ITEMS/mcl_heads/init.lua index b20d696aa..cb83ed1fa 100644 --- a/mods/ITEMS/mcl_heads/init.lua +++ b/mods/ITEMS/mcl_heads/init.lua @@ -112,7 +112,7 @@ local function addhead(name, texture, desc, longdesc, rangemob, rangefactor) _mcl_armor_mob_range_mob = rangemob, _mcl_armor_mob_range_factor = rangefactor, - _mcl_blast_resistance = 5, + _mcl_blast_resistance = 1, _mcl_hardness = 1, }) @@ -146,7 +146,7 @@ local function addhead(name, texture, desc, longdesc, rangemob, rangefactor) }), drop = "mcl_heads:"..name, on_rotate = on_rotate_wall, - _mcl_blast_resistance = 5, + _mcl_blast_resistance = 1, _mcl_hardness = 1, }) diff --git a/mods/ITEMS/mcl_hoppers/init.lua b/mods/ITEMS/mcl_hoppers/init.lua index e53052e70..52cb60874 100644 --- a/mods/ITEMS/mcl_hoppers/init.lua +++ b/mods/ITEMS/mcl_hoppers/init.lua @@ -114,7 +114,7 @@ local def_hopper = { end, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 24, + _mcl_blast_resistance = 4.8, _mcl_hardness = 3, } @@ -303,7 +303,7 @@ local def_hopper_side = { on_rotate = on_rotate, sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 24, + _mcl_blast_resistance = 4.8, _mcl_hardness = 3, } diff --git a/mods/ITEMS/mcl_jukebox/init.lua b/mods/ITEMS/mcl_jukebox/init.lua index 0328c7072..3cfc3b760 100644 --- a/mods/ITEMS/mcl_jukebox/init.lua +++ b/mods/ITEMS/mcl_jukebox/init.lua @@ -227,7 +227,7 @@ minetest.register_node("mcl_jukebox:jukebox", { end meta:from_table(meta2:to_table()) end, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 2, }) diff --git a/mods/ITEMS/mcl_mobspawners/init.lua b/mods/ITEMS/mcl_mobspawners/init.lua index 8b9732c11..39abd7227 100644 --- a/mods/ITEMS/mcl_mobspawners/init.lua +++ b/mods/ITEMS/mcl_mobspawners/init.lua @@ -323,7 +323,7 @@ minetest.register_node("mcl_mobspawners:spawner", { sounds = mcl_sounds.node_sound_metal_defaults(), - _mcl_blast_resistance = 25, + _mcl_blast_resistance = 5, _mcl_hardness = 5, }) diff --git a/mods/ITEMS/mcl_monster_eggs/init.lua b/mods/ITEMS/mcl_monster_eggs/init.lua index 7823b360c..a4c0144d4 100644 --- a/mods/ITEMS/mcl_monster_eggs/init.lua +++ b/mods/ITEMS/mcl_monster_eggs/init.lua @@ -26,7 +26,7 @@ local register_block = function(subname, description, tiles, is_ground_content) _tt_help = S("Hides a silverfish"), _doc_items_longdesc = S("An infested block is a block from which a silverfish will pop out when it is broken. It looks identical to its normal counterpart."), _mcl_hardness = 0, - _mcl_blast_resistance = 3.75, + _mcl_blast_resistance = 0.5, }) end diff --git a/mods/ITEMS/mcl_mushrooms/huge.lua b/mods/ITEMS/mcl_mushrooms/huge.lua index 54e719a5d..6061f8688 100644 --- a/mods/ITEMS/mcl_mushrooms/huge.lua +++ b/mods/ITEMS/mcl_mushrooms/huge.lua @@ -4,7 +4,7 @@ local template = { groups = {handy=1,axey=1, building_block = 1, material_wood = 1 }, sounds = mcl_sounds.node_sound_wood_defaults(), is_ground_content = true, - _mcl_blast_resistance = 1, + _mcl_blast_resistance = 0.2, _mcl_hardness = 0.2, } diff --git a/mods/ITEMS/mcl_nether/init.lua b/mods/ITEMS/mcl_nether/init.lua index 07c575f04..e7612c906 100644 --- a/mods/ITEMS/mcl_nether/init.lua +++ b/mods/ITEMS/mcl_nether/init.lua @@ -25,7 +25,7 @@ minetest.register_node("mcl_nether:glowstone", { paramtype = "light", light_source = minetest.LIGHT_MAX, sounds = mcl_sounds.node_sound_glass_defaults(), - _mcl_blast_resistance = 1.5, + _mcl_blast_resistance = 0.3, _mcl_hardness = 0.3, }) @@ -38,7 +38,7 @@ minetest.register_node("mcl_nether:quartz_ore", { groups = {pickaxey=1, building_block=1, material_stone=1}, drop = 'mcl_nether:quartz', sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 15, + _mcl_blast_resistance = 3, _mcl_hardness = 3, }) @@ -75,7 +75,7 @@ minetest.register_node("mcl_nether:netherrack", { is_ground_content = true, groups = {pickaxey=1, building_block=1, material_stone=1, enderman_takable=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 2, + _mcl_blast_resistance = 0.4, _mcl_hardness = 0.4, -- Eternal fire on top @@ -104,7 +104,7 @@ minetest.register_node("mcl_nether:magma", { player:set_hp(player:get_hp() - 1, { type = "punch", from = "mod" }) end end, - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, -- Eternal fire on top @@ -125,7 +125,7 @@ minetest.register_node("mcl_nether:soul_sand", { fixed = { -0.5, -0.5, -0.5, 0.5, 0.5 - 2/16, 0.5 }, }, sounds = mcl_sounds.node_sound_sand_defaults(), - _mcl_blast_resistance = 2.5, + _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, -- Movement handling is done in mcl_playerplus mod }) @@ -139,7 +139,7 @@ minetest.register_node("mcl_nether:nether_brick", { is_ground_content = false, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 2, }) @@ -152,7 +152,7 @@ minetest.register_node("mcl_nether:red_nether_brick", { is_ground_content = false, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 2, }) @@ -170,7 +170,7 @@ minetest.register_node("mcl_nether:nether_wart_block", { dug={name="default_dirt_footstep", gain=1.5}, } ), - _mcl_blast_resistance = 5, + _mcl_blast_resistance = 1, _mcl_hardness = 1, }) @@ -182,7 +182,7 @@ minetest.register_node("mcl_nether:quartz_block", { tiles = {"mcl_nether_quartz_block_top.png", "mcl_nether_quartz_block_bottom.png", "mcl_nether_quartz_block_side.png"}, groups = {pickaxey=1, quartz_block=1,building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 0.8, _mcl_hardness = 0.8, }) @@ -194,7 +194,7 @@ minetest.register_node("mcl_nether:quartz_chiseled", { tiles = {"mcl_nether_quartz_chiseled_top.png", "mcl_nether_quartz_chiseled_top.png", "mcl_nether_quartz_chiseled_side.png"}, groups = {pickaxey=1, quartz_block=1,building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 0.8, _mcl_hardness = 0.8, }) @@ -209,7 +209,7 @@ minetest.register_node("mcl_nether:quartz_pillar", { groups = {pickaxey=1, quartz_block=1,building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), on_rotate = on_rotate, - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 0.8, _mcl_hardness = 0.8, }) minetest.register_node("mcl_nether:quartz_smooth", { @@ -220,7 +220,7 @@ minetest.register_node("mcl_nether:quartz_smooth", { tiles = {"mcl_nether_quartz_block_bottom.png"}, groups = {pickaxey=1, quartz_block=1,building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 0.8, _mcl_hardness = 0.8, }) diff --git a/mods/ITEMS/mcl_ocean/corals.lua b/mods/ITEMS/mcl_ocean/corals.lua index 2a9015ec7..7b076c3e4 100644 --- a/mods/ITEMS/mcl_ocean/corals.lua +++ b/mods/ITEMS/mcl_ocean/corals.lua @@ -90,7 +90,7 @@ for c=1, #corals do sounds = mcl_sounds.node_sound_dirt_defaults(), drop = "mcl_ocean:dead_"..id.."_coral_block", _mcl_hardness = 1.5, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, }) minetest.register_node("mcl_ocean:dead_"..id.."_coral_block", { description = corals[c][3], @@ -99,7 +99,7 @@ for c=1, #corals do groups = { pickaxey = 1, building_block = 1, coral=2, coral_block=2, coral_species=c, }, sounds = mcl_sounds.node_sound_dirt_defaults(), _mcl_hardness = 1.5, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, }) -- Coral diff --git a/mods/ITEMS/mcl_ocean/prismarine.lua b/mods/ITEMS/mcl_ocean/prismarine.lua index 90626cfa9..5840d59ce 100644 --- a/mods/ITEMS/mcl_ocean/prismarine.lua +++ b/mods/ITEMS/mcl_ocean/prismarine.lua @@ -19,7 +19,7 @@ minetest.register_node("mcl_ocean:sea_lantern", { tiles = {{name="mcl_ocean_sea_lantern.png", animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=1.25}}}, groups = {handy=1, building_block=1, material_glass=1}, sounds = mcl_sounds.node_sound_glass_defaults(), - _mcl_blast_resistance = 1.5, + _mcl_blast_resistance = 0.3, _mcl_hardness = 0.3, }) @@ -32,7 +32,7 @@ minetest.register_node("mcl_ocean:prismarine", { tiles = {{name="mcl_ocean_prismarine_anim.png", animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=45.0}}}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 1.5, _mcl_hardness = 1.5, }) @@ -44,7 +44,7 @@ minetest.register_node("mcl_ocean:prismarine_brick", { tiles = {"mcl_ocean_prismarine_bricks.png"}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 1.5, _mcl_hardness = 1.5, }) @@ -56,7 +56,7 @@ minetest.register_node("mcl_ocean:prismarine_dark", { tiles = {"mcl_ocean_prismarine_dark.png"}, groups = {pickaxey=1, building_block=1, material_stone=1}, sounds = mcl_sounds.node_sound_stone_defaults(), - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 1.5, _mcl_hardness = 1.5, }) diff --git a/mods/ITEMS/mcl_portals/portal_end.lua b/mods/ITEMS/mcl_portals/portal_end.lua index c7e8cf8d6..8506dd271 100644 --- a/mods/ITEMS/mcl_portals/portal_end.lua +++ b/mods/ITEMS/mcl_portals/portal_end.lua @@ -79,7 +79,7 @@ minetest.register_node("mcl_portals:portal_end", { groups = {portal=1, not_in_creative_inventory = 1, disable_jump = 1}, _mcl_hardness = -1, - _mcl_blast_resistance = 18000000, + _mcl_blast_resistance = 36000000, }) -- Obsidian platform at the End portal destination in the End @@ -329,7 +329,7 @@ minetest.register_node("mcl_portals:end_portal_frame", { on_rotate = rotate_frame, - _mcl_blast_resistance = 18000000, + _mcl_blast_resistance = 36000000, _mcl_hardness = -1, }) @@ -368,7 +368,7 @@ minetest.register_node("mcl_portals:end_portal_frame_eye", { on_rotate = rotate_frame_eye, - _mcl_blast_resistance = 18000000, + _mcl_blast_resistance = 36000000, _mcl_hardness = -1, }) diff --git a/mods/ITEMS/mcl_signs/init.lua b/mods/ITEMS/mcl_signs/init.lua index 442458a91..afb8423ed 100644 --- a/mods/ITEMS/mcl_signs/init.lua +++ b/mods/ITEMS/mcl_signs/init.lua @@ -412,7 +412,7 @@ minetest.register_node("mcl_signs:wall_sign", { end end, _mcl_hardness = 1, - _mcl_blast_resistance = 5, + _mcl_blast_resistance = 1, }) -- Standing sign nodes. @@ -452,7 +452,7 @@ local ssign = { end, _mcl_hardness = 1, - _mcl_blast_resistance = 5, + _mcl_blast_resistance = 1, } minetest.register_node("mcl_signs:standing_sign", ssign) diff --git a/mods/ITEMS/mcl_sponges/init.lua b/mods/ITEMS/mcl_sponges/init.lua index 28edb4f76..db68b2815 100644 --- a/mods/ITEMS/mcl_sponges/init.lua +++ b/mods/ITEMS/mcl_sponges/init.lua @@ -90,7 +90,7 @@ minetest.register_node("mcl_sponges:sponge", { end return minetest.item_place_node(itemstack, placer, pointed_thing) end, - _mcl_blast_resistance = 3, + _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, }) @@ -108,7 +108,7 @@ minetest.register_node("mcl_sponges:sponge_wet", { stack_max = 64, sounds = mcl_sounds.node_sound_dirt_defaults(), groups = {handy=1, building_block=1}, - _mcl_blast_resistance = 3, + _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, }) @@ -127,7 +127,7 @@ if minetest.get_modpath("mclx_core") then stack_max = 64, sounds = mcl_sounds.node_sound_dirt_defaults(), groups = {handy=1, building_block=1}, - _mcl_blast_resistance = 3, + _mcl_blast_resistance = 0.6, _mcl_hardness = 0.6, }) diff --git a/mods/ITEMS/mcl_walls/init.lua b/mods/ITEMS/mcl_walls/init.lua index be07d5490..5704309db 100644 --- a/mods/ITEMS/mcl_walls/init.lua +++ b/mods/ITEMS/mcl_walls/init.lua @@ -166,7 +166,7 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory fixed = take }, sounds = sounds, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 2, }) @@ -193,7 +193,7 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory fixed = {pillar, full_blocks[1]} }, sounds = sounds, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 2, }) -- Add entry alias for the Help @@ -218,7 +218,7 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory fixed = {pillar, full_blocks[2]} }, sounds = sounds, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 2, }) -- Add entry alias for the Help @@ -249,7 +249,7 @@ function mcl_walls.register_wall(nodename, description, source, tiles, inventory collisionbox = {-0.2, 0, -0.2, 0.2, 1.4, 0.2}, on_construct = update_wall, sounds = sounds, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 2, }) if source then diff --git a/mods/ITEMS/mcl_wool/init.lua b/mods/ITEMS/mcl_wool/init.lua index 9e3785b3e..31649d70b 100644 --- a/mods/ITEMS/mcl_wool/init.lua +++ b/mods/ITEMS/mcl_wool/init.lua @@ -63,7 +63,7 @@ for _, row in ipairs(wool.dyes) do groups = {handy=1,shearsy_wool=1, flammable=1,wool=1,building_block=1,[color_group]=1}, sounds = mcl_sounds.node_sound_wool_defaults(), _mcl_hardness = 0.8, - _mcl_blast_resistance = 4, + _mcl_blast_resistance = 0.8, }) minetest.register_node("mcl_wool:"..name.."_carpet", { description = desc_carpet, @@ -89,7 +89,7 @@ for _, row in ipairs(wool.dyes) do }, }, _mcl_hardness = 0.1, - _mcl_blast_resistance = 0.5, + _mcl_blast_resistance = 0.1, }) if mod_doc and not is_canonical then doc.add_entry_alias("nodes", "mcl_wool:"..canonical_color, "nodes", "mcl_wool:"..name) diff --git a/mods/ITEMS/xpanes/init.lua b/mods/ITEMS/xpanes/init.lua index 6f8ff22b4..b98d65e38 100644 --- a/mods/ITEMS/xpanes/init.lua +++ b/mods/ITEMS/xpanes/init.lua @@ -202,7 +202,7 @@ local pane = function(description, node, append) {node, node, node}, }, drop = "", - _mcl_blast_resistance = 1.5, + _mcl_blast_resistance = 0.3, _mcl_hardness = 0.3, }) @@ -225,7 +225,7 @@ xpanes.register_pane("bar", { {"mcl_core:iron_ingot", "mcl_core:iron_ingot", "mcl_core:iron_ingot"}, {"mcl_core:iron_ingot", "mcl_core:iron_ingot", "mcl_core:iron_ingot"}, }, - _mcl_blast_resistance = 30, + _mcl_blast_resistance = 6, _mcl_hardness = 5, }) From 92ab90fd1b028d76735443201b374ee6b961bc2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Sat, 18 Apr 2020 12:19:18 +0200 Subject: [PATCH 08/30] Add knockback for mobs --- mods/CORE/mcl_explosions/init.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 225c2e770..e0a71bf6d 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -322,17 +322,18 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) -- Punch entity with damage depending on explosion exposure and -- distance to explosion local exposure = count / N_EXPOSURE_RAYS - local punch_vec = vector.subtract(pos, opos) + local punch_vec = vector.subtract(opos, pos) local punch_dir = vector.normalize(punch_vec) local impact = (1 - vector.length(punch_vec) / punch_radius) * exposure if impact < 0 then impact = 0 end local damage = math.floor((impact * impact + impact) * 7 * strength + 1) - obj:punch(obj, nil, { damage_groups = { fleshy = damage } }, punch_dir) + obj:punch(obj, 10, { damage_groups = { full_punch_interval = 1, + fleshy = damage, knockback = impact * 20.0 } }, punch_dir) if obj:is_player() then - obj:add_player_velocity(vector.multiply(punch_dir, -exposure * 20)) + obj:add_player_velocity(vector.multiply(punch_dir, impact * 20)) end end end From cdea2eeabf570a22ca2a79710a019093e63b6f47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Sat, 18 Apr 2020 12:22:28 +0200 Subject: [PATCH 09/30] Change mcl_mobs to enable knockback in y direction --- mods/ENTITIES/mcl_mobs/api.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 86ec7ee31..69657cea0 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -2730,7 +2730,7 @@ local mob_punch = function(self, hitter, tflp, tool_capabilities, dir) self.object:set_velocity({ x = dir.x * kb, - y = up, + y = dir.y * kb + up, z = dir.z * kb }) From b4ea2afe77ecae00140e602fc459ce94120a3d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Sat, 18 Apr 2020 14:16:32 +0200 Subject: [PATCH 10/30] Add tnt_knockback flag for entities When set to true, entities will be knocked back when affected by TNT explosions. Also ignore '__builtin:item' entities to reduce lag, and replace tabs with spaces in 'mcl_explosions/init.lua'. --- mods/CORE/mcl_explosions/init.lua | 181 +++++++++++++++--------------- 1 file changed, 92 insertions(+), 89 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index e0a71bf6d..b8358acd5 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -144,21 +144,21 @@ end -- pos - The position of the explosion -- radius - The radius of the explosion local function add_particles(pos, radius) - minetest.add_particlespawner({ - amount = 64, - time = 0.125, - minpos = pos, - maxpos = pos, - minvel = {x = -radius, y = -radius, z = -radius}, - maxvel = {x = radius, y = radius, z = radius}, - minacc = vector.new(), - maxacc = vector.new(), - minexptime = 0.5, - maxexptime = 1.0, - minsize = radius * 0.5, - maxsize = radius * 1.0, - texture = "tnt_smoke.png", - }) + minetest.add_particlespawner({ + amount = 64, + time = 0.125, + minpos = pos, + maxpos = pos, + minvel = {x = -radius, y = -radius, z = -radius}, + maxvel = {x = radius, y = radius, z = radius}, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 0.5, + maxexptime = 1.0, + minsize = radius * 0.5, + maxsize = radius * 1.0, + texture = "tnt_smoke.png", + }) end -- Get position from hash. This should be identical to @@ -242,7 +242,7 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) end if cid ~= AIR_CID then - destroy[hash] = idx + destroy[hash] = idx end end end @@ -253,88 +253,91 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) -- Trace rays for entity damage for _, obj in pairs(objs) do - -- Object position and direction to explosion center - local opos = obj:get_pos() + local ent = obj:get_luaentity() - if obj:get_luaentity() ~= nil or obj:is_player() then + -- Ignore items to lower lag + if obj:is_player() or (ent and ent.name ~= '__builtin.item') then + local opos = obj:get_pos() local collisionbox = nil if obj:is_player() then - collisionbox = { -0.3, 0.0, -0.3, 0.3, 1.77, 0.3 } - elseif obj:get_luaentity().name then - local def = minetest.registered_entities[obj:get_luaentity().name] - collisionbox = def.collisionbox + collisionbox = { -0.3, 0.0, -0.3, 0.3, 1.77, 0.3 } + elseif ent.name then + local def = minetest.registered_entities[ent.name] + collisionbox = def.collisionbox end if collisionbox then - -- Create rays from random points in the collision box - local x1 = collisionbox[1] * 2 - local y1 = collisionbox[2] * 2 - local z1 = collisionbox[3] * 2 - local x2 = collisionbox[4] * 2 - local y2 = collisionbox[5] * 2 - local z2 = collisionbox[6] * 2 - local x_len = math.abs(x2 - x1) - local y_len = math.abs(y2 - y1) - local z_len = math.abs(z2 - z1) + -- Create rays from random points in the collision box + local x1 = collisionbox[1] * 2 + local y1 = collisionbox[2] * 2 + local z1 = collisionbox[3] * 2 + local x2 = collisionbox[4] * 2 + local y2 = collisionbox[5] * 2 + local z2 = collisionbox[6] * 2 + local x_len = math.abs(x2 - x1) + local y_len = math.abs(y2 - y1) + local z_len = math.abs(z2 - z1) - -- Move object position to the center of its bounding box - opos.x = opos.x + x1 + x2 - opos.y = opos.y + y1 + y2 - opos.z = opos.z + z1 + z2 + -- Move object position to the center of its bounding box + opos.x = opos.x + x1 + x2 + opos.y = opos.y + y1 + y2 + opos.z = opos.z + z1 + z2 - -- Count number of rays from collision box which are unobstructed - local count = N_EXPOSURE_RAYS + -- Count number of rays from collision box which are unobstructed + local count = N_EXPOSURE_RAYS - for i = 1, N_EXPOSURE_RAYS do - local rpos_x = opos.x + math.random() * x_len - x_len / 2 - local rpos_y = opos.y + math.random() * y_len - y_len / 2 - local rpos_z = opos.z + math.random() * z_len - z_len / 2 - local rdir_x = pos.x - rpos_x - local rdir_y = pos.y - rpos_y - local rdir_z = pos.z - rpos_z - local rdir_len = math.hypot(rdir_x, math.hypot(rdir_y, rdir_z)) - rdir_x = rdir_x / rdir_len - rdir_y = rdir_y / rdir_len - rdir_z = rdir_z / rdir_len + for i = 1, N_EXPOSURE_RAYS do + local rpos_x = opos.x + math.random() * x_len - x_len / 2 + local rpos_y = opos.y + math.random() * y_len - y_len / 2 + local rpos_z = opos.z + math.random() * z_len - z_len / 2 + local rdir_x = pos.x - rpos_x + local rdir_y = pos.y - rpos_y + local rdir_z = pos.z - rpos_z + local rdir_len = math.hypot(rdir_x, math.hypot(rdir_y, rdir_z)) + rdir_x = rdir_x / rdir_len + rdir_y = rdir_y / rdir_len + rdir_z = rdir_z / rdir_len - for i=0, rdir_len / STEP_LENGTH do - rpos_x = rpos_x + rdir_x * STEP_LENGTH - rpos_y = rpos_y + rdir_y * STEP_LENGTH - rpos_z = rpos_z + rdir_z * STEP_LENGTH - local npos_x = math.floor(rpos_x + 0.5) - local npos_y = math.floor(rpos_y + 0.5) - local npos_z = math.floor(rpos_z + 0.5) - local idx = (npos_z - emin_z) * zstride + (npos_y - emin_y) * ystride + - npos_x - emin_x + 1 + for i=0, rdir_len / STEP_LENGTH do + rpos_x = rpos_x + rdir_x * STEP_LENGTH + rpos_y = rpos_y + rdir_y * STEP_LENGTH + rpos_z = rpos_z + rdir_z * STEP_LENGTH + local npos_x = math.floor(rpos_x + 0.5) + local npos_y = math.floor(rpos_y + 0.5) + local npos_z = math.floor(rpos_z + 0.5) + local idx = (npos_z - emin_z) * zstride + (npos_y - emin_y) * ystride + + npos_x - emin_x + 1 - local cid = data[idx] - local br = node_br[cid] + local cid = data[idx] + local br = node_br[cid] - if br ~= 0 then - count = count - 1 - break - end - end - end + if br ~= 0 then + count = count - 1 + break + end + end + end - -- Punch entity with damage depending on explosion exposure and - -- distance to explosion - local exposure = count / N_EXPOSURE_RAYS - local punch_vec = vector.subtract(opos, pos) - local punch_dir = vector.normalize(punch_vec) - local impact = (1 - vector.length(punch_vec) / punch_radius) * exposure - if impact < 0 then - impact = 0 - end - local damage = math.floor((impact * impact + impact) * 7 * strength + 1) + -- Punch entity with damage depending on explosion exposure and + -- distance to explosion + local exposure = count / N_EXPOSURE_RAYS + local punch_vec = vector.subtract(opos, pos) + local punch_dir = vector.normalize(punch_vec) + local impact = (1 - vector.length(punch_vec) / punch_radius) * exposure + if impact < 0 then + impact = 0 + end + local damage = math.floor((impact * impact + impact) * 7 * strength + 1) obj:punch(obj, 10, { damage_groups = { full_punch_interval = 1, - fleshy = damage, knockback = impact * 20.0 } }, punch_dir) + fleshy = damage, knockback = impact * 20.0 } }, punch_dir) - if obj:is_player() then - obj:add_player_velocity(vector.multiply(punch_dir, impact * 20)) - end + if obj:is_player() then + obj:add_player_velocity(vector.multiply(punch_dir, impact * 20)) + elseif ent.tnt_knockback then + obj:add_velocity(vector.multiply(punch_dir, impact * 20)) + end end end end @@ -348,16 +351,16 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) if do_drop or on_blast ~= nil then local npos = get_position_from_hash(hash) if on_blast ~= nil then - remove = on_blast(npos, 1.0) + remove = on_blast(npos, 1.0) else - local name = minetest.get_name_from_content_id(data[idx]) - local drop = minetest.get_node_drops(name, "") + local name = minetest.get_name_from_content_id(data[idx]) + local drop = minetest.get_node_drops(name, "") - for _, item in ipairs(drop) do - if type(item) == "string" then - minetest.add_item(npos, item) - end - end + for _, item in ipairs(drop) do + if type(item) == "string" then + minetest.add_item(npos, item) + end + end end end if remove then From 64c767ad8c8e9137b2793e5f3b93f1632184dfaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Sat, 18 Apr 2020 14:18:23 +0200 Subject: [PATCH 11/30] Make TNT behave like Minecraft TNT entities are now knocked back by explosions. When a TNT block becomes triggered by an explosion, its fuse time is set to a random value between 0.5 and 1.5 seconds. --- mods/ITEMS/mcl_tnt/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index 5f53afaf8..0ec2679b8 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -104,7 +104,8 @@ minetest.register_node("mcl_tnt:tnt", { groups = { dig_immediate = 3, tnt = 1, enderman_takable=1 }, mesecons = tnt_mesecons, on_blast = function(pos) - spawn_tnt(pos, "mcl_tnt:tnt") + local e = spawn_tnt(pos, "mcl_tnt:tnt") + e:get_luaentity().timer = tnt.BOOMTIMER - (0.5 + math.random()) return true end, _on_ignite = function(player, pointed_thing) @@ -133,6 +134,7 @@ local TNT = { -- Initial value for our timer timer = 0, blinktimer = 0, + tnt_knockback = true, blinkstatus = true,} function TNT:on_activate(staticdata) From a62a75c79986ba37089e17f1c287c61adf8c42ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Sat, 18 Apr 2020 22:16:29 +0200 Subject: [PATCH 12/30] Do not drop items in creative mode It works like this in Minecraft. This will also reduce lag when playing with TNT in creative. --- mods/CORE/mcl_explosions/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index b8358acd5..22dae608f 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -19,6 +19,8 @@ mcl_explosions = {} +local creative_mode = minetest.settings:get_bool("creative_mode") + -- Saved sphere explosion shapes for various radiuses local sphere_shapes = {} @@ -344,7 +346,7 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) -- Remove destroyed blocks and drop items for hash, idx in pairs(destroy) do - local do_drop = math.random() <= drop_chance + local do_drop = not creative_mode and math.random() <= drop_chance local on_blast = node_on_blast[data[idx]] local remove = true From a10dff84214c89b6768f5d3ce0cdaed3bb9bb5f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Sat, 18 Apr 2020 23:06:08 +0200 Subject: [PATCH 13/30] Use walkable for entity exposure This makes TNT do full damage under water. --- mods/CORE/mcl_explosions/init.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 22dae608f..1c016c080 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -25,8 +25,9 @@ local creative_mode = minetest.settings:get_bool("creative_mode") local sphere_shapes = {} -- Saved node definitions in table using cid-keys for faster look-up. -local node_br = {} +local node_blastres = {} local node_on_blast = {} +local node_walkable = {} local AIR_CID = minetest.get_content_id('air') @@ -39,8 +40,9 @@ local N_EXPOSURE_RAYS = 16 minetest.after(0, function() -- Store blast resistance values by content ids to improve performance. for name, def in pairs(minetest.registered_nodes) do - node_br[minetest.get_content_id(name)] = def._mcl_blast_resistance or 0 + node_blastres[minetest.get_content_id(name)] = def._mcl_blast_resistance or 0 node_on_blast[minetest.get_content_id(name)] = def.on_blast + node_walkable[minetest.get_content_id(name)] = def.walkable end end) @@ -228,7 +230,7 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) npos_x - emin_x + 1 local cid = data[idx] - local br = node_br[cid] + local br = node_blastres[cid] local hash = (npos_z + 32768) * 65536 * 65536 + (npos_y + 32768) * 65536 + npos_x + 32768 @@ -313,9 +315,9 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) local cid = data[idx] - local br = node_br[cid] + local walkable = node_walkable[cid] - if br ~= 0 then + if walkable then count = count - 1 break end From ef20ac54c3872b722db8824bb294cca08c8f81eb Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Apr 2020 18:13:05 +0200 Subject: [PATCH 14/30] Fix crash when fueling furnace minecart --- mods/ENTITIES/mcl_minecarts/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_minecarts/init.lua b/mods/ENTITIES/mcl_minecarts/init.lua index 14f70d246..95fcbf2d6 100644 --- a/mods/ENTITIES/mcl_minecarts/init.lua +++ b/mods/ENTITIES/mcl_minecarts/init.lua @@ -685,7 +685,7 @@ register_minecart( if not minetest.settings:get_bool("creative_mode") then held:take_item() - local index = clicker:get_wielded_index() + local index = clicker:get_wield_index() local inv = clicker:get_inventory() inv:set_stack("main", index, held) end From 8dd1cf6719b2cf4a5768cb47503ed9198b2693c8 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Apr 2020 18:25:23 +0200 Subject: [PATCH 15/30] Update Contributing guidelines --- CONTRIBUTING.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 57b1a41f9..ec238b327 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ Wow, thank you! :-) But first, some things to note: MineClone 2's development target is to make a free software clone of Minecraft, -***version 1.11*** (later: 1.12), ***PC edition***. +***version 1.11***, ***PC edition***. MineClone 2 is maintained by one person. Namely, Wuzzy. You can find me, Wuzzy, in the Minetest forums (forums.minetest.net), in IRC in the #minetest @@ -26,8 +26,9 @@ For small and medium changes: * Fork the repository * Do your change in a new branch -* Upload the repository somewhere where it can be accessed from the Internet -* Ask me to pull in your changes (and briefly say what you're changed) +* Post a pull request here: https://git.minetest.land/Wuzzy/MineClone2/pulls +* Alternatively: Upload the repository somewhere where it can be accessed + from the Internet and notify me For small changes, sending me a patch is also good. @@ -35,7 +36,7 @@ For big changes: Same as above, but consider notifying me first to avoid duplicate work and possible tears of rejection. ;-) ## Quality remarks -Again: There is ***no*** guarantee I will accept anything from anything. +Again: There is ***no*** guarantee I will accept anything from anybody. But I will gladly take in code from others when I feel it saves me work in the long run. @@ -64,10 +65,10 @@ Depending on what you add, the chances for inclusion vary: ## Coding style guide * Indentations should reflect the code flow -* Use tabs, not spaces for indentation +* Use tabs, not spaces for indentation (tab size = 8) * Never use `minetest.env` ## Reporting bugs Report all bugs and missing Minecraft features here: - + From 58458b2bca1f30191de98e17744607a81d6413fb Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Apr 2020 20:55:49 +0200 Subject: [PATCH 16/30] mcl_explosions: Rename description.txt --- mods/CORE/mcl_explosions/description.txt | 1 - mods/CORE/mcl_explosions/mod.conf | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) delete mode 100644 mods/CORE/mcl_explosions/description.txt create mode 100644 mods/CORE/mcl_explosions/mod.conf diff --git a/mods/CORE/mcl_explosions/description.txt b/mods/CORE/mcl_explosions/description.txt deleted file mode 100644 index a9d5288b5..000000000 --- a/mods/CORE/mcl_explosions/description.txt +++ /dev/null @@ -1 +0,0 @@ -This mod adds a common API to create explosions. diff --git a/mods/CORE/mcl_explosions/mod.conf b/mods/CORE/mcl_explosions/mod.conf new file mode 100644 index 000000000..382ece9a4 --- /dev/null +++ b/mods/CORE/mcl_explosions/mod.conf @@ -0,0 +1,2 @@ +name = mcl_explosions +description = A common API to create explosions. From 9ee0ef5a8d60fae8efbd7732f9212d0b3d8570f6 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Apr 2020 20:57:38 +0200 Subject: [PATCH 17/30] Explosions: Replace some API calls --- mods/CORE/mcl_explosions/init.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 1c016c080..02a7d7ae1 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -29,15 +29,13 @@ local node_blastres = {} local node_on_blast = {} local node_walkable = {} -local AIR_CID = minetest.get_content_id('air') - -- The step length for the rays (Minecraft uses 0.3) local STEP_LENGTH = 0.3 -- How many rays to compute entity exposure to explosion local N_EXPOSURE_RAYS = 16 -minetest.after(0, function() +minetest.register_on_mods_loaded(function()) -- Store blast resistance values by content ids to improve performance. for name, def in pairs(minetest.registered_nodes) do node_blastres[minetest.get_content_id(name)] = def._mcl_blast_resistance or 0 @@ -245,7 +243,7 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) break end - if cid ~= AIR_CID then + if cid ~= minetest.CONTENT_AIR then destroy[hash] = idx end end @@ -368,7 +366,7 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) end end if remove then - data[idx] = AIR_CID + data[idx] = minetest.CONTENT_AIR end end From 2b5ddbd62d9afe11ba4950d3c0e794a9726b0059 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Apr 2020 20:58:58 +0200 Subject: [PATCH 18/30] Explosions: Change item drop handler --- mods/CORE/mcl_explosions/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 02a7d7ae1..a85d8c0fd 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -359,9 +359,10 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) local drop = minetest.get_node_drops(name, "") for _, item in ipairs(drop) do - if type(item) == "string" then - minetest.add_item(npos, item) + if item ~= "string" then + item = item:get_name() .. item:get_count() end + minetest.add_item(npos, item) end end end From 772ea01aff7154255045ab379fba78623d164cfb Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Apr 2020 21:00:13 +0200 Subject: [PATCH 19/30] Explosions: Fix syntax error --- mods/CORE/mcl_explosions/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index a85d8c0fd..7f6e4909f 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -35,7 +35,7 @@ local STEP_LENGTH = 0.3 -- How many rays to compute entity exposure to explosion local N_EXPOSURE_RAYS = 16 -minetest.register_on_mods_loaded(function()) +minetest.register_on_mods_loaded(function() -- Store blast resistance values by content ids to improve performance. for name, def in pairs(minetest.registered_nodes) do node_blastres[minetest.get_content_id(name)] = def._mcl_blast_resistance or 0 From 679e2b1b702c96c96a808b216b8f5e87c894a3f3 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Apr 2020 21:08:42 +0200 Subject: [PATCH 20/30] Explosions: Reduce repeated code --- mods/CORE/mcl_explosions/init.lua | 101 ++++++++++-------------------- 1 file changed, 34 insertions(+), 67 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 7f6e4909f..4a1da2326 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -55,79 +55,46 @@ local function compute_sphere_rays(radius) local rays = {} local sphere = {} - for y = -radius, radius do - for z = -radius, radius do - for x = -radius, 0, 1 do - local d = x * x + y * y + z * z - if d <= radius * radius then - local pos = { x = x, y = y, z = z } - sphere[minetest.hash_node_position(pos)] = pos - break - end - end - end - end - - for y = -radius, radius do - for z = -radius, radius do - for x = radius, 0, -1 do - local d = x * x + y * y + z * z - if d <= radius * radius then - local pos = { x = x, y = y, z = z } - sphere[minetest.hash_node_position(pos)] = pos - break - end - end - end - end - - for x = -radius, radius do - for z = -radius, radius do - for y = -radius, 0, 1 do - local d = x * x + y * y + z * z - if d <= radius * radius then - local pos = { x = x, y = y, z = z } - sphere[minetest.hash_node_position(pos)] = pos - break - end - end - end - end - - for x = -radius, radius do - for z = -radius, radius do - for y = radius, 0, -1 do - local d = x * x + y * y + z * z - if d <= radius * radius then - local pos = { x = x, y = y, z = z } - sphere[minetest.hash_node_position(pos)] = pos - break - end - end - end - end - - for x = -radius, radius do + for i=1, 2 do for y = -radius, radius do - for z = -radius, 0, 1 do - local d = x * x + y * y + z * z - if d <= radius * radius then - local pos = { x = x, y = y, z = z } - sphere[minetest.hash_node_position(pos)] = pos - break + for z = -radius, radius do + for x = -radius, 0, 1 do + local d = x * x + y * y + z * z + if d <= radius * radius then + local pos = { x = x, y = y, z = z } + sphere[minetest.hash_node_position(pos)] = pos + break + end end end end end - for x = -radius, radius do - for y = -radius, radius do - for z = radius, 0, -1 do - local d = x * x + y * y + z * z - if d <= radius * radius then - local pos = { x = x, y = y, z = z } - sphere[minetest.hash_node_position(pos)] = pos - break + for i=1,2 do + for x = -radius, radius do + for z = -radius, radius do + for y = -radius, 0, 1 do + local d = x * x + y * y + z * z + if d <= radius * radius then + local pos = { x = x, y = y, z = z } + sphere[minetest.hash_node_position(pos)] = pos + break + end + end + end + end + end + + for i=1,2 do + for x = -radius, radius do + for y = -radius, radius do + for z = -radius, 0, 1 do + local d = x * x + y * y + z * z + if d <= radius * radius then + local pos = { x = x, y = y, z = z } + sphere[minetest.hash_node_position(pos)] = pos + break + end end end end From 026d406d4b69a74dff5f3513bffc3a8ebebf235d Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Apr 2020 21:12:30 +0200 Subject: [PATCH 21/30] Fix indents in mcl_explosions --- mods/CORE/mcl_explosions/init.lua | 564 +++++++++++++++--------------- 1 file changed, 279 insertions(+), 285 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 4a1da2326..143db2ca7 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -1,19 +1,13 @@ ---[[ .__ .__ - ____ ___ _________ | | ____ _____|__| ____ ____ ______ - _/ __ \\ \/ /\____ \| | / _ \/ ___/ |/ _ \ / \ / ___/ - \ ___/ > < | |_> > |_( <_> )___ \| ( <_> ) | \\___ \ - \___ >__/\_ \| __/|____/\____/____ >__|\____/|___| /____ > - \/ \/|__| \/ \/ \/ +--[[ +Explosion API mod for Minetest (adapted to MineClone 2) - Explosion API mod for Minetest (adapted to MineClone 2) +This mod is based on the Minetest explosion API mod, but has been changed +to have the same explosion mechanics as Minecraft and work with MineClone. +The computation-intensive parts of the mod has been optimized to allow for +larger explosions and faster world updating. - This mod is based on the Minetest explosion API mod, but has been changed - to have the same explosion mechanics as Minecraft and work with MineClone. - The computation-intensive parts of the mod has been optimized to allow for - larger explosions and faster world updating. - - This mod was created by Elias Astrom and is released - under the LGPLv2.1 license. +This mod was created by Elias Astrom and is released +under the LGPLv2.1 license. --]] @@ -36,348 +30,348 @@ local STEP_LENGTH = 0.3 local N_EXPOSURE_RAYS = 16 minetest.register_on_mods_loaded(function() - -- Store blast resistance values by content ids to improve performance. - for name, def in pairs(minetest.registered_nodes) do - node_blastres[minetest.get_content_id(name)] = def._mcl_blast_resistance or 0 - node_on_blast[minetest.get_content_id(name)] = def.on_blast - node_walkable[minetest.get_content_id(name)] = def.walkable - end + -- Store blast resistance values by content ids to improve performance. + for name, def in pairs(minetest.registered_nodes) do + node_blastres[minetest.get_content_id(name)] = def._mcl_blast_resistance or 0 + node_on_blast[minetest.get_content_id(name)] = def.on_blast + node_walkable[minetest.get_content_id(name)] = def.walkable + end end) --- Compute the rays which make up a sphere with radius. Returns a list of rays --- which can be used to trace explosions. This function is not efficient +-- Compute the rays which make up a sphere with radius. Returns a list of rays +-- which can be used to trace explosions. This function is not efficient -- (especially for larger radiuses), so the generated rays for various radiuses -- should be cached and reused. -- -- Should be possible to improve by using a midpoint circle algorithm multiple -- times to create the sphere, currently uses more of a brute-force approach. local function compute_sphere_rays(radius) - local rays = {} - local sphere = {} + local rays = {} + local sphere = {} - for i=1, 2 do - for y = -radius, radius do - for z = -radius, radius do - for x = -radius, 0, 1 do - local d = x * x + y * y + z * z - if d <= radius * radius then - local pos = { x = x, y = y, z = z } - sphere[minetest.hash_node_position(pos)] = pos - break - end - end - end - end - end + for i=1, 2 do + for y = -radius, radius do + for z = -radius, radius do + for x = -radius, 0, 1 do + local d = x * x + y * y + z * z + if d <= radius * radius then + local pos = { x = x, y = y, z = z } + sphere[minetest.hash_node_position(pos)] = pos + break + end + end + end + end + end - for i=1,2 do - for x = -radius, radius do - for z = -radius, radius do - for y = -radius, 0, 1 do - local d = x * x + y * y + z * z - if d <= radius * radius then - local pos = { x = x, y = y, z = z } - sphere[minetest.hash_node_position(pos)] = pos - break - end - end - end - end - end + for i=1,2 do + for x = -radius, radius do + for z = -radius, radius do + for y = -radius, 0, 1 do + local d = x * x + y * y + z * z + if d <= radius * radius then + local pos = { x = x, y = y, z = z } + sphere[minetest.hash_node_position(pos)] = pos + break + end + end + end + end + end - for i=1,2 do - for x = -radius, radius do - for y = -radius, radius do - for z = -radius, 0, 1 do - local d = x * x + y * y + z * z - if d <= radius * radius then - local pos = { x = x, y = y, z = z } - sphere[minetest.hash_node_position(pos)] = pos - break - end - end - end - end - end + for i=1,2 do + for x = -radius, radius do + for y = -radius, radius do + for z = -radius, 0, 1 do + local d = x * x + y * y + z * z + if d <= radius * radius then + local pos = { x = x, y = y, z = z } + sphere[minetest.hash_node_position(pos)] = pos + break + end + end + end + end + end - for _, pos in pairs(sphere) do - rays[#rays + 1] = vector.normalize(pos) - end + for _, pos in pairs(sphere) do + rays[#rays + 1] = vector.normalize(pos) + end - return rays + return rays end -- Add particles from explosion -- -- Parameters: --- pos - The position of the explosion --- radius - The radius of the explosion +-- pos - The position of the explosion +-- radius - The radius of the explosion local function add_particles(pos, radius) - minetest.add_particlespawner({ - amount = 64, - time = 0.125, - minpos = pos, - maxpos = pos, - minvel = {x = -radius, y = -radius, z = -radius}, - maxvel = {x = radius, y = radius, z = radius}, - minacc = vector.new(), - maxacc = vector.new(), - minexptime = 0.5, - maxexptime = 1.0, - minsize = radius * 0.5, - maxsize = radius * 1.0, - texture = "tnt_smoke.png", - }) + minetest.add_particlespawner({ + amount = 64, + time = 0.125, + minpos = pos, + maxpos = pos, + minvel = {x = -radius, y = -radius, z = -radius}, + maxvel = {x = radius, y = radius, z = radius}, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 0.5, + maxexptime = 1.0, + minsize = radius * 0.5, + maxsize = radius * 1.0, + texture = "tnt_smoke.png", + }) end --- Get position from hash. This should be identical to +-- Get position from hash. This should be identical to -- 'minetest.get_position_from_hash' but is used in case the hashing function -- would change. local function get_position_from_hash(hash) - local pos = {} - pos.x = (hash % 65536) - 32768 - hash = math.floor(hash / 65536) - pos.y = (hash % 65536) - 32768 - hash = math.floor(hash / 65536) - pos.z = (hash % 65536) - 32768 - return pos + local pos = {} + pos.x = (hash % 65536) - 32768 + hash = math.floor(hash / 65536) + pos.y = (hash % 65536) - 32768 + hash = math.floor(hash / 65536) + pos.z = (hash % 65536) - 32768 + return pos end -- Traces the rays of an explosion, and updates the environment. -- -- Parameters: --- pos - Where the rays in the explosion should start from --- strength - The strength of each ray --- raydirs - The directions for each ray --- radius - The maximum distance each ray will go --- drop_chance - The chance that destroyed nodes will drop their items +-- pos - Where the rays in the explosion should start from +-- strength - The strength of each ray +-- raydirs - The directions for each ray +-- radius - The maximum distance each ray will go +-- drop_chance - The chance that destroyed nodes will drop their items -- -- Note that this function has been optimized, it contains code which has been --- inlined to avoid function calls and unnecessary table creation. This was +-- inlined to avoid function calls and unnecessary table creation. This was -- measured to give a significant performance increase. local function trace_explode(pos, strength, raydirs, radius, drop_chance) - local vm = minetest.get_voxel_manip() + local vm = minetest.get_voxel_manip() - local emin, emax = vm:read_from_map(vector.subtract(pos, radius), - vector.add(pos, radius)) - local emin_x = emin.x - local emin_y = emin.y - local emin_z = emin.z + local emin, emax = vm:read_from_map(vector.subtract(pos, radius), + vector.add(pos, radius)) + local emin_x = emin.x + local emin_y = emin.y + local emin_z = emin.z - local ystride = (emax.x - emin_x + 1) - local zstride = ystride * (emax.y - emin_y + 1) - local pos_x = pos.x - local pos_y = pos.y - local pos_z = pos.z + local ystride = (emax.x - emin_x + 1) + local zstride = ystride * (emax.y - emin_y + 1) + local pos_x = pos.x + local pos_y = pos.y + local pos_z = pos.z - local area = VoxelArea:new { - MinEdge = emin, - MaxEdge = emax - } - local data = vm:get_data() - local destroy = {} + local area = VoxelArea:new { + MinEdge = emin, + MaxEdge = emax + } + local data = vm:get_data() + local destroy = {} - -- Trace rays for environment destruction - for i = 1, #raydirs do - local rpos_x = pos.x - local rpos_y = pos.y - local rpos_z = pos.z - local rdir_x = raydirs[i].x - local rdir_y = raydirs[i].y - local rdir_z = raydirs[i].z - local rstr = (0.7 + math.random() * 0.6) * strength + -- Trace rays for environment destruction + for i = 1, #raydirs do + local rpos_x = pos.x + local rpos_y = pos.y + local rpos_z = pos.z + local rdir_x = raydirs[i].x + local rdir_y = raydirs[i].y + local rdir_z = raydirs[i].z + local rstr = (0.7 + math.random() * 0.6) * strength - for r = 0, math.ceil(radius * (1.0 / STEP_LENGTH)) do - local npos_x = math.floor(rpos_x + 0.5) - local npos_y = math.floor(rpos_y + 0.5) - local npos_z = math.floor(rpos_z + 0.5) - local idx = (npos_z - emin_z) * zstride + (npos_y - emin_y) * ystride + - npos_x - emin_x + 1 + for r = 0, math.ceil(radius * (1.0 / STEP_LENGTH)) do + local npos_x = math.floor(rpos_x + 0.5) + local npos_y = math.floor(rpos_y + 0.5) + local npos_z = math.floor(rpos_z + 0.5) + local idx = (npos_z - emin_z) * zstride + (npos_y - emin_y) * ystride + + npos_x - emin_x + 1 - local cid = data[idx] - local br = node_blastres[cid] - local hash = (npos_z + 32768) * 65536 * 65536 + - (npos_y + 32768) * 65536 + - npos_x + 32768 + local cid = data[idx] + local br = node_blastres[cid] + local hash = (npos_z + 32768) * 65536 * 65536 + + (npos_y + 32768) * 65536 + + npos_x + 32768 - rpos_x = rpos_x + STEP_LENGTH * rdir_x - rpos_y = rpos_y + STEP_LENGTH * rdir_y - rpos_z = rpos_z + STEP_LENGTH * rdir_z + rpos_x = rpos_x + STEP_LENGTH * rdir_x + rpos_y = rpos_y + STEP_LENGTH * rdir_y + rpos_z = rpos_z + STEP_LENGTH * rdir_z - rstr = rstr - 0.75 * STEP_LENGTH - (br + 0.3) * STEP_LENGTH + rstr = rstr - 0.75 * STEP_LENGTH - (br + 0.3) * STEP_LENGTH - if rstr <= 0 then - break - end + if rstr <= 0 then + break + end - if cid ~= minetest.CONTENT_AIR then - destroy[hash] = idx - end - end - end + if cid ~= minetest.CONTENT_AIR then + destroy[hash] = idx + end + end + end - -- Entities in radius of explosion - local punch_radius = 2 * strength - local objs = minetest.get_objects_inside_radius(pos, punch_radius) + -- Entities in radius of explosion + local punch_radius = 2 * strength + local objs = minetest.get_objects_inside_radius(pos, punch_radius) - -- Trace rays for entity damage - for _, obj in pairs(objs) do - local ent = obj:get_luaentity() + -- Trace rays for entity damage + for _, obj in pairs(objs) do + local ent = obj:get_luaentity() - -- Ignore items to lower lag - if obj:is_player() or (ent and ent.name ~= '__builtin.item') then - local opos = obj:get_pos() - local collisionbox = nil + -- Ignore items to lower lag + if obj:is_player() or (ent and ent.name ~= '__builtin.item') then + local opos = obj:get_pos() + local collisionbox = nil - if obj:is_player() then - collisionbox = { -0.3, 0.0, -0.3, 0.3, 1.77, 0.3 } - elseif ent.name then - local def = minetest.registered_entities[ent.name] - collisionbox = def.collisionbox - end + if obj:is_player() then + collisionbox = { -0.3, 0.0, -0.3, 0.3, 1.77, 0.3 } + elseif ent.name then + local def = minetest.registered_entities[ent.name] + collisionbox = def.collisionbox + end - if collisionbox then - -- Create rays from random points in the collision box - local x1 = collisionbox[1] * 2 - local y1 = collisionbox[2] * 2 - local z1 = collisionbox[3] * 2 - local x2 = collisionbox[4] * 2 - local y2 = collisionbox[5] * 2 - local z2 = collisionbox[6] * 2 - local x_len = math.abs(x2 - x1) - local y_len = math.abs(y2 - y1) - local z_len = math.abs(z2 - z1) + if collisionbox then + -- Create rays from random points in the collision box + local x1 = collisionbox[1] * 2 + local y1 = collisionbox[2] * 2 + local z1 = collisionbox[3] * 2 + local x2 = collisionbox[4] * 2 + local y2 = collisionbox[5] * 2 + local z2 = collisionbox[6] * 2 + local x_len = math.abs(x2 - x1) + local y_len = math.abs(y2 - y1) + local z_len = math.abs(z2 - z1) - -- Move object position to the center of its bounding box - opos.x = opos.x + x1 + x2 - opos.y = opos.y + y1 + y2 - opos.z = opos.z + z1 + z2 + -- Move object position to the center of its bounding box + opos.x = opos.x + x1 + x2 + opos.y = opos.y + y1 + y2 + opos.z = opos.z + z1 + z2 - -- Count number of rays from collision box which are unobstructed - local count = N_EXPOSURE_RAYS + -- Count number of rays from collision box which are unobstructed + local count = N_EXPOSURE_RAYS - for i = 1, N_EXPOSURE_RAYS do - local rpos_x = opos.x + math.random() * x_len - x_len / 2 - local rpos_y = opos.y + math.random() * y_len - y_len / 2 - local rpos_z = opos.z + math.random() * z_len - z_len / 2 - local rdir_x = pos.x - rpos_x - local rdir_y = pos.y - rpos_y - local rdir_z = pos.z - rpos_z - local rdir_len = math.hypot(rdir_x, math.hypot(rdir_y, rdir_z)) - rdir_x = rdir_x / rdir_len - rdir_y = rdir_y / rdir_len - rdir_z = rdir_z / rdir_len + for i = 1, N_EXPOSURE_RAYS do + local rpos_x = opos.x + math.random() * x_len - x_len / 2 + local rpos_y = opos.y + math.random() * y_len - y_len / 2 + local rpos_z = opos.z + math.random() * z_len - z_len / 2 + local rdir_x = pos.x - rpos_x + local rdir_y = pos.y - rpos_y + local rdir_z = pos.z - rpos_z + local rdir_len = math.hypot(rdir_x, math.hypot(rdir_y, rdir_z)) + rdir_x = rdir_x / rdir_len + rdir_y = rdir_y / rdir_len + rdir_z = rdir_z / rdir_len - for i=0, rdir_len / STEP_LENGTH do - rpos_x = rpos_x + rdir_x * STEP_LENGTH - rpos_y = rpos_y + rdir_y * STEP_LENGTH - rpos_z = rpos_z + rdir_z * STEP_LENGTH - local npos_x = math.floor(rpos_x + 0.5) - local npos_y = math.floor(rpos_y + 0.5) - local npos_z = math.floor(rpos_z + 0.5) - local idx = (npos_z - emin_z) * zstride + (npos_y - emin_y) * ystride + - npos_x - emin_x + 1 + for i=0, rdir_len / STEP_LENGTH do + rpos_x = rpos_x + rdir_x * STEP_LENGTH + rpos_y = rpos_y + rdir_y * STEP_LENGTH + rpos_z = rpos_z + rdir_z * STEP_LENGTH + local npos_x = math.floor(rpos_x + 0.5) + local npos_y = math.floor(rpos_y + 0.5) + local npos_z = math.floor(rpos_z + 0.5) + local idx = (npos_z - emin_z) * zstride + (npos_y - emin_y) * ystride + + npos_x - emin_x + 1 - local cid = data[idx] - local walkable = node_walkable[cid] + local cid = data[idx] + local walkable = node_walkable[cid] - if walkable then - count = count - 1 - break - end - end - end + if walkable then + count = count - 1 + break + end + end + end - -- Punch entity with damage depending on explosion exposure and - -- distance to explosion - local exposure = count / N_EXPOSURE_RAYS - local punch_vec = vector.subtract(opos, pos) - local punch_dir = vector.normalize(punch_vec) - local impact = (1 - vector.length(punch_vec) / punch_radius) * exposure - if impact < 0 then - impact = 0 - end - local damage = math.floor((impact * impact + impact) * 7 * strength + 1) - obj:punch(obj, 10, { damage_groups = { full_punch_interval = 1, - fleshy = damage, knockback = impact * 20.0 } }, punch_dir) + -- Punch entity with damage depending on explosion exposure and + -- distance to explosion + local exposure = count / N_EXPOSURE_RAYS + local punch_vec = vector.subtract(opos, pos) + local punch_dir = vector.normalize(punch_vec) + local impact = (1 - vector.length(punch_vec) / punch_radius) * exposure + if impact < 0 then + impact = 0 + end + local damage = math.floor((impact * impact + impact) * 7 * strength + 1) + obj:punch(obj, 10, { damage_groups = { full_punch_interval = 1, + fleshy = damage, knockback = impact * 20.0 } }, punch_dir) - if obj:is_player() then - obj:add_player_velocity(vector.multiply(punch_dir, impact * 20)) - elseif ent.tnt_knockback then - obj:add_velocity(vector.multiply(punch_dir, impact * 20)) - end - end - end - end + if obj:is_player() then + obj:add_player_velocity(vector.multiply(punch_dir, impact * 20)) + elseif ent.tnt_knockback then + obj:add_velocity(vector.multiply(punch_dir, impact * 20)) + end + end + end + end - -- Remove destroyed blocks and drop items - for hash, idx in pairs(destroy) do - local do_drop = not creative_mode and math.random() <= drop_chance - local on_blast = node_on_blast[data[idx]] - local remove = true + -- Remove destroyed blocks and drop items + for hash, idx in pairs(destroy) do + local do_drop = not creative_mode and math.random() <= drop_chance + local on_blast = node_on_blast[data[idx]] + local remove = true - if do_drop or on_blast ~= nil then - local npos = get_position_from_hash(hash) - if on_blast ~= nil then - remove = on_blast(npos, 1.0) - else - local name = minetest.get_name_from_content_id(data[idx]) - local drop = minetest.get_node_drops(name, "") + if do_drop or on_blast ~= nil then + local npos = get_position_from_hash(hash) + if on_blast ~= nil then + remove = on_blast(npos, 1.0) + else + local name = minetest.get_name_from_content_id(data[idx]) + local drop = minetest.get_node_drops(name, "") - for _, item in ipairs(drop) do - if item ~= "string" then - item = item:get_name() .. item:get_count() - end - minetest.add_item(npos, item) - end - end - end - if remove then - data[idx] = minetest.CONTENT_AIR - end - end + for _, item in ipairs(drop) do + if item ~= "string" then + item = item:get_name() .. item:get_count() + end + minetest.add_item(npos, item) + end + end + end + if remove then + data[idx] = minetest.CONTENT_AIR + end + end - -- Log explosion - minetest.log('action', 'Explosion at ' .. minetest.pos_to_string(pos) .. - ' with strength ' .. strength .. ' and radius ' .. radius) + -- Log explosion + minetest.log('action', 'Explosion at ' .. minetest.pos_to_string(pos) .. + ' with strength ' .. strength .. ' and radius ' .. radius) - -- Update environment - vm:set_data(data) - vm:write_to_map(data) - vm:update_liquids() + -- Update environment + vm:set_data(data) + vm:write_to_map(data) + vm:update_liquids() end -- Create an explosion with strength at pos. -- -- Parameters: --- pos - The position where the explosion originates from --- strength - The blast strength of the explosion (a TNT explosion uses 4) --- info - Table containing information about explosion. +-- pos - The position where the explosion originates from +-- strength - The blast strength of the explosion (a TNT explosion uses 4) +-- info - Table containing information about explosion. -- -- Values in info: --- drop_chance - If specified becomes the drop chance of all nodes in the --- explosion (defaults to 1.0 / strength) --- no_sound - If true then the explosion will not play a sound --- no_particle - If true then the explosion will not create particles +-- drop_chance - If specified becomes the drop chance of all nodes in the +-- explosion (defaults to 1.0 / strength) +-- no_sound - If true then the explosion will not play a sound +-- no_particle - If true then the explosion will not create particles function mcl_explosions.explode(pos, strength, info) - -- The maximum blast radius (in the air) - local radius = math.ceil(1.3 * strength / (0.3 * 0.75) * 0.3) + -- The maximum blast radius (in the air) + local radius = math.ceil(1.3 * strength / (0.3 * 0.75) * 0.3) - if not sphere_shapes[radius] then - sphere_shapes[radius] = compute_sphere_rays(radius) - end - shape = sphere_shapes[radius] + if not sphere_shapes[radius] then + sphere_shapes[radius] = compute_sphere_rays(radius) + end + shape = sphere_shapes[radius] - trace_explode(pos, strength, shape, radius, (info and info.drop_chance) or 1 / strength) + trace_explode(pos, strength, shape, radius, (info and info.drop_chance) or 1 / strength) - if not (info and info.no_sound) then - add_particles(pos, radius) - end - if not (info and info.no_particle) then - minetest.sound_play("tnt_explode", { - pos = pos, gain = 1.0, - max_hear_distance = strength * 16 - }, true) - end + if not (info and info.no_sound) then + add_particles(pos, radius) + end + if not (info and info.no_particle) then + minetest.sound_play("tnt_explode", { + pos = pos, gain = 1.0, + max_hear_distance = strength * 16 + }, true) + end end From 7fa8828bd53877cc2a7ae3da2ca8ebcbd9c68699 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 30 Apr 2020 21:13:10 +0200 Subject: [PATCH 22/30] Explosions: Use minetest.get_position_from_hash --- mods/CORE/mcl_explosions/init.lua | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 143db2ca7..18795299c 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -124,19 +124,6 @@ local function add_particles(pos, radius) }) end --- Get position from hash. This should be identical to --- 'minetest.get_position_from_hash' but is used in case the hashing function --- would change. -local function get_position_from_hash(hash) - local pos = {} - pos.x = (hash % 65536) - 32768 - hash = math.floor(hash / 65536) - pos.y = (hash % 65536) - 32768 - hash = math.floor(hash / 65536) - pos.z = (hash % 65536) - 32768 - return pos -end - -- Traces the rays of an explosion, and updates the environment. -- -- Parameters: @@ -312,7 +299,7 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) local remove = true if do_drop or on_blast ~= nil then - local npos = get_position_from_hash(hash) + local npos = minetest.get_position_from_hash(hash) if on_blast ~= nil then remove = on_blast(npos, 1.0) else From d4bc7a2f880f94a6ba2e39e95940da73638c95a6 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 2 May 2020 18:09:25 +0200 Subject: [PATCH 23/30] Add back the explosion death msg --- mods/CORE/mcl_explosions/init.lua | 7 ++++++- mods/CORE/mcl_explosions/locale/mcl_explosions.de.tr | 2 ++ mods/CORE/mcl_explosions/locale/template.txt | 2 ++ mods/HUD/mcl_death_messages/init.lua | 11 +++++++---- 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 mods/CORE/mcl_explosions/locale/mcl_explosions.de.tr create mode 100644 mods/CORE/mcl_explosions/locale/template.txt diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 18795299c..99cdb0feb 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -10,10 +10,12 @@ This mod was created by Elias Astrom and is released under the LGPLv2.1 license. --]] - mcl_explosions = {} local creative_mode = minetest.settings:get_bool("creative_mode") +local mod_death_messages = minetest.get_modpath("mcl_death_messages") ~= nil + +local S = minetest.get_translator("mcl_explosions") -- Saved sphere explosion shapes for various radiuses local sphere_shapes = {} @@ -280,6 +282,9 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) impact = 0 end local damage = math.floor((impact * impact + impact) * 7 * strength + 1) + if mod_death_messages and obj:is_player() then + mcl_death_messages.player_damage(obj, S("@1 was caught in an explosion.", obj:get_player_name())) + end obj:punch(obj, 10, { damage_groups = { full_punch_interval = 1, fleshy = damage, knockback = impact * 20.0 } }, punch_dir) diff --git a/mods/CORE/mcl_explosions/locale/mcl_explosions.de.tr b/mods/CORE/mcl_explosions/locale/mcl_explosions.de.tr new file mode 100644 index 000000000..4abbc64bf --- /dev/null +++ b/mods/CORE/mcl_explosions/locale/mcl_explosions.de.tr @@ -0,0 +1,2 @@ +# textdomain:mcl_explosions +@1 was caught in an explosion.=@1 wurde Opfer einer Explosion. diff --git a/mods/CORE/mcl_explosions/locale/template.txt b/mods/CORE/mcl_explosions/locale/template.txt new file mode 100644 index 000000000..6a9348ddf --- /dev/null +++ b/mods/CORE/mcl_explosions/locale/template.txt @@ -0,0 +1,2 @@ +# textdomain:mcl_explosions +@1 was caught in an explosion.= diff --git a/mods/HUD/mcl_death_messages/init.lua b/mods/HUD/mcl_death_messages/init.lua index e32de1373..25be93263 100644 --- a/mods/HUD/mcl_death_messages/init.lua +++ b/mods/HUD/mcl_death_messages/init.lua @@ -174,13 +174,16 @@ minetest.register_on_dieplayer(function(player, reason) -- Punches local hitter = reason.object local hittername, hittertype, hittersubtype, shooter + -- Custom message + if last_damages[name] then + msg = last_damages[name].message -- Unknown hitter - if hitter == nil then + elseif hitter == nil then msg = dmsg("murder_any", name) -- Player elseif hitter:is_player() then hittername = hitter:get_player_name() - if hittername ~= nil then + if hittername ~= nil and hittername ~= name then msg = dmsg("murder", name, hittername) else msg = dmsg("murder_any", name) @@ -263,8 +266,8 @@ local start_damage_reset_countdown = function (player, sequence_number) end, player:get_player_name(), sequence_number) end --- Send a custom death mesage when damaging a player via set_hp. --- To be called directly BEFORE damaging a player via set_hp. +-- Send a custom death mesage when damaging a player via set_hp or punch. +-- To be called directly BEFORE damaging a player via set_hp or punch. -- The next time the player dies due to a set_hp, the message will be shown. -- The player must die via set_hp within 0.1 seconds, otherwise the message will be discarded. function mcl_death_messages.player_damage(player, message) From 6a576c50a07b22cd84fa7141daae5ffafcbde5b2 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 2 May 2020 18:21:44 +0200 Subject: [PATCH 24/30] Add puncher to tnt_explosions --- mods/CORE/mcl_explosions/init.lua | 16 +++++++++++----- mods/HUD/mcl_death_messages/init.lua | 2 +- mods/ITEMS/mcl_tnt/init.lua | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 99cdb0feb..de8768ca3 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -134,11 +134,12 @@ end -- raydirs - The directions for each ray -- radius - The maximum distance each ray will go -- drop_chance - The chance that destroyed nodes will drop their items +-- puncher - object that punches other objects (optional) -- -- Note that this function has been optimized, it contains code which has been --- inlined to avoid function calls and unnecessary table creation. This was +-- inlined to avoid function calls and unnecessary table creation. This was -- measured to give a significant performance increase. -local function trace_explode(pos, strength, raydirs, radius, drop_chance) +local function trace_explode(pos, strength, raydirs, radius, drop_chance, puncher) local vm = minetest.get_voxel_manip() local emin, emax = vm:read_from_map(vector.subtract(pos, radius), @@ -285,7 +286,11 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) if mod_death_messages and obj:is_player() then mcl_death_messages.player_damage(obj, S("@1 was caught in an explosion.", obj:get_player_name())) end - obj:punch(obj, 10, { damage_groups = { full_punch_interval = 1, + local source = puncher + if not source then + source = obj + end + obj:punch(source, 10, { damage_groups = { full_punch_interval = 1, fleshy = damage, knockback = impact * 20.0 } }, punch_dir) if obj:is_player() then @@ -340,13 +345,14 @@ end -- pos - The position where the explosion originates from -- strength - The blast strength of the explosion (a TNT explosion uses 4) -- info - Table containing information about explosion. +-- puncher - object that is reported as source of punches/damage (optional) -- -- Values in info: -- drop_chance - If specified becomes the drop chance of all nodes in the -- explosion (defaults to 1.0 / strength) -- no_sound - If true then the explosion will not play a sound -- no_particle - If true then the explosion will not create particles -function mcl_explosions.explode(pos, strength, info) +function mcl_explosions.explode(pos, strength, info, puncher) -- The maximum blast radius (in the air) local radius = math.ceil(1.3 * strength / (0.3 * 0.75) * 0.3) @@ -355,7 +361,7 @@ function mcl_explosions.explode(pos, strength, info) end shape = sphere_shapes[radius] - trace_explode(pos, strength, shape, radius, (info and info.drop_chance) or 1 / strength) + trace_explode(pos, strength, shape, radius, (info and info.drop_chance) or 1 / strength, puncher) if not (info and info.no_sound) then add_particles(pos, radius) diff --git a/mods/HUD/mcl_death_messages/init.lua b/mods/HUD/mcl_death_messages/init.lua index 25be93263..dfc5191a6 100644 --- a/mods/HUD/mcl_death_messages/init.lua +++ b/mods/HUD/mcl_death_messages/init.lua @@ -183,7 +183,7 @@ minetest.register_on_dieplayer(function(player, reason) -- Player elseif hitter:is_player() then hittername = hitter:get_player_name() - if hittername ~= nil and hittername ~= name then + if hittername ~= nil then msg = dmsg("murder", name, hittername) else msg = dmsg("murder_any", name) diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index 0ec2679b8..68a1296bf 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -210,7 +210,7 @@ function TNT:on_step(dtime) self.blinkstatus = not self.blinkstatus end if self.timer > tnt.BOOMTIMER then - mcl_explosions.explode(self.object:get_pos(), 4, { drop_chance = 1.0 }) + mcl_explosions.explode(self.object:get_pos(), 4, { drop_chance = 1.0 }, self.object) self.object:remove() end end From 56d484f69b1cf7b556f90c5b4bb3e27abe2c8be3 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 2 May 2020 18:50:25 +0200 Subject: [PATCH 25/30] Make mobs and bed use mcl_explosions --- mods/ENTITIES/mcl_mobs/api.lua | 49 ++++++++++--------------------- mods/ENTITIES/mcl_mobs/mod.conf | 2 +- mods/ENTITIES/mobs_mc/creeper.lua | 3 +- mods/ENTITIES/mobs_mc/wither.lua | 3 +- mods/ITEMS/mcl_beds/functions.lua | 5 ++-- 5 files changed, 21 insertions(+), 41 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 6cfd4fc71..dd0d2e5dd 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -93,7 +93,7 @@ local node_snow = "mcl_core:snow" mobs.fallback_node = minetest.registered_aliases["mapgen_dirt"] or "mcl_core:dirt" local mod_weather = minetest.get_modpath("mcl_weather") ~= nil -local mod_tnt = minetest.get_modpath("mcl_tnt") ~= nil +local mod_explosions = minetest.get_modpath("mcl_explosions") ~= nil local mod_mobspawners = minetest.get_modpath("mcl_mobspawners") ~= nil local mod_hunger = minetest.get_modpath("mcl_hunger") ~= nil local mod_worlds = minetest.get_modpath("mcl_worlds") ~= nil @@ -2218,26 +2218,10 @@ local do_states = function(self, dtime) local pos = self.object:get_pos() - -- dont damage anything if area protected or next to water - if minetest.find_node_near(pos, 1, {"group:water"}) - or minetest.is_protected(pos, "") then - - node_break_radius = 1 - end - - self.object:remove() - - if mobs_griefing and mod_tnt and tnt and tnt.boom - and not minetest.is_protected(pos, "") then - - tnt.boom(pos, { - radius = node_break_radius, - damage_radius = entity_damage_radius, - sound = self.sounds.explode, - is_tnt = false, - }) + if mod_explosions then + if mobs_griefing and not minetest.is_protected(pos, "") then + mcl_explosions.explode(self.object:get_pos(), self.explosion_strength, { drop_chance = 1.0 }, self.object) else - minetest.sound_play(self.sounds.explode, { pos = pos, gain = 1.0, @@ -2247,6 +2231,8 @@ local do_states = function(self, dtime) entity_physics(pos, entity_damage_radius) effect(pos, 32, "tnt_smoke.png", nil, nil, node_break_radius, 1, 0) end + end + self.object:remove() return true end @@ -3365,8 +3351,8 @@ minetest.register_entity(name, { runaway_timer = 0, pathfinding = def.pathfinding, immune_to = def.immune_to or {}, - explosion_radius = def.explosion_radius, - explosion_damage_radius = def.explosion_damage_radius, + explosion_radius = def.explosion_radius, -- LEGACY + explosion_damage_radius = def.explosion_damage_radius, -- LEGACY explosion_timer = def.explosion_timer or 3, allow_fuse_reset = def.allow_fuse_reset ~= false, stop_to_explode = def.stop_to_explode ~= false, @@ -3393,6 +3379,7 @@ minetest.register_entity(name, { texture_mods = {}, shoot_arrow = def.shoot_arrow, sounds_child = def.sounds_child, + explosion_strength = def.explosion_strength, -- End of MCL2 extensions on_spawn = def.on_spawn, @@ -3838,7 +3825,6 @@ end -- no damage to nodes explosion function mobs:safe_boom(self, pos, radius) - minetest.sound_play(self.sounds and self.sounds.explode or "tnt_explode", { pos = pos, gain = 1.0, @@ -3853,17 +3839,12 @@ end -- make explosion with protection and tnt mod check function mobs:boom(self, pos, radius) - if mobs_griefing - and mod_tnt and tnt and tnt.boom - and not minetest.is_protected(pos, "") then - - tnt.boom(pos, { - radius = radius, - damage_radius = radius, - sound = self.sounds and self.sounds.explode, - explode_center = true, - is_tnt = false, - }) + if mod_explosions then + if mobs_griefing and not minetest.is_protected(pos, "") then + mcl_explosions.explode(pos, self.explosion_strength, { drop_chance = 1.0 }, self.object) + else + mobs:safe_boom(self, pos, radius) + end else mobs:safe_boom(self, pos, radius) end diff --git a/mods/ENTITIES/mcl_mobs/mod.conf b/mods/ENTITIES/mcl_mobs/mod.conf index aed560132..a32827a65 100644 --- a/mods/ENTITIES/mcl_mobs/mod.conf +++ b/mods/ENTITIES/mcl_mobs/mod.conf @@ -1,2 +1,2 @@ name = mcl_mobs -optional_depends = mcl_weather, mcl_tnt, mcl_hunger, mcl_worlds, invisibility, lucky_block, cmi, doc_identifier, mcl_armor +optional_depends = mcl_weather, mcl_explosions, mcl_hunger, mcl_worlds, invisibility, lucky_block, cmi, doc_identifier, mcl_armor diff --git a/mods/ENTITIES/mobs_mc/creeper.lua b/mods/ENTITIES/mobs_mc/creeper.lua index b8afb88e3..d38269734 100644 --- a/mods/ENTITIES/mobs_mc/creeper.lua +++ b/mods/ENTITIES/mobs_mc/creeper.lua @@ -36,9 +36,8 @@ mobs:register_mob("mobs_mc:creeper", { runaway_from = { "mobs_mc:ocelot", "mobs_mc:cat" }, attack_type = "explode", - explosion_radius = 3, + explosion_strength = 3, reach = 4, - explosion_damage_radius = 7, explosion_timer = 1.5, allow_fuse_reset = true, stop_to_explode = true, diff --git a/mods/ENTITIES/mobs_mc/wither.lua b/mods/ENTITIES/mobs_mc/wither.lua index 7686efc97..ebbbf92fb 100644 --- a/mods/ENTITIES/mobs_mc/wither.lua +++ b/mods/ENTITIES/mobs_mc/wither.lua @@ -49,8 +49,7 @@ mobs:register_mob("mobs_mc:wither", { lava_damage = 0, fire_damage = 0, attack_type = "dogshoot", - explosion_radius = 3, - explosion_fire = false, + explosion_strength = 8, dogshoot_stop = true, arrow = "mobs_mc:wither_skull", reach = 5, diff --git a/mods/ITEMS/mcl_beds/functions.lua b/mods/ITEMS/mcl_beds/functions.lua index 802a64da5..d73154ee4 100644 --- a/mods/ITEMS/mcl_beds/functions.lua +++ b/mods/ITEMS/mcl_beds/functions.lua @@ -5,6 +5,7 @@ local pi = math.pi local player_in_bed = 0 local is_sp = minetest.is_singleplayer() local weather_mod = minetest.get_modpath("mcl_weather") ~= nil +local explosions_mod = minetest.get_modpath("mcl_explosions") ~= nil -- Helper functions @@ -307,8 +308,8 @@ function mcl_beds.on_rightclick(pos, player, is_top) if dim == "nether" or dim == "end" then -- Bed goes BOOM in the Nether or End. minetest.remove_node(pos) - if minetest.get_modpath("mcl_tnt") then - tnt.boom(pos, {radius = 4, damage_radius = 4, is_tnt = false}) + if explosions_mod then + mcl_explosions.explode(pos, 5, {drop_chance = 1.0, fire = true}) end return end From 00acbf8a2a30fc23f6b58292646964a6af034c8f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 2 May 2020 18:51:59 +0200 Subject: [PATCH 26/30] Remove unused TNT functions --- mods/ITEMS/mcl_tnt/init.lua | 99 ------------------------------------- 1 file changed, 99 deletions(-) diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index 68a1296bf..a0d5dd012 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -10,40 +10,6 @@ local function spawn_tnt(pos, entname) return tnt end -local function activate_if_tnt(nname, np, tnt_np, tntr) - if nname == "mcl_tnt:tnt" then - local e = spawn_tnt(np, nname) - e:set_velocity({x=(np.x - tnt_np.x)*5+(tntr / 4), y=(np.y - tnt_np.y)*5+(tntr / 3), z=(np.z - tnt_np.z)*5+(tntr / 4)}) - minetest.remove_node(np) - minetest.check_for_falling(np) - end -end - -local function do_tnt_physics(tnt_np, tntr, tnt_obj) - local objs = minetest.get_objects_inside_radius(tnt_np, tntr) - for k, obj in pairs(objs) do - local ent = obj:get_luaentity() - local v = obj:get_velocity() - local p = obj:get_pos() - if ent and ent.name == "mcl_tnt:tnt" and v ~= nil then - obj:set_velocity({x=(p.x - tnt_np.x) + (tntr / 2) + v.x, y=(p.y - tnt_np.y) + tntr + v.y, z=(p.z - tnt_np.z) + (tntr / 2) + v.z}) - else - if v ~= nil and not obj:is_player() then - obj:set_velocity({x=(p.x - tnt_np.x) + (tntr / 4) + v.x, y=(p.y - tnt_np.y) + (tntr / 2) + v.y, z=(p.z - tnt_np.z) + (tntr / 4) + v.z}) - end - local dist = math.max(1, vector.distance(tnt_np, p)) - local damage = (4 / dist) * tntr - if obj:is_player() == true then - if mod_death_messages then - mcl_death_messages.player_damage(obj, S("@1 was caught in an explosion.", obj:get_player_name())) - end - end - local puncher = tnt_obj or obj - obj:punch(puncher, nil, { damage_groups = { fleshy = damage }}) - end - end -end - tnt = {} tnt.ignite = function(pos) minetest.remove_node(pos) @@ -215,71 +181,6 @@ function TNT:on_step(dtime) end end -tnt.boom = function(pos, info, tnt_obj) - if not info then info = {} end - local range = info.radius or TNT_RANGE - local damage_range = info.damage_radius or TNT_RANGE - - pos.x = math.floor(pos.x+0.5) - pos.y = math.floor(pos.y+0.5) - pos.z = math.floor(pos.z+0.5) - do_tnt_physics(pos, range, tnt_obj) - local meta = minetest.get_meta(pos) - local sound - if not info.sound then - sound = "tnt_explode" - else - sound = info.sound - end - if info.is_tnt == nil then - info.is_tnt = true - end - minetest.sound_play(sound, {pos = pos,gain = 1.0,max_hear_distance = 16,}, true) - local node = minetest.get_node(pos) - if minetest.get_item_group("water") == 1 or minetest.get_item_group("lava") == 1 then - -- Cancel the Explosion - return - end - for x=-range,range do - for y=-range,range do - for z=-range,range do - if x*x+y*y+z*z <= range * range + range then - local np={x=pos.x+x,y=pos.y+y,z=pos.z+z} - local n = minetest.get_node(np) - local def = minetest.registered_nodes[n.name] - -- Simple blast resistance check (for now). This keeps the important blocks like bedrock, command block, etc. intact. - -- TODO: Implement the real blast resistance algorithm - if def and n.name ~= "air" and n.name ~= "ignore" and (def._mcl_blast_resistance == nil or def._mcl_blast_resistance < 1000) then - activate_if_tnt(n.name, np, pos, 3) - if (not tnt_griefing) and info.is_tnt ~= false then - -- No-op - -- Custom blast function defined by node. - -- Node removal and drops must be handled manually. - elseif def.on_blast then - def.on_blast(np, 1.0) - -- Default destruction handling: Remove nodes, drop items - else - minetest.remove_node(np) - minetest.check_for_falling(np) - if n.name ~= "mcl_tnt:tnt" and math.random() > 0.9 then - local drop = minetest.get_node_drops(n.name, "") - for _,item in ipairs(drop) do - if type(item) == "string" then - if math.random(1,100) > 40 then - local obj = minetest.add_item(np, item) - end - end - end - end - end - end - end - end - end - add_effects(pos, range, {}) - end -end - minetest.register_entity("mcl_tnt:tnt", TNT) if minetest.get_modpath("mcl_mobitems") then From bc740efafea50cc497a22a11401c343e5ceb8faf Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 2 May 2020 19:05:56 +0200 Subject: [PATCH 27/30] Add fire explosions --- mods/CORE/mcl_explosions/init.lua | 13 ++++++++++--- mods/CORE/mcl_explosions/mod.conf | 1 + mods/ENTITIES/mcl_mobs/api.lua | 8 ++++---- mods/ENTITIES/mobs_mc/ghast.lua | 8 +++----- mods/ITEMS/mcl_beds/depends.txt | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index de8768ca3..eb1b21f60 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -14,6 +14,8 @@ mcl_explosions = {} local creative_mode = minetest.settings:get_bool("creative_mode") local mod_death_messages = minetest.get_modpath("mcl_death_messages") ~= nil +local mod_fire = minetest.get_modpath("mcl_fire") ~= nil +local CONTENT_FIRE = minetest.get_content_id("mcl_fire:fire") local S = minetest.get_translator("mcl_explosions") @@ -134,12 +136,13 @@ end -- raydirs - The directions for each ray -- radius - The maximum distance each ray will go -- drop_chance - The chance that destroyed nodes will drop their items +-- fire - If true, 1/3 of destroyed nodes become fire -- puncher - object that punches other objects (optional) -- -- Note that this function has been optimized, it contains code which has been -- inlined to avoid function calls and unnecessary table creation. This was -- measured to give a significant performance increase. -local function trace_explode(pos, strength, raydirs, radius, drop_chance, puncher) +local function trace_explode(pos, strength, raydirs, radius, drop_chance, fire, puncher) local vm = minetest.get_voxel_manip() local emin, emax = vm:read_from_map(vector.subtract(pos, radius), @@ -325,7 +328,11 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance, punche end end if remove then - data[idx] = minetest.CONTENT_AIR + if mod_fire and math.random(1, 3) == 1 then + data[idx] = CONTENT_FIRE + else + data[idx] = minetest.CONTENT_AIR + end end end @@ -361,7 +368,7 @@ function mcl_explosions.explode(pos, strength, info, puncher) end shape = sphere_shapes[radius] - trace_explode(pos, strength, shape, radius, (info and info.drop_chance) or 1 / strength, puncher) + trace_explode(pos, strength, shape, radius, (info and info.drop_chance) or 1 / strength, info.fire == true, puncher) if not (info and info.no_sound) then add_particles(pos, radius) diff --git a/mods/CORE/mcl_explosions/mod.conf b/mods/CORE/mcl_explosions/mod.conf index 382ece9a4..7ce4b678d 100644 --- a/mods/CORE/mcl_explosions/mod.conf +++ b/mods/CORE/mcl_explosions/mod.conf @@ -1,2 +1,3 @@ name = mcl_explosions description = A common API to create explosions. +optional_depends = mcl_fire diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index dd0d2e5dd..425355f7c 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -3824,7 +3824,7 @@ end -- no damage to nodes explosion -function mobs:safe_boom(self, pos, radius) +function mobs:safe_boom(self, pos, strength) minetest.sound_play(self.sounds and self.sounds.explode or "tnt_explode", { pos = pos, gain = 1.0, @@ -3837,13 +3837,13 @@ end -- make explosion with protection and tnt mod check -function mobs:boom(self, pos, radius) +function mobs:boom(self, pos, strength, fire) if mod_explosions then if mobs_griefing and not minetest.is_protected(pos, "") then - mcl_explosions.explode(pos, self.explosion_strength, { drop_chance = 1.0 }, self.object) + mcl_explosions.explode(pos, strength, { drop_chance = 1.0, fire = fire }, self.object) else - mobs:safe_boom(self, pos, radius) + mobs:safe_boom(self, pos, strength) end else mobs:safe_boom(self, pos, radius) diff --git a/mods/ENTITIES/mobs_mc/ghast.lua b/mods/ENTITIES/mobs_mc/ghast.lua index 08fbb99fc..2efe56afc 100644 --- a/mods/ENTITIES/mobs_mc/ghast.lua +++ b/mods/ENTITIES/mobs_mc/ghast.lua @@ -79,13 +79,12 @@ mobs:register_arrow("mobs_mc:fireball", { textures = {"mcl_fire_fire_charge.png"}, velocity = 15, - -- direct hit, no fire... just plenty of pain hit_player = function(self, player) player:punch(self.object, 1.0, { full_punch_interval = 1.0, damage_groups = {fleshy = 6}, }, nil) - mobs:boom(self, self.object:get_pos(), 3) + mobs:boom(self, self.object:get_pos(), 1, true) end, hit_mob = function(self, mob) @@ -93,12 +92,11 @@ mobs:register_arrow("mobs_mc:fireball", { full_punch_interval = 1.0, damage_groups = {fleshy = 6}, }, nil) - mobs:boom(self, self.object:get_pos(), 3) + mobs:boom(self, self.object:get_pos(), 1, true) end, - -- node hit, explode hit_node = function(self, pos, node) - mobs:boom(self, pos, 3) + mobs:boom(self, pos, 1, true) end }) diff --git a/mods/ITEMS/mcl_beds/depends.txt b/mods/ITEMS/mcl_beds/depends.txt index 34e12adc5..c7c874fd1 100644 --- a/mods/ITEMS/mcl_beds/depends.txt +++ b/mods/ITEMS/mcl_beds/depends.txt @@ -3,7 +3,7 @@ mcl_sounds? mcl_worlds? mcl_wool? mcl_dye? -mcl_tnt? +mcl_explosions? mcl_weather? mcl_spawn? doc? From 02b2ff7460b0214972db5b28806ce3e66dc13572 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 2 May 2020 19:08:55 +0200 Subject: [PATCH 28/30] Fix mcl_weather crash --- mods/ENVIRONMENT/mcl_weather/rain.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ENVIRONMENT/mcl_weather/rain.lua b/mods/ENVIRONMENT/mcl_weather/rain.lua index ccb8cd5b2..f5977940f 100644 --- a/mods/ENVIRONMENT/mcl_weather/rain.lua +++ b/mods/ENVIRONMENT/mcl_weather/rain.lua @@ -20,7 +20,7 @@ mcl_weather.rain = { mcl_weather.rain.sound_handler = function(player) return minetest.sound_play("weather_rain", { - to_player = player, + to_player = player:get_player_name(), loop = true, }) end From beace10136eda2233e26678b29042ad2ec5c1fc2 Mon Sep 17 00:00:00 2001 From: Alexander Minges Date: Sun, 3 May 2020 17:25:12 +0200 Subject: [PATCH 29/30] prevent water mobs to classify solid blocks below them as dangerous --- mods/ENTITIES/mcl_mobs/api.lua | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/mods/ENTITIES/mcl_mobs/api.lua b/mods/ENTITIES/mcl_mobs/api.lua index 63a114e6b..43f11ae51 100644 --- a/mods/ENTITIES/mcl_mobs/api.lua +++ b/mods/ENTITIES/mcl_mobs/api.lua @@ -317,7 +317,11 @@ local is_node_dangerous = function(self, nodename) end if minetest.registered_nodes[nn].drowning > 0 then if self.breath_max ~= -1 then - return true + -- check if the mob is water-breathing _and_ the block is water; only return true if neither is the case + -- this will prevent water-breathing mobs to classify water or e.g. sand below them as dangerous + if not self.breathes_in_water and minetest.get_item_group(nn, "water") ~= 0 then + return true + end end end if minetest.registered_nodes[nn].damage_per_second > 0 then @@ -2028,11 +2032,19 @@ local do_states = function(self, dtime) local is_in_danger = false if lp then - -- If mob in or on dangerous block, look for land - if (is_node_dangerous(self, self.standing_in) or - is_node_dangerous(self, self.standing_on)) then - is_in_danger = true + + local is_in_danger = false + -- if mob is flying, only check for node it is currently in (no contact with node below) + if flight_check(self) then + is_in_danger = is_node_dangerous(self, self.standing_in) + elseif (is_node_dangerous(self, self.standing_in) or + is_node_dangerous(self, self.standing_on)) then + is_in_danger = true + end + + -- If mob in or on dangerous block, look for land + if is_in_danger then lp = minetest.find_node_near(s, 5, {"group:solid"}) -- did we find land? From 8c20dfa5d270765ffacc03389069b3305c4e5122 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 5 May 2020 02:23:17 +0200 Subject: [PATCH 30/30] I no longer accept PRs --- CONTRIBUTING.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ec238b327..0fdda27f2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,9 +26,8 @@ For small and medium changes: * Fork the repository * Do your change in a new branch -* Post a pull request here: https://git.minetest.land/Wuzzy/MineClone2/pulls -* Alternatively: Upload the repository somewhere where it can be accessed - from the Internet and notify me +* Upload the repository somewhere where it can be accessed from the Internet and + notify me For small changes, sending me a patch is also good.