From 065598e92d54aa2e322729ea17ed01025a1b8799 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 10 Mar 2016 17:25:09 -0800 Subject: [PATCH] Damage nearby players. 8 damage will be dealt to any living object (mob or player) in a radius of 5 nodes of where the lightning strikes. --- init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/init.lua b/init.lua index 8b160dc..c36d8dd 100644 --- a/init.lua +++ b/init.lua @@ -122,6 +122,12 @@ lightning.strike = function(pos) minetest.sound_play({ pos = pos, name = "lightning_thunder", gain = 10, max_hear_distance = 500 }) + -- damage nearby objects, player or not + for _, obj in ipairs(minetest.get_objects_inside_radius(pos, 5)) do + -- nil as param#1 is supposed to work, but core can't handle it. + obj:punch(obj, 1.0, {full_punch_interval = 1.0, damage_groups = {fleshy=8}}, nil) + end + local playerlist = minetest.get_connected_players() for i = 1, #playerlist do local sky = {}