diff --git a/README.txt b/README.txt index 85ff5c9..4d3cf61 100644 --- a/README.txt +++ b/README.txt @@ -21,6 +21,11 @@ Grahpics & sounds: CC-BY 3.0 (see http://creativecommons.org/licenses/by/3.0/leg Changelog: +Update 1.4.1: +- Fixed spears not retaining wear +- Improved textures +- Torch arrows have light trail + Update 1.4: - Added spears, capable of melee and ranged attacks - Improved arrows textures diff --git a/build_arrow.lua b/build_arrow.lua index 7f09a63..d0cb031 100644 --- a/build_arrow.lua +++ b/build_arrow.lua @@ -44,6 +44,9 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) self.timer=self.timer+dtime local pos = self.object:getpos() local node = minetest.get_node(pos) + if not self.inventory or not self.stack then + self.object:remove() + end if self.timer>0.2 then local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1) diff --git a/functions.lua b/functions.lua index 3947342..0848ac3 100644 --- a/functions.lua +++ b/functions.lua @@ -141,5 +141,6 @@ function throwing_shoot_spear (itemstack, player) obj:setacceleration({x=-dir.x*1, y=-9.8, z=-dir.z*1}) obj:setyaw(player:get_look_yaw()+math.pi) minetest.sound_play("throwing_bow_sound", {pos=playerpos}) + obj:get_luaentity().wear = itemstack:get_wear() return true end diff --git a/shell_arrow.lua b/shell_arrow.lua index 76750e9..5267cf9 100644 --- a/shell_arrow.lua +++ b/shell_arrow.lua @@ -93,7 +93,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) end if self.lastpos.x~=nil then - if node.name ~= "air" and not string.find(node.name, 'default:grass') and not string.find(node.name, 'default:junglegrass') and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then + if node.name ~= "air" and not (string.find(node.name, 'grass') and not string.find(node.name, 'dirt')) and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then self.object:remove() boom(self.lastpos) end diff --git a/spears.lua b/spears.lua index 1a93fa5..f8d492e 100644 --- a/spears.lua +++ b/spears.lua @@ -11,7 +11,7 @@ function throwing_register_spear_standard (kind, desc, eq, toughness, craft) damage_groups={fleshy=damage}, }, nil) if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/(toughness*100)) + itemstack:add_wear(65535/toughness) end else throwing_shoot_spear(itemstack, user) @@ -53,7 +53,11 @@ function throwing_register_spear_standard (kind, desc, eq, toughness, craft) self.timer=self.timer+dtime local pos = self.object:getpos() local node = minetest.get_node(pos) - + if not self.wear then + self.object:remove() + return + end + if self.timer>0.2 then local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2) for k, obj in pairs(objs) do @@ -66,24 +70,26 @@ function throwing_register_spear_standard (kind, desc, eq, toughness, craft) damage_groups={fleshy=damage}, }, nil) self.object:remove() - if math.random() < toughness then - minetest.add_item(self.lastpos, 'throwing:spear_' .. kind) - else - minetest.add_item(self.lastpos, 'default:stick') - end + minetest.add_item(self.lastpos, {name='throwing:spear_' .. kind, count=1, wear=self.wear+65535/toughness, metadata=""}) + --if math.random() < toughness then + --minetest.add_item(self.lastpos, 'throwing:spear_' .. kind) + --else + --minetest.add_item(self.lastpos, 'default:stick') + --end end end end end if self.lastpos.x~=nil then - if node.name ~= "air" and not string.find(node.name, 'default:grass') and not string.find(node.name, 'default:junglegrass') and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then + if node.name ~= "air" and not (string.find(node.name, 'grass') and not string.find(node.name, 'dirt')) and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then self.object:remove() - if math.random() < toughness then - minetest.add_item(self.lastpos, 'throwing:spear_' .. kind) - else - minetest.add_item(self.lastpos, 'default:stick') - end + minetest.add_item(self.lastpos, {name='throwing:spear_' .. kind, count=1, wear=self.wear+65535/toughness, metadata=""}) + --if math.random() < toughness then + --minetest.add_item(self.lastpos, 'throwing:spear_' .. kind) + --else + --minetest.add_item(self.lastpos, 'default:stick') + --end end end self.lastpos={x=pos.x, y=pos.y, z=pos.z} @@ -107,17 +113,17 @@ function throwing_register_spear_standard (kind, desc, eq, toughness, craft) end if not DISABLE_STONE_SPEAR then - throwing_register_spear_standard ('stone', 'Stone', 0, 0.75, 'group:stone') + throwing_register_spear_standard ('stone', 'Stone', 0, 20, 'group:stone') end if not DISABLE_STEEL_SPEAR then - throwing_register_spear_standard ('steel', 'Steel', 5, 0.90, 'default:steel_ingot') + throwing_register_spear_standard ('steel', 'Steel', 5, 30, 'default:steel_ingot') end if not DISABLE_DIAMOND_SPEAR then - throwing_register_spear_standard ('diamond', 'Diamond', 10, 0.99, 'default:diamond') + throwing_register_spear_standard ('diamond', 'Diamond', 10, 40, 'default:diamond') end if not DISABLE_OBSIDIAN_SPEAR then - throwing_register_spear_standard ('obsidian', 'Obsidian', 15, 0.80, 'default:obsidian') + throwing_register_spear_standard ('obsidian', 'Obsidian', 15, 30, 'default:obsidian') end diff --git a/standard_arrows.lua b/standard_arrows.lua index 900b4b8..02c1e3e 100644 --- a/standard_arrows.lua +++ b/standard_arrows.lua @@ -68,7 +68,7 @@ function throwing_register_arrow_standard (kind, desc, eq, toughness, craft) end if self.lastpos.x~=nil then - if node.name ~= "air" and not string.find(node.name, 'default:grass') and not string.find(node.name, 'default:junglegrass') and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then + if node.name ~= "air" and not (string.find(node.name, 'grass') and not string.find(node.name, 'dirt')) and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then self.object:remove() if math.random() < toughness then minetest.add_item(self.lastpos, 'throwing:arrow_' .. kind) diff --git a/teleport_arrow.lua b/teleport_arrow.lua index 0eadc6e..d495de3 100644 --- a/teleport_arrow.lua +++ b/teleport_arrow.lua @@ -44,6 +44,9 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) self.timer=self.timer+dtime local pos = self.object:getpos() local node = minetest.get_node(pos) + if not self.player then + self.object:remove() + end if self.timer>0.2 then local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 2) diff --git a/textures/throwing_arrow_build.png b/textures/throwing_arrow_build.png index 9b34bba..d9b4062 100644 Binary files a/textures/throwing_arrow_build.png and b/textures/throwing_arrow_build.png differ diff --git a/textures/throwing_arrow_build_2.png b/textures/throwing_arrow_build_2.png index c54f9fc..1e178e4 100644 Binary files a/textures/throwing_arrow_build_2.png and b/textures/throwing_arrow_build_2.png differ diff --git a/textures/throwing_arrow_build_front.png b/textures/throwing_arrow_build_front.png index 4a651a5..25d47ce 100644 Binary files a/textures/throwing_arrow_build_front.png and b/textures/throwing_arrow_build_front.png differ diff --git a/textures/throwing_arrow_diamond.png b/textures/throwing_arrow_diamond.png index 77eaf59..a70038a 100644 Binary files a/textures/throwing_arrow_diamond.png and b/textures/throwing_arrow_diamond.png differ diff --git a/textures/throwing_arrow_diamond_2.png b/textures/throwing_arrow_diamond_2.png index 11727f0..485b12f 100644 Binary files a/textures/throwing_arrow_diamond_2.png and b/textures/throwing_arrow_diamond_2.png differ diff --git a/textures/throwing_arrow_diamond_front.png b/textures/throwing_arrow_diamond_front.png index 791c88d..6e545df 100644 Binary files a/textures/throwing_arrow_diamond_front.png and b/textures/throwing_arrow_diamond_front.png differ diff --git a/textures/throwing_arrow_dig.png b/textures/throwing_arrow_dig.png index 8eea6ea..6a1d443 100644 Binary files a/textures/throwing_arrow_dig.png and b/textures/throwing_arrow_dig.png differ diff --git a/textures/throwing_arrow_dig_2.png b/textures/throwing_arrow_dig_2.png index 714dc18..b6d9d1b 100644 Binary files a/textures/throwing_arrow_dig_2.png and b/textures/throwing_arrow_dig_2.png differ diff --git a/textures/throwing_arrow_dig_front.png b/textures/throwing_arrow_dig_front.png index 7a29499..aa7ff2e 100644 Binary files a/textures/throwing_arrow_dig_front.png and b/textures/throwing_arrow_dig_front.png differ diff --git a/textures/throwing_arrow_fireworks_blue.png b/textures/throwing_arrow_fireworks_blue.png index 5c0e256..71d4ec8 100644 Binary files a/textures/throwing_arrow_fireworks_blue.png and b/textures/throwing_arrow_fireworks_blue.png differ diff --git a/textures/throwing_arrow_fireworks_blue_2.png b/textures/throwing_arrow_fireworks_blue_2.png index bf2f8ad..51b055c 100644 Binary files a/textures/throwing_arrow_fireworks_blue_2.png and b/textures/throwing_arrow_fireworks_blue_2.png differ diff --git a/textures/throwing_arrow_fireworks_blue_front.png b/textures/throwing_arrow_fireworks_blue_front.png index fca7c92..8674cc8 100644 Binary files a/textures/throwing_arrow_fireworks_blue_front.png and b/textures/throwing_arrow_fireworks_blue_front.png differ diff --git a/textures/throwing_arrow_fireworks_red.png b/textures/throwing_arrow_fireworks_red.png index 8498adb..9b13fcd 100644 Binary files a/textures/throwing_arrow_fireworks_red.png and b/textures/throwing_arrow_fireworks_red.png differ diff --git a/textures/throwing_arrow_fireworks_red_2.png b/textures/throwing_arrow_fireworks_red_2.png index b33125e..edb0097 100644 Binary files a/textures/throwing_arrow_fireworks_red_2.png and b/textures/throwing_arrow_fireworks_red_2.png differ diff --git a/textures/throwing_arrow_fireworks_red_front.png b/textures/throwing_arrow_fireworks_red_front.png index d84e5a1..8d6a629 100644 Binary files a/textures/throwing_arrow_fireworks_red_front.png and b/textures/throwing_arrow_fireworks_red_front.png differ diff --git a/textures/throwing_arrow_obsidian.png b/textures/throwing_arrow_obsidian.png index c26f864..2df7a08 100644 Binary files a/textures/throwing_arrow_obsidian.png and b/textures/throwing_arrow_obsidian.png differ diff --git a/textures/throwing_arrow_obsidian_2.png b/textures/throwing_arrow_obsidian_2.png index 90ef6d1..abccbb3 100644 Binary files a/textures/throwing_arrow_obsidian_2.png and b/textures/throwing_arrow_obsidian_2.png differ diff --git a/textures/throwing_arrow_obsidian_front.png b/textures/throwing_arrow_obsidian_front.png index f74c13e..2cbed4c 100644 Binary files a/textures/throwing_arrow_obsidian_front.png and b/textures/throwing_arrow_obsidian_front.png differ diff --git a/textures/throwing_arrow_shell.png b/textures/throwing_arrow_shell.png index 01b84d5..d100424 100644 Binary files a/textures/throwing_arrow_shell.png and b/textures/throwing_arrow_shell.png differ diff --git a/textures/throwing_arrow_shell_2.png b/textures/throwing_arrow_shell_2.png index a834ca4..25f2b3e 100644 Binary files a/textures/throwing_arrow_shell_2.png and b/textures/throwing_arrow_shell_2.png differ diff --git a/textures/throwing_arrow_shell_front.png b/textures/throwing_arrow_shell_front.png index 06b9454..f6d51c4 100644 Binary files a/textures/throwing_arrow_shell_front.png and b/textures/throwing_arrow_shell_front.png differ diff --git a/textures/throwing_arrow_steel.png b/textures/throwing_arrow_steel.png index dd9f205..9932590 100644 Binary files a/textures/throwing_arrow_steel.png and b/textures/throwing_arrow_steel.png differ diff --git a/textures/throwing_arrow_steel_2.png b/textures/throwing_arrow_steel_2.png index 2098089..c0401a6 100644 Binary files a/textures/throwing_arrow_steel_2.png and b/textures/throwing_arrow_steel_2.png differ diff --git a/textures/throwing_arrow_steel_front.png b/textures/throwing_arrow_steel_front.png index 38ccec4..ff22af0 100644 Binary files a/textures/throwing_arrow_steel_front.png and b/textures/throwing_arrow_steel_front.png differ diff --git a/textures/throwing_arrow_stone.png b/textures/throwing_arrow_stone.png index 5a818f3..b563af6 100644 Binary files a/textures/throwing_arrow_stone.png and b/textures/throwing_arrow_stone.png differ diff --git a/textures/throwing_arrow_stone_2.png b/textures/throwing_arrow_stone_2.png index 2fd65ac..20182bc 100644 Binary files a/textures/throwing_arrow_stone_2.png and b/textures/throwing_arrow_stone_2.png differ diff --git a/textures/throwing_arrow_stone_front.png b/textures/throwing_arrow_stone_front.png index c93a35c..8b35047 100644 Binary files a/textures/throwing_arrow_stone_front.png and b/textures/throwing_arrow_stone_front.png differ diff --git a/textures/throwing_arrow_teleport.png b/textures/throwing_arrow_teleport.png index 7cd174c..584735b 100644 Binary files a/textures/throwing_arrow_teleport.png and b/textures/throwing_arrow_teleport.png differ diff --git a/textures/throwing_arrow_teleport_2.png b/textures/throwing_arrow_teleport_2.png index 86b3542..56192c8 100644 Binary files a/textures/throwing_arrow_teleport_2.png and b/textures/throwing_arrow_teleport_2.png differ diff --git a/textures/throwing_arrow_teleport_front.png b/textures/throwing_arrow_teleport_front.png index c2e693f..138f1cf 100644 Binary files a/textures/throwing_arrow_teleport_front.png and b/textures/throwing_arrow_teleport_front.png differ diff --git a/textures/throwing_arrow_tnt.png b/textures/throwing_arrow_tnt.png index 7934bb5..c7ee8f1 100644 Binary files a/textures/throwing_arrow_tnt.png and b/textures/throwing_arrow_tnt.png differ diff --git a/textures/throwing_arrow_tnt_2.png b/textures/throwing_arrow_tnt_2.png index b3560bf..3b53ece 100644 Binary files a/textures/throwing_arrow_tnt_2.png and b/textures/throwing_arrow_tnt_2.png differ diff --git a/textures/throwing_arrow_tnt_front.png b/textures/throwing_arrow_tnt_front.png index 38d22e3..b7252ac 100644 Binary files a/textures/throwing_arrow_tnt_front.png and b/textures/throwing_arrow_tnt_front.png differ diff --git a/textures/throwing_arrow_torch.png b/textures/throwing_arrow_torch.png index c564c27..1c424e4 100644 Binary files a/textures/throwing_arrow_torch.png and b/textures/throwing_arrow_torch.png differ diff --git a/textures/throwing_arrow_torch_2.png b/textures/throwing_arrow_torch_2.png index e2857ec..a5800ce 100644 Binary files a/textures/throwing_arrow_torch_2.png and b/textures/throwing_arrow_torch_2.png differ diff --git a/textures/throwing_spear_diamond.png b/textures/throwing_spear_diamond.png index e9c71f6..0e3bc18 100644 Binary files a/textures/throwing_spear_diamond.png and b/textures/throwing_spear_diamond.png differ diff --git a/textures/throwing_spear_obsidian.png b/textures/throwing_spear_obsidian.png index f81541c..cb7cec6 100644 Binary files a/textures/throwing_spear_obsidian.png and b/textures/throwing_spear_obsidian.png differ diff --git a/textures/throwing_spear_steel.png b/textures/throwing_spear_steel.png index 60037a5..96a170e 100644 Binary files a/textures/throwing_spear_steel.png and b/textures/throwing_spear_steel.png differ diff --git a/textures/throwing_spear_stone.png b/textures/throwing_spear_stone.png index 8daaeac..78cb06e 100644 Binary files a/textures/throwing_spear_stone.png and b/textures/throwing_spear_stone.png differ diff --git a/torch_arrow.lua b/torch_arrow.lua index 004b73d..0de170a 100644 --- a/torch_arrow.lua +++ b/torch_arrow.lua @@ -68,7 +68,10 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) end if self.lastpos.x~=nil then - if node.name ~= "air" then + if node.name == 'air' then + minetest.add_node(pos, {name="throwing:torch_trail"}) + minetest.get_node_timer(pos):start(0.1) + elseif node.name ~= "air" and not string.find(node.name, "trail") then self.object:remove() if not string.find(node.name, "water") and not string.find(node.name, "lava") and not string.find(node.name, "torch") then local dir=vector.direction(self.lastpos, pos) @@ -102,3 +105,14 @@ minetest.register_craft({ {'group:coal', 'default:stick', 'default:stick'}, } }) + +minetest.register_node("throwing:torch_trail", { + drawtype = "airlike", + light_source = default.LIGHT_MAX-1, + walkable = false, + drop = "", + groups = {dig_immediate=3}, + on_timer = function(pos, elapsed) + minetest.remove_node(pos) + end, +})