From 6f7a75ab231fe113ef41c6fdaf583a3b4a2ce82d Mon Sep 17 00:00:00 2001 From: IamPyu Date: Mon, 16 Dec 2024 15:13:17 -0600 Subject: [PATCH] Lightning now creates fire --- mods/ENTITIES/pyutest_lightning/init.lua | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/pyutest_lightning/init.lua b/mods/ENTITIES/pyutest_lightning/init.lua index f6c9a65..41e9afc 100644 --- a/mods/ENTITIES/pyutest_lightning/init.lua +++ b/mods/ENTITIES/pyutest_lightning/init.lua @@ -28,7 +28,27 @@ PyuTest.lightning_strike = function(pos, radius, size) pos = pos }) - for o in core.objects_inside_radius(pos, radius or 3) do - PyuTest.deal_damage(o, 9, PyuTest.DAMAGE_TYPES.lightning()) + local r = radius or 3 + for o in core.objects_inside_radius(pos, r) do + PyuTest.deal_damage(o, 12, PyuTest.DAMAGE_TYPES.lightning()) + end + + for x = -r, r do + for z = -r, r do + local y_pos + + if core.get_node(pos).name ~= "air" then + y_pos = pos.y + 1 + elseif core.get_node(pos - vector.new(0, 1, 0)).name ~= "air" then + y_pos = pos.y + end + + if y_pos then + local npos = vector.new(pos.x + x, y_pos, pos.z +z) + if math.random(1, 6) == 1 then + core.set_node(npos, {name = "pyutest_blocks:fire"}) + end + end + end end end