diff --git a/mods/throwing/build_arrow.lua b/mods/throwing/build_arrow.lua index 1c246e1e..6c668289 100755 --- a/mods/throwing/build_arrow.lua +++ b/mods/throwing/build_arrow.lua @@ -41,6 +41,7 @@ local THROWING_ARROW_ENTITY={ player = "", inventory = false, stack = false, + bow_damage = 0, } THROWING_ARROW_ENTITY.on_step = function(self, dtime) diff --git a/mods/throwing/dig_arrow.lua b/mods/throwing/dig_arrow.lua index 1017ad9f..0a676b53 100755 --- a/mods/throwing/dig_arrow.lua +++ b/mods/throwing/dig_arrow.lua @@ -38,6 +38,7 @@ local THROWING_ARROW_ENTITY={ lastpos={}, collisionbox = {0,0,0,0,0,0}, player = "", + bow_damage = 0, } @@ -55,6 +56,9 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) puncher = minetest.get_player_by_name(self.player) end local damage = 1.5 + if self.bow_damage and self.bow_damage > 0 then + damage = damage + (self.bow_damage/12) + end obj:punch(puncher, 1.0, { full_punch_interval=1.0, damage_groups={fleshy=damage}, diff --git a/mods/throwing/fire_arrow.lua b/mods/throwing/fire_arrow.lua index d7b57aa5..85a44a15 100755 --- a/mods/throwing/fire_arrow.lua +++ b/mods/throwing/fire_arrow.lua @@ -37,6 +37,7 @@ local THROWING_ARROW_ENTITY={ lastpos={}, collisionbox = {0,0,0,0,0,0}, player = "", + bow_damage = 0, } THROWING_ARROW_ENTITY.on_step = function(self, dtime) @@ -54,6 +55,9 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) puncher = minetest.get_player_by_name(self.player) end local damage = 4 + if self.bow_damage and self.bow_damage > 0 then + damage = damage + (self.bow_damage/12) + end obj:punch(puncher, 1.0, { full_punch_interval=1.0, damage_groups={fleshy=damage}, diff --git a/mods/throwing/fireworks_arrows.lua b/mods/throwing/fireworks_arrows.lua index 87e30247..167f8b8d 100755 --- a/mods/throwing/fireworks_arrows.lua +++ b/mods/throwing/fireworks_arrows.lua @@ -39,6 +39,7 @@ local function throwing_register_fireworks(color, desc) lastpos={}, collisionbox = {0,0,0,0,0,0}, player = "", + bow_damage = 0, } local radius = 0.5 @@ -100,6 +101,9 @@ local function throwing_register_fireworks(color, desc) for k, obj in pairs(objs) do if throwing_is_player(self.player, obj) or throwing_is_entity(obj) then local damage = 2 + if self.bow_damage and self.bow_damage > 0 then + damage = damage + (self.bow_damage/12) + end obj:punch(self.object, 1.0, { full_punch_interval=1.0, damage_groups={fleshy=damage}, diff --git a/mods/throwing/functions.lua b/mods/throwing/functions.lua index 5d97bf8b..0deb46f9 100755 --- a/mods/throwing/functions.lua +++ b/mods/throwing/functions.lua @@ -49,7 +49,7 @@ function throwing_touch(pos, objpos) local rx = pos.x - objpos.x local ry = pos.y - (objpos.y+1) local rz = pos.z - objpos.z - if (ry < 1 and ry > -1) and (rx < 0.4 and rx > -0.4) and (rz < 0.4 and rz > -0.4) then + if (ry < 1 and ry > -1) and (rx < 1 and rx > -1) and (rz < 1 and rz > -1) then return true end return false @@ -77,6 +77,7 @@ function throwing_shoot_arrow (itemstack, player, stiffness, is_cross) obj:get_luaentity().inventory = player:get_inventory() obj:get_luaentity().stack = player:get_inventory():get_stack("main", player:get_wield_index()-1) obj:get_luaentity().lastpos = {x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z} + obj:get_luaentity().bow_damage = stiffness end return true end diff --git a/mods/throwing/shell_arrow.lua b/mods/throwing/shell_arrow.lua index 80b4db5c..f652a6b0 100755 --- a/mods/throwing/shell_arrow.lua +++ b/mods/throwing/shell_arrow.lua @@ -38,6 +38,7 @@ local THROWING_ARROW_ENTITY={ lastpos={}, collisionbox = {0,0,0,0,0,0}, player = "", + bow_damage = 0, } local radius = 1 @@ -80,6 +81,9 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) if throwing_is_player(self.player, obj) or throwing_is_entity(obj) then local speed = vector.length(self.object:getvelocity()) local damage = ((speed + 5)^1.2)/10 + 12 + if self.bow_damage and self.bow_damage > 0 then + damage = damage + (self.bow_damage/12) + end obj:punch(self.object, 1.0, { full_punch_interval=1.0, damage_groups={fleshy=damage}, diff --git a/mods/throwing/standard_arrows.lua b/mods/throwing/standard_arrows.lua index 3ce6b426..f3681276 100755 --- a/mods/throwing/standard_arrows.lua +++ b/mods/throwing/standard_arrows.lua @@ -39,6 +39,7 @@ function throwing_register_arrow_standard (kind, desc, eq, toughness, craft) lastpos={}, collisionbox = {0,0,0,0,0,0}, player = "", + bow_damage = 0, } THROWING_ARROW_ENTITY.on_step = function(self, dtime) @@ -55,9 +56,13 @@ function throwing_register_arrow_standard (kind, desc, eq, toughness, craft) if self.player and minetest.get_player_by_name(self.player) then puncher = minetest.get_player_by_name(self.player) end + local damage = eq + if self.bow_damage and self.bow_damage > 0 then + damage = damage + (self.bow_damage/12) + end obj:punch(puncher, 1.0, { full_punch_interval=1.0, - damage_groups={fleshy=eq}, + damage_groups={fleshy=damage}, }, nil) if math.random() < toughness then if math.random(0,100) % 2 == 0 then diff --git a/mods/throwing/teleport_arrow.lua b/mods/throwing/teleport_arrow.lua index adb6ed13..927681f4 100755 --- a/mods/throwing/teleport_arrow.lua +++ b/mods/throwing/teleport_arrow.lua @@ -37,6 +37,7 @@ local THROWING_ARROW_ENTITY={ lastpos={}, collisionbox = {0,0,0,0,0,0}, player = "", + bow_damage = 0, } THROWING_ARROW_ENTITY.on_step = function(self, dtime) diff --git a/mods/throwing/torch_arrow.lua b/mods/throwing/torch_arrow.lua index 0b752710..50899cfc 100755 --- a/mods/throwing/torch_arrow.lua +++ b/mods/throwing/torch_arrow.lua @@ -38,6 +38,7 @@ local THROWING_ARROW_ENTITY={ collisionbox = {0,0,0,0,0,0}, node = "", player = "", + bow_damage = 0, } THROWING_ARROW_ENTITY.on_step = function(self, dtime) @@ -55,6 +56,9 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) puncher = minetest.get_player_by_name(self.player) end local damage = 0.5 + if self.bow_damage and self.bow_damage > 0 then + damage = damage + (self.bow_damage/12) + end obj:punch(puncher, 1.0, { full_punch_interval=1.0, damage_groups={fleshy=damage},