123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- if not minetest.global_exists("cavestuff") then cavestuff = {} end
- cavestuff.modpath = minetest.get_modpath("cavestuff")
- local math_random = math.random
- cavestuff.hotcobble = cavestuff.hotcobble or {}
- function cavestuff.hotcobble.after_place_node(pos, placer, itemstack, pointed_thing)
- if not placer or not placer:is_player() then
- return
- end
-
- if not heatdamage.is_immune(placer:get_player_name()) then
- utility.damage_player(placer, "heat", (2*500))
- end
- minetest.sound_play("default_cool_lava", {pos=pos, max_hear_distance=16, gain=0.25}, true)
- if rc.position_underground(pos) then
-
-
- minetest.add_node(pos, {name="default:lava_flowing"})
- else
-
- minetest.add_node(pos, {name="default:cobble"})
- end
- end
- function cavestuff.hotcobble.after_dig_node(pos, oldnode, oldmetadata, digger)
- if not digger or not digger:is_player() then
- return
- end
-
- if not heatdamage.is_immune(digger:get_player_name()) then
- utility.damage_player(digger, "heat", (2*500))
- end
- minetest.sound_play("default_cool_lava", {pos=pos, max_hear_distance=16, gain=0.25}, true)
-
-
- local positions = {
- {x=pos.x+1, y=pos.y, z=pos.z},
- {x=pos.x-1, y=pos.y, z=pos.z},
- {x=pos.x, y=pos.y, z=pos.z+1},
- {x=pos.x, y=pos.y, z=pos.z-1},
- }
- for k, v in ipairs(positions) do
- local node = minetest.get_node(v)
- if string.find(node.name, ":lava_") then
- minetest.add_node(pos, {name="default:lava_source"})
- return
- end
- end
- if rc.position_underground(pos) then
-
- minetest.add_node(pos, {name="default:lava_source"})
- else
-
- minetest.add_node(pos, {name="default:cobble"})
- end
- end
- function cavestuff.hotcobble.on_player_walk_over(pos, player)
-
- if not heatdamage.is_immune(player:get_player_name()) then
- utility.damage_player(player, "heat", (1*500))
- end
- end
- function cavestuff.hotcobble.on_finish_collapse(pos, node)
- if pos.y < -10 then
- if math_random(1, 10) > 8 then
- minetest.swap_node(pos, {name="default:lava_source"})
- elseif math_random(1, 75) == 1 then
- minetest.remove_node(pos)
-
-
-
-
-
-
- else
-
- end
- else
- minetest.swap_node(pos, {name="default:cobble"})
- end
- end
- if not cavestuff.run_once then
- local c = "cavestuff:core"
- local f = cavestuff.modpath .. "/functions.lua"
- reload.register_file(c, f, false)
- cavestuff.run_once = true
- end
|