mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-02-24 15:00:26 +01:00
add bow damage
This commit is contained in:
parent
7f7e6f0fa7
commit
e9d29dc779
@ -41,6 +41,7 @@ local THROWING_ARROW_ENTITY={
|
|||||||
player = "",
|
player = "",
|
||||||
inventory = false,
|
inventory = false,
|
||||||
stack = false,
|
stack = false,
|
||||||
|
bow_damage = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||||
|
@ -38,6 +38,7 @@ local THROWING_ARROW_ENTITY={
|
|||||||
lastpos={},
|
lastpos={},
|
||||||
collisionbox = {0,0,0,0,0,0},
|
collisionbox = {0,0,0,0,0,0},
|
||||||
player = "",
|
player = "",
|
||||||
|
bow_damage = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -55,6 +56,9 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
|||||||
puncher = minetest.get_player_by_name(self.player)
|
puncher = minetest.get_player_by_name(self.player)
|
||||||
end
|
end
|
||||||
local damage = 1.5
|
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, {
|
obj:punch(puncher, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups={fleshy=damage},
|
damage_groups={fleshy=damage},
|
||||||
|
@ -37,6 +37,7 @@ local THROWING_ARROW_ENTITY={
|
|||||||
lastpos={},
|
lastpos={},
|
||||||
collisionbox = {0,0,0,0,0,0},
|
collisionbox = {0,0,0,0,0,0},
|
||||||
player = "",
|
player = "",
|
||||||
|
bow_damage = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
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)
|
puncher = minetest.get_player_by_name(self.player)
|
||||||
end
|
end
|
||||||
local damage = 4
|
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, {
|
obj:punch(puncher, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups={fleshy=damage},
|
damage_groups={fleshy=damage},
|
||||||
|
@ -39,6 +39,7 @@ local function throwing_register_fireworks(color, desc)
|
|||||||
lastpos={},
|
lastpos={},
|
||||||
collisionbox = {0,0,0,0,0,0},
|
collisionbox = {0,0,0,0,0,0},
|
||||||
player = "",
|
player = "",
|
||||||
|
bow_damage = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
local radius = 0.5
|
local radius = 0.5
|
||||||
@ -100,6 +101,9 @@ local function throwing_register_fireworks(color, desc)
|
|||||||
for k, obj in pairs(objs) do
|
for k, obj in pairs(objs) do
|
||||||
if throwing_is_player(self.player, obj) or throwing_is_entity(obj) then
|
if throwing_is_player(self.player, obj) or throwing_is_entity(obj) then
|
||||||
local damage = 2
|
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, {
|
obj:punch(self.object, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups={fleshy=damage},
|
damage_groups={fleshy=damage},
|
||||||
|
@ -49,7 +49,7 @@ function throwing_touch(pos, objpos)
|
|||||||
local rx = pos.x - objpos.x
|
local rx = pos.x - objpos.x
|
||||||
local ry = pos.y - (objpos.y+1)
|
local ry = pos.y - (objpos.y+1)
|
||||||
local rz = pos.z - objpos.z
|
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
|
return true
|
||||||
end
|
end
|
||||||
return false
|
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().inventory = player:get_inventory()
|
||||||
obj:get_luaentity().stack = player:get_inventory():get_stack("main", player:get_wield_index()-1)
|
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().lastpos = {x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}
|
||||||
|
obj:get_luaentity().bow_damage = stiffness
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@ -38,6 +38,7 @@ local THROWING_ARROW_ENTITY={
|
|||||||
lastpos={},
|
lastpos={},
|
||||||
collisionbox = {0,0,0,0,0,0},
|
collisionbox = {0,0,0,0,0,0},
|
||||||
player = "",
|
player = "",
|
||||||
|
bow_damage = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
local radius = 1
|
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
|
if throwing_is_player(self.player, obj) or throwing_is_entity(obj) then
|
||||||
local speed = vector.length(self.object:getvelocity())
|
local speed = vector.length(self.object:getvelocity())
|
||||||
local damage = ((speed + 5)^1.2)/10 + 12
|
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, {
|
obj:punch(self.object, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups={fleshy=damage},
|
damage_groups={fleshy=damage},
|
||||||
|
@ -39,6 +39,7 @@ function throwing_register_arrow_standard (kind, desc, eq, toughness, craft)
|
|||||||
lastpos={},
|
lastpos={},
|
||||||
collisionbox = {0,0,0,0,0,0},
|
collisionbox = {0,0,0,0,0,0},
|
||||||
player = "",
|
player = "",
|
||||||
|
bow_damage = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
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
|
if self.player and minetest.get_player_by_name(self.player) then
|
||||||
puncher = minetest.get_player_by_name(self.player)
|
puncher = minetest.get_player_by_name(self.player)
|
||||||
end
|
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, {
|
obj:punch(puncher, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups={fleshy=eq},
|
damage_groups={fleshy=damage},
|
||||||
}, nil)
|
}, nil)
|
||||||
if math.random() < toughness then
|
if math.random() < toughness then
|
||||||
if math.random(0,100) % 2 == 0 then
|
if math.random(0,100) % 2 == 0 then
|
||||||
|
@ -37,6 +37,7 @@ local THROWING_ARROW_ENTITY={
|
|||||||
lastpos={},
|
lastpos={},
|
||||||
collisionbox = {0,0,0,0,0,0},
|
collisionbox = {0,0,0,0,0,0},
|
||||||
player = "",
|
player = "",
|
||||||
|
bow_damage = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
||||||
|
@ -38,6 +38,7 @@ local THROWING_ARROW_ENTITY={
|
|||||||
collisionbox = {0,0,0,0,0,0},
|
collisionbox = {0,0,0,0,0,0},
|
||||||
node = "",
|
node = "",
|
||||||
player = "",
|
player = "",
|
||||||
|
bow_damage = 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
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)
|
puncher = minetest.get_player_by_name(self.player)
|
||||||
end
|
end
|
||||||
local damage = 0.5
|
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, {
|
obj:punch(puncher, 1.0, {
|
||||||
full_punch_interval=1.0,
|
full_punch_interval=1.0,
|
||||||
damage_groups={fleshy=damage},
|
damage_groups={fleshy=damage},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user