diff --git a/changelog.txt b/changelog.txt index 9089f23..630b9c4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -20,3 +20,6 @@ v1.1.0: -Issues with weapons thinking they're still charged if the player leaves the game, even though they shouldn't be. -Possible crash if a projectile ever called self.object:remove() in its _on_step function. -Dead players will no longer block projectiles. + +v1.1.1: + Added optional support for my new node_damage mod. With it an tnt, bomb arrows will crack blocks just outside the destruction radius. diff --git a/init.lua b/init.lua index afa559d..b8cf4b9 100644 --- a/init.lua +++ b/init.lua @@ -397,7 +397,24 @@ if tnt then --Upon impact, create a small explosion. on_impact = function(self, collisions) + local pos = self.object:get_pos() + local r = 4 + tnt.boom(self.object:get_pos(), {radius = 2, damage_radius = 2}) + + for a = -r, r do + for b = -r, r do + for c = -r, r do + local npos = vector.add(pos, {x=a, y=b, z=c}) + local dist = vector.distance(pos, npos) + local num = math.random(0, math.ceil(r / math.max(1, dist))) + + if dist <= r and num > 0 then + node_damage.damage(npos, nil, nil, num) + end + end + end + end end }) end diff --git a/mod.conf b/mod.conf index ca11cc3..b39ac07 100644 --- a/mod.conf +++ b/mod.conf @@ -1,3 +1,3 @@ name = projectile description = Adds a small slingshot that can launch certain small objects as projectiles, such as rocks. -optional_depends = animalmaterials, creatures, default, farming, fire, hardtrees, mesecons_walllever, mesecons, mobs, moreores, parties, pipeworks, tnt +optional_depends = animalmaterials, creatures, default, farming, fire, hardtrees, mesecons_walllever, mesecons, mobs, moreores, node_damage, parties, pipeworks, tnt