forked from mtcontrib/throwing
0.9.8, new damage system and fixed reload bug
This commit is contained in:
parent
31e4dea2b6
commit
280afde321
10
bows.lua
10
bows.lua
@ -9,16 +9,14 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
local throwing_shoot_arrow = function(itemstack, player)
|
local throwing_shoot_arrow = function(itemstack, player)
|
||||||
|
for _,arrow in ipairs(arrows) do
|
||||||
|
if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then
|
||||||
local playername = player:get_player_name()
|
local playername = player:get_player_name()
|
||||||
if minetest.get_player_privs(playername).throw then
|
if minetest.get_player_privs(playername).throw then
|
||||||
local privs = minetest.get_player_privs(playername)
|
local privs = minetest.get_player_privs(playername)
|
||||||
privs.throw = nil
|
privs.throw = nil
|
||||||
minetest.chat_send_player(playername, tostring(privs.throw))
|
|
||||||
minetest.set_player_privs(playername, privs)
|
minetest.set_player_privs(playername, privs)
|
||||||
local privs = minetest.get_player_privs(playername)
|
local privs = minetest.get_player_privs(playername)
|
||||||
minetest.chat_send_player(playername, tostring(privs.throw))
|
|
||||||
for _,arrow in ipairs(arrows) do
|
|
||||||
if player:get_inventory():get_stack("main", player:get_wield_index()+1):get_name() == arrow[1] then
|
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
player:get_inventory():remove_item("main", arrow[1])
|
player:get_inventory():remove_item("main", arrow[1])
|
||||||
end
|
end
|
||||||
@ -109,7 +107,7 @@ if not disable_wooden_bow then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if not disable_golden_bow then -- To become longbow soon
|
if not disable_golden_bow then -- To be changed soon
|
||||||
minetest.register_tool("throwing:bow_gold", {
|
minetest.register_tool("throwing:bow_gold", {
|
||||||
description = "Golden Bow",
|
description = "Golden Bow",
|
||||||
inventory_image = "throwing_bow_gold.png",
|
inventory_image = "throwing_bow_gold.png",
|
||||||
@ -192,7 +190,7 @@ if not disable_steel_bow then
|
|||||||
wield_scale = {x=1, y=1, z=0.5},
|
wield_scale = {x=1, y=1, z=0.5},
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
stiffness = 19
|
stiffness = 20
|
||||||
reload = 1.6
|
reload = 1.6
|
||||||
if throwing_shoot_arrow(itemstack, user, pointed_thing) then
|
if throwing_shoot_arrow(itemstack, user, pointed_thing) then
|
||||||
reloading(user)
|
reloading(user)
|
||||||
|
@ -49,7 +49,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
|||||||
for k, obj in pairs(objs) do
|
for k, obj in pairs(objs) do
|
||||||
if obj:get_luaentity() ~= nil then
|
if obj:get_luaentity() ~= nil then
|
||||||
if obj:get_luaentity().name ~= "throwing:arrow_diamond_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
if obj:get_luaentity().name ~= "throwing:arrow_diamond_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||||
local damage = 5
|
local speed = vector.length(self.object:getvelocity())
|
||||||
|
local damage = ((speed + 10)^1.2)/10
|
||||||
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,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
|||||||
for k, obj in pairs(objs) do
|
for k, obj in pairs(objs) do
|
||||||
if obj:get_luaentity() ~= nil then
|
if obj:get_luaentity() ~= nil then
|
||||||
if obj:get_luaentity().name ~= "throwing:arrow_obsidian_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
if obj:get_luaentity().name ~= "throwing:arrow_obsidian_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||||
local damage = 6
|
local speed = vector.length(self.object:getvelocity())
|
||||||
|
local damage = ((speed + 15)^1.2)/10
|
||||||
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},
|
||||||
|
@ -79,7 +79,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
|||||||
for k, obj in pairs(objs) do
|
for k, obj in pairs(objs) do
|
||||||
if obj:get_luaentity() ~= nil then
|
if obj:get_luaentity() ~= nil then
|
||||||
if obj:get_luaentity().name ~= "throwing:arrow_shell_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
if obj:get_luaentity().name ~= "throwing:arrow_shell_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||||
local damage = 16
|
local speed = vector.length(self.object:getvelocity())
|
||||||
|
local damage = ((speed + 5)^1.2)/10 + 12
|
||||||
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,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
|||||||
for k, obj in pairs(objs) do
|
for k, obj in pairs(objs) do
|
||||||
if obj:get_luaentity() ~= nil then
|
if obj:get_luaentity() ~= nil then
|
||||||
if obj:get_luaentity().name ~= "throwing:arrow_steel_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
if obj:get_luaentity().name ~= "throwing:arrow_steel_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||||
local damage = 3
|
local speed = vector.length(self.object:getvelocity())
|
||||||
|
local damage = ((speed + 5)^1.2)/10
|
||||||
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,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime)
|
|||||||
for k, obj in pairs(objs) do
|
for k, obj in pairs(objs) do
|
||||||
if obj:get_luaentity() ~= nil then
|
if obj:get_luaentity() ~= nil then
|
||||||
if obj:get_luaentity().name ~= "throwing:arrow_stone_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
if obj:get_luaentity().name ~= "throwing:arrow_stone_entity" and obj:get_luaentity().name ~= "__builtin:item" then
|
||||||
local damage = 1.5
|
local speed = vector.length(self.object:getvelocity())
|
||||||
|
local damage = ((speed)^1.2)/10
|
||||||
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},
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 595 B After Width: | Height: | Size: 646 B |
Binary file not shown.
Before Width: | Height: | Size: 510 B After Width: | Height: | Size: 633 B |
Binary file not shown.
Before Width: | Height: | Size: 577 B After Width: | Height: | Size: 584 B |
Loading…
Reference in New Issue
Block a user