diff --git a/defaults.lua b/defaults.lua index b6c246f..ec803ed 100644 --- a/defaults.lua +++ b/defaults.lua @@ -22,8 +22,3 @@ DISABLE_STONE_ARROW = false DISABLE_STEEL_ARROW = false DISABLE_DIAMOND_ARROW = false DISABLE_OBSIDIAN_ARROW = false - -DISABLE_STONE_SPEAR = false -DISABLE_STEEL_SPEAR = false -DISABLE_DIAMOND_SPEAR = false -DISABLE_OBSIDIAN_SPEAR = false diff --git a/functions.lua b/functions.lua index 0848ac3..007e899 100644 --- a/functions.lua +++ b/functions.lua @@ -129,18 +129,3 @@ function throwing_register_bow (name, desc, scale, stiffness, reload_time, tough } }) end - --- Spears - -function throwing_shoot_spear (itemstack, player) - local spear = itemstack:get_name() .. '_entity' - local playerpos = player:getpos() - local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, spear) - local dir = player:get_look_dir() - obj:setvelocity({x=dir.x*14, y=dir.y*14, z=dir.z*14}) - 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/init.lua b/init.lua index 7ad1419..be1d42a 100644 --- a/init.lua +++ b/init.lua @@ -29,8 +29,6 @@ dofile(minetest.get_modpath("throwing").."/tools.lua") dofile(minetest.get_modpath("throwing").."/standard_arrows.lua") -dofile(minetest.get_modpath("throwing").."/spears.lua") - if minetest.get_modpath('fire') and minetest.get_modpath('bucket') and not DISABLE_FIRE_ARROW then dofile(minetest.get_modpath("throwing").."/fire_arrow.lua") end diff --git a/spears.lua b/spears.lua deleted file mode 100644 index f8d492e..0000000 --- a/spears.lua +++ /dev/null @@ -1,129 +0,0 @@ -function throwing_register_spear_standard (kind, desc, eq, toughness, craft) - minetest.register_tool("throwing:spear_" .. kind, { - description = desc .. " spear", - inventory_image = "throwing_spear_" .. kind .. ".png", - wield_scale= {x=2,y=1.5,z=1.5}; - on_use = function(itemstack, user, pointed_thing) - if pointed_thing.type == "object" then - local damage = ((eq + 20)^1.2)/10 - pointed_thing.ref:punch(user, 1.0, { - full_punch_interval=1.0, - damage_groups={fleshy=damage}, - }, nil) - if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/toughness) - end - else - throwing_shoot_spear(itemstack, user) - if not minetest.setting_getbool("creative_mode") then - itemstack:take_item() - end - end - return itemstack - end, - }) - - minetest.register_node("throwing:spear_" .. kind .. "_box", { - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - -- Shaft - {-60/16, -2/16, 2/16, 4, 1/16, -1/16}, - --Spitze - {-4, -1/16, 1/16, -62/16, 0, 0}, - {-62/16, -1.5/16, 1.5/16, -60/16, 0.5/16, -0.5/16}, - } - }, - tiles = {"throwing_spear_box.png"}, - groups = {not_in_creative_inventory=1}, - }) - - local THROWING_SPEAR_ENTITY={ - physical = false, - timer=0, - visual = "wielditem", - visual_size = {x=0.1, y=0.1}, - textures = {"throwing:spear_" .. kind .. "_box"}, - lastpos={}, - collisionbox = {0,0,0,0,0,0}, - } - - THROWING_SPEAR_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.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 - if obj:get_luaentity() ~= nil then - if obj:get_luaentity().name ~= "throwing:spear_" .. kind .. "_entity" and obj:get_luaentity().name ~= "__builtin:item" then - local speed = vector.length(self.object:getvelocity()) - local damage = ((speed + eq +5)^1.2)/10 - obj:punch(self.object, 1.0, { - full_punch_interval=1.0, - damage_groups={fleshy=damage}, - }, nil) - self.object:remove() - 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, '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() - 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} - end - - minetest.register_entity("throwing:spear_" .. kind .. "_entity", THROWING_SPEAR_ENTITY) - - minetest.register_craft({ - output = 'throwing:spear_' .. kind, - recipe = { - {'group:wood', 'group:wood', craft}, - } - }) - - minetest.register_craft({ - output = 'throwing:spear_' .. kind, - recipe = { - {craft, 'group:wood', 'group:wood'}, - } - }) -end - -if not DISABLE_STONE_SPEAR then - throwing_register_spear_standard ('stone', 'Stone', 0, 20, 'group:stone') -end - -if not DISABLE_STEEL_SPEAR then - 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, 40, 'default:diamond') -end - -if not DISABLE_OBSIDIAN_SPEAR then - throwing_register_spear_standard ('obsidian', 'Obsidian', 15, 30, 'default:obsidian') -end diff --git a/standard_arrows.lua b/standard_arrows.lua index 02c1e3e..60674e0 100644 --- a/standard_arrows.lua +++ b/standard_arrows.lua @@ -57,11 +57,11 @@ function throwing_register_arrow_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:arrow_' .. kind) - else - minetest.add_item(self.lastpos, 'default:stick') - end + --if math.random() < toughness then + --minetest.add_item(self.lastpos, 'throwing:arrow_' .. kind) + --else + --minetest.add_item(self.lastpos, 'default:stick') + --end end end end diff --git a/textures/throwing_spear_box.png b/textures/throwing_spear_box.png deleted file mode 100644 index 628e171..0000000 Binary files a/textures/throwing_spear_box.png and /dev/null differ diff --git a/textures/throwing_spear_diamond.png b/textures/throwing_spear_diamond.png deleted file mode 100644 index 0e3bc18..0000000 Binary files a/textures/throwing_spear_diamond.png and /dev/null differ diff --git a/textures/throwing_spear_obsidian.png b/textures/throwing_spear_obsidian.png deleted file mode 100644 index cb7cec6..0000000 Binary files a/textures/throwing_spear_obsidian.png and /dev/null differ diff --git a/textures/throwing_spear_steel.png b/textures/throwing_spear_steel.png deleted file mode 100644 index 96a170e..0000000 Binary files a/textures/throwing_spear_steel.png and /dev/null differ diff --git a/textures/throwing_spear_stone.png b/textures/throwing_spear_stone.png deleted file mode 100644 index 78cb06e..0000000 Binary files a/textures/throwing_spear_stone.png and /dev/null differ