diff --git a/bows.lua b/bows.lua index 2bce3ab..bac8893 100644 --- a/bows.lua +++ b/bows.lua @@ -9,16 +9,14 @@ minetest.register_on_joinplayer(function(player) end) local throwing_shoot_arrow = function(itemstack, player) - local playername = player:get_player_name() - if minetest.get_player_privs(playername).throw then - local privs = minetest.get_player_privs(playername) - privs.throw = nil - minetest.chat_send_player(playername, tostring(privs.throw)) - minetest.set_player_privs(playername, privs) - 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 + 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() + if minetest.get_player_privs(playername).throw then + local privs = minetest.get_player_privs(playername) + privs.throw = nil + minetest.set_player_privs(playername, privs) + local privs = minetest.get_player_privs(playername) if not minetest.setting_getbool("creative_mode") then player:get_inventory():remove_item("main", arrow[1]) end @@ -109,7 +107,7 @@ if not disable_wooden_bow then }) 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", { description = "Golden Bow", 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}, stack_max = 1, on_use = function(itemstack, user, pointed_thing) - stiffness = 19 + stiffness = 20 reload = 1.6 if throwing_shoot_arrow(itemstack, user, pointed_thing) then reloading(user) diff --git a/diamond_arrow.lua b/diamond_arrow.lua index b088a1e..b931d28 100644 --- a/diamond_arrow.lua +++ b/diamond_arrow.lua @@ -49,7 +49,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) for k, obj in pairs(objs) do if obj:get_luaentity() ~= nil 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, { full_punch_interval=1.0, damage_groups={fleshy=damage}, diff --git a/obsidian_arrow.lua b/obsidian_arrow.lua index 262b839..db26542 100644 --- a/obsidian_arrow.lua +++ b/obsidian_arrow.lua @@ -49,7 +49,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) for k, obj in pairs(objs) do if obj:get_luaentity() ~= nil 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, { full_punch_interval=1.0, damage_groups={fleshy=damage}, diff --git a/shell_arrow.lua b/shell_arrow.lua index 399a235..5a3afa9 100644 --- a/shell_arrow.lua +++ b/shell_arrow.lua @@ -79,7 +79,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) for k, obj in pairs(objs) do if obj:get_luaentity() ~= nil 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, { full_punch_interval=1.0, damage_groups={fleshy=damage}, diff --git a/steel_arrow.lua b/steel_arrow.lua index 6e12da6..a4d2eb0 100644 --- a/steel_arrow.lua +++ b/steel_arrow.lua @@ -49,7 +49,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) for k, obj in pairs(objs) do if obj:get_luaentity() ~= nil 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, { full_punch_interval=1.0, damage_groups={fleshy=damage}, diff --git a/stone_arrow.lua b/stone_arrow.lua index 4d94d8e..66d522b 100644 --- a/stone_arrow.lua +++ b/stone_arrow.lua @@ -49,7 +49,8 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) for k, obj in pairs(objs) do if obj:get_luaentity() ~= nil 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, { full_punch_interval=1.0, damage_groups={fleshy=damage}, diff --git a/textures/throwing_bow_composite.png b/textures/throwing_bow_composite.png index bf9658c..88a085e 100644 Binary files a/textures/throwing_bow_composite.png and b/textures/throwing_bow_composite.png differ diff --git a/textures/throwing_bow_steel.png b/textures/throwing_bow_steel.png index dea3744..2876f6c 100644 Binary files a/textures/throwing_bow_steel.png and b/textures/throwing_bow_steel.png differ diff --git a/textures/throwing_bow_wood.png b/textures/throwing_bow_wood.png index 9b0e226..cb1944e 100644 Binary files a/textures/throwing_bow_wood.png and b/textures/throwing_bow_wood.png differ