diff --git a/mods/framedglass/textures/framedglass_blueglass_frame.png b/mods/framedglass/textures/framedglass_blueglass_frame.png old mode 100644 new mode 100755 diff --git a/mods/framedglass/textures/framedglass_steelglass_face_clean_frame.png b/mods/framedglass/textures/framedglass_steelglass_face_clean_frame.png old mode 100644 new mode 100755 diff --git a/mods/framedglass/textures/framedglass_steelglass_face_streaks_frame.png b/mods/framedglass/textures/framedglass_steelglass_face_streaks_frame.png old mode 100644 new mode 100755 diff --git a/mods/framedglass/textures/framedglass_woodenglass_face_clean_frame.png b/mods/framedglass/textures/framedglass_woodenglass_face_clean_frame.png old mode 100644 new mode 100755 diff --git a/mods/framedglass/textures/framedglass_woodenglass_face_streaks_frame.png b/mods/framedglass/textures/framedglass_woodenglass_face_streaks_frame.png old mode 100644 new mode 100755 diff --git a/mods/throwing/README.txt b/mods/throwing/README.txt index b7fbde48..dbcb9d47 100755 --- a/mods/throwing/README.txt +++ b/mods/throwing/README.txt @@ -1,47 +1,98 @@ -=== THROWING-MOD for MINETEST === -by PilzAdam +=== THROWING ENHANCED for MINETEST === Inroduction: -This mod adds bows and arrows to Minetest. +This mod adds many bows and arrows to Minetest. +It began as a fork of PilzAdam's throwing mod with some enhancements from me. Enjoy! +Echoes91 How to install: -Unzip the archive an place it in minetest-base-directory/mods/minetest/ -if you have a windows client or a linux run-in-place client. If you have -a linux system-wide instalation place it in ~/.minetest/mods/minetest/. -If you want to install this mod only in one world create the folder -worldmods/ in your worlddirectory. -For further information or help see: http://wiki.minetest.com/wiki/Installing_Mods How to use the mod: -Craft a bow with the strings from the farming mod: -string wood -string wood -string wood -Craft arrows with: -stick stick steel -Select the bow and shoot with left mouse click. Every shoot will take 1 -arrow from your inventory and wears out the bow (you have around 50 -shoots). +Select the bow and place the arrows into the slot next to it; shoot with left mouse click. +Every shoot will take 1 arrow from your inventory and wears out the bow. License: -This mod was originally published by Jeija. -Sourcecode: WTFPL (see below) -Grahpics: WTFPL (see below) +This mod was originally published by Jeija and reworked by PilzAdam +Sourcecode: LGPLv2.1 (see http://www.gnu.org/licenses/lgpl-2.1.html) +Grahpics & sounds: CC-BY 3.0 (see http://creativecommons.org/licenses/by/3.0/legalcode) -See also: -http://minetest.net/ - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 +Changelog: - Copyright (C) 2004 Sam Hocevar +Update 1.2: +- Added arbalest +- Defaults initialized - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. +Update 1.1: +- Added crossbow +- Code shrink +- Offensive arrows go through flora's and farming's +- Small fixes - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +Update 1.0: +- Definitive reload, unload and shot system based on tool metadata, new global functions, no more "throw" privilege +- New textures for loaded bows +- Fireworks arrows to celebrate! - 0. You just DO WHAT THE FUCK YOU WANT TO. +Update 1.0rc2: +- Fixed "compare nil with number" due to self.break not being retained +- Filled conf.example's list +- Added Royal bow + +Update 1.0rc1: +- Added longbow and removed golden bow, definitive bow set for stable release. Feature freeze +- Fixed torch arrow recipe, thanks to Excalibur Zero +- Removed config.lua, configuration now goes int throwing.config, see example + +Update 0.9.8: +- New damage calculation for offensive arrows based on arrow's speed and material. Beware that dependency is more than linear for both, so that differences between arrows will be enhanced if they're shot at higher speed. +- Fixed bug that blocked ability to shot after shooting with empty arrow stack. +- Removed annoying debug symbols + +Update 0.9.7: +- Added visual feedback for reload +- Fixed reload for players who die while reloading and for multiplayer +- Changed license for the code to LGPLv2 + +Update 0.9.6: +- Any bow and arrow is now deactivable under config.lua, which won't be overwritten +- Changed license for media to CC-BY + +Update 0.9.5: +- Added shell arrows +- Revised sounds and some textures +- General balancing of bow's statistics + +Update 0.9.4: +- New bow texture +- Made recipes coherent + +Update 0.9.3: +- Added symmetric recipes, fixed golden bow recipe +- Adjusted few parameters + +Update 0.9.2: +- Added a chance to break for many arrows, so they don't last forever and outclass any other tool +- Build and torch arrows won't build on fluids and torches any more, build arrows won't place torches +- TNT arrow digs instead if removing blocks, eventual indestructible nodes are safe +- Added golden bow with possible new bow style +- Changed the (bit OP) composite bow resistance and new recipe +- New teleport arrow recipe, cheaper but single use + +Update 0.9.1: +- Good improvement for torch arrows, now they always attach and are often turned to the right direction +- Git repository will make things nicer + +Update 0.9: +- Now bows have reload times! They depend on weight and quality, anyway no more machine-gun-style shell swarms +- Fixed build arrow behavior, now it placed and consumes the node from the slot [b]right next to the arrow[/b] or drops the item beside it if not a node; no more disappearing nor 'CONTENT_IGNORE' errors +- Code cleanup and rationalization + +Update 0.8.1: +- Fixed wrong texture reference which made some arrows get a bad color during flight. +- Now bows have different stiffness besides wear resistances, which means that they shot arrows at different initial speed and learning to hit the target will become even harder. + Get rid of the old .env: API + Added new bows and new offensive, utility and harmful arrows (these are just my categories, they're not present into the code at all). + Removed stone bow, at least as long as somebody discovers an elastic rock ;) + Non-exploding arrows won't disappear any more after hitting target. \ No newline at end of file diff --git a/mods/throwing/arrow.lua b/mods/throwing/arrow.lua deleted file mode 100755 index a079e1bd..00000000 --- a/mods/throwing/arrow.lua +++ /dev/null @@ -1,99 +0,0 @@ -minetest.register_craftitem("throwing:arrow", { - description = "Arrow", - inventory_image = "throwing_arrow.png", - stack_max = 200, -}) - -minetest.register_node("throwing:arrow_box", { - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - -- Shaft - {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, - -- Spitze - {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, - {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, - -- Federn - {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, - {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, - {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, - {6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17}, - - {7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17}, - {8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17}, - {8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17}, - {7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17}, - } - }, - tiles = {"throwing_arrow.png", "throwing_arrow.png", "throwing_arrow_back.png", "throwing_arrow_front.png", "throwing_arrow_2.png", "throwing_arrow.png"}, - groups = {not_in_creative_inventory = 1}, -}) - -local THROWING_ARROW_ENTITY = { - physical = false, - timer = 0, - visual = "wielditem", - visual_size = {x = 0.125, y = 0.125}, - textures = {"throwing:arrow_box"}, - lastpos= {}, - collisionbox = {0, 0, 0, 0, 0, 0}, -} - -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 self.timer > 0.2 then - local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1) - for k, obj in pairs(objs) do - if obj:get_luaentity() ~= nil then - if obj:get_luaentity().name ~= "throwing:arrow_entity" and obj:get_luaentity().name ~= "__builtin:item" then - local damage = 3 - obj:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups= {fleshy = damage}, - }, nil) - minetest.sound_play("throwing_arrow", {pos = self.lastpos, gain = 0.8}) - self.object:remove() - end - else - local damage = 3 - obj:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups= {fleshy = damage}, - }, nil) - minetest.sound_play("throwing_arrow", {pos = self.lastpos, gain = 0.8}) - self.object:remove() - end - end - end - - if self.lastpos.x ~= nil then - if minetest.registered_nodes[node.name].walkable then - if not minetest.setting_getbool("creative_mode") then - minetest.add_item(self.lastpos, "throwing:arrow") - end - minetest.sound_play("throwing_arrow", {pos = self.lastpos, gain = 0.8}) - self.object:remove() - end - end - self.lastpos= {x = pos.x, y = pos.y, z = pos.z} -end - -minetest.register_entity("throwing:arrow_entity", THROWING_ARROW_ENTITY) - -minetest.register_craft({ - output = "throwing:arrow 8", - recipe = { - {"default:stick", "default:stick", "group:ingot"}, - } -}) - -minetest.register_craft({ - output = "throwing:arrow 8", - recipe = { - {"group:ingot", "default:stick", "default:stick"}, - } -}) diff --git a/mods/throwing/build_arrow.lua b/mods/throwing/build_arrow.lua index 522dd364..7f09a63c 100755 --- a/mods/throwing/build_arrow.lua +++ b/mods/throwing/build_arrow.lua @@ -10,10 +10,10 @@ minetest.register_node("throwing:arrow_build_box", { fixed = { -- Shaft {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, - -- Spitze + --Spitze {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, - -- Federn + --Federn {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, @@ -26,70 +26,79 @@ minetest.register_node("throwing:arrow_build_box", { } }, tiles = {"throwing_arrow_build.png", "throwing_arrow_build.png", "throwing_arrow_build_back.png", "throwing_arrow_build_front.png", "throwing_arrow_build_2.png", "throwing_arrow_build.png"}, - groups = {not_in_creative_inventory = 1}, + groups = {not_in_creative_inventory=1}, }) -local THROWING_ARROW_ENTITY = { +local THROWING_ARROW_ENTITY={ physical = false, - timer = 0, + timer=0, visual = "wielditem", - visual_size = {x = 0.125, y = 0.125}, + visual_size = {x=0.1, y=0.1}, textures = {"throwing:arrow_build_box"}, - lastpos= {}, - collisionbox = {0, 0, 0, 0, 0, 0}, + lastpos={}, + collisionbox = {0,0,0,0,0,0}, node = "", } THROWING_ARROW_ENTITY.on_step = function(self, dtime) - self.timer = self.timer + dtime + self.timer=self.timer+dtime local pos = self.object:getpos() local node = minetest.get_node(pos) - if self.timer > 0.2 then - local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1) + if self.timer>0.2 then + local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1) for k, obj in pairs(objs) do if obj:get_luaentity() ~= nil then if obj:get_luaentity().name ~= "throwing:arrow_build_entity" and obj:get_luaentity().name ~= "__builtin:item" then - if self.node ~= "" then - minetest.set_node(self.lastpos, {name="default:obsidian_glass"}) - minetest.sound_play("throwing_build_arrow", {pos = self.lastpos}) - end self.object:remove() + if self.inventory and self.stack and not minetest.setting_getbool("creative_mode") then + self.inventory:remove_item("main", {name=self.stack:get_name()}) + end + if self.stack then + minetest.add_item(self.lastpos, {name=self.stack:get_name()}) + end + local toughness = 0.95 + if math.random() < toughness then + minetest.add_item(self.lastpos, 'throwing:arrow_build') + else + minetest.add_item(self.lastpos, 'default:stick') + end end - else - if self.node ~= "" then - minetest.set_node(self.lastpos, {name="default:obsidian_glass"}) - minetest.sound_play("throwing_build_arrow", {pos = self.lastpos}) - end - self.object:remove() end end end - if self.lastpos.x ~= nil then - if minetest.registered_nodes[node.name].walkable then - if self.node ~= "" then - minetest.set_node(self.lastpos, {name="default:obsidian_glass"}) - minetest.sound_play("throwing_build_arrow", {pos = self.lastpos}) - end + if self.lastpos.x~=nil then + if node.name ~= "air" then self.object:remove() + if self.inventory and self.stack and not minetest.setting_getbool("creative_mode") then + self.inventory:remove_item("main", {name=self.stack:get_name()}) + end + if self.stack then + if not string.find(node.name, "water") and not string.find(node.name, "lava") and not string.find(node.name, "torch") and self.stack:get_definition().type == "node" and self.stack:get_name() ~= "default:torch" then + minetest.place_node(self.lastpos, {name=self.stack:get_name()}) + else + minetest.add_item(self.lastpos, {name=self.stack:get_name()}) + end + end + minetest.add_item(self.lastpos, 'default:shovel_steel') end end - self.lastpos= {x = pos.x, y = pos.y, z = pos.z} + self.lastpos={x=pos.x, y=pos.y, z=pos.z} end minetest.register_entity("throwing:arrow_build_entity", THROWING_ARROW_ENTITY) minetest.register_craft({ - output = "throwing:arrow_build", + output = 'throwing:arrow_build', recipe = { - {"default:stick", "default:stick", "default:obsidian_glass"}, + {'default:stick', 'default:stick', 'default:shovel_steel'}, } }) minetest.register_craft({ - output = "throwing:arrow_build", + output = 'throwing:arrow_build', recipe = { - {"default:obsidian_glass", "default:stick", "default:stick"}, + {'default:shovel_steel', 'default:stick', 'default:stick'}, } }) diff --git a/mods/throwing/defaults.lua b/mods/throwing/defaults.lua new file mode 100755 index 00000000..ba3876e0 --- /dev/null +++ b/mods/throwing/defaults.lua @@ -0,0 +1,24 @@ +DISABLE_WOODEN_BOW = false +DISABLE_LONGBOW = false +DISABLE_COMPOSITE_BOW = false +DISABLE_STEEL_BOW = false +DISABLE_ROYAL_BOW = false +DISABLE_CROSSBOW = false +DISABLE_ARBALEST = false +DISABLE_AUTOMATED_ARBALEST = false + +DISABLE_TELEPORT_ARROW = true +DISABLE_DIG_ARROW = true +DISABLE_BUILD_ARROW = true +DISABLE_TNT_ARROW = true +DISABLE_FIRE_ARROW = true +DISABLE_TORCH_ARROW = false +DISABLE_SHELL_ARROW = false + +DISABLE_FIREWORKS_BLUE_ARROW = false +DISABLE_FIREWORKS_RED_ARROW = false + +DISABLE_STONE_ARROW = false +DISABLE_STEEL_ARROW = false +DISABLE_DIAMOND_ARROW = false +DISABLE_OBSIDIAN_ARROW = false \ No newline at end of file diff --git a/mods/throwing/depends.txt b/mods/throwing/depends.txt index 252d6655..db178d1e 100755 --- a/mods/throwing/depends.txt +++ b/mods/throwing/depends.txt @@ -1,4 +1,6 @@ default -bucket -fire farming +dye +bucket? +fire? +tnt? diff --git a/mods/throwing/description.txt b/mods/throwing/description.txt new file mode 100755 index 00000000..ee25fb45 --- /dev/null +++ b/mods/throwing/description.txt @@ -0,0 +1 @@ +This mod adds many bows and arrows to Minetest. diff --git a/mods/throwing/dig_arrow.lua b/mods/throwing/dig_arrow.lua index 6ba9c104..4e7cf9be 100755 --- a/mods/throwing/dig_arrow.lua +++ b/mods/throwing/dig_arrow.lua @@ -10,10 +10,10 @@ minetest.register_node("throwing:arrow_dig_box", { fixed = { -- Shaft {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, - -- Spitze + --Spitze {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, - -- Federn + --Federn {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, @@ -26,81 +26,75 @@ minetest.register_node("throwing:arrow_dig_box", { } }, tiles = {"throwing_arrow_dig.png", "throwing_arrow_dig.png", "throwing_arrow_dig_back.png", "throwing_arrow_dig_front.png", "throwing_arrow_dig_2.png", "throwing_arrow_dig.png"}, - groups = {not_in_creative_inventory = 1}, + groups = {not_in_creative_inventory=1}, }) -local THROWING_ARROW_ENTITY = { +local THROWING_ARROW_ENTITY={ physical = false, - timer = 0, + timer=0, visual = "wielditem", - visual_size = {x = 0.125, y = 0.125}, + visual_size = {x=0.1, y=0.1}, textures = {"throwing:arrow_dig_box"}, - lastpos= {}, - collisionbox = {0, 0, 0, 0, 0, 0}, + lastpos={}, + collisionbox = {0,0,0,0,0,0}, } THROWING_ARROW_ENTITY.on_step = function(self, dtime) - self.timer = self.timer + dtime + self.timer=self.timer+dtime local pos = self.object:getpos() local node = minetest.get_node(pos) - if self.timer > 0.2 then - local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1) + if self.timer>0.2 then + local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 1) for k, obj in pairs(objs) do if obj:get_luaentity() ~= nil then if obj:get_luaentity().name ~= "throwing:arrow_dig_entity" and obj:get_luaentity().name ~= "__builtin:item" then - if not minetest.setting_getbool("creative_mode") then - minetest.add_item(pos, "throwing:arrow_dig") - end - local n = minetest.get_node(pos).name - if n ~= "bedrock:bedrock" and n ~= "default:chest_locked" and n ~= "bones:bones" and n ~= "default:chest" and n ~= "default:furnace" then - minetest.dig_node(pos) - end - minetest.sound_play("throwing_dig_arrow", {pos = self.lastpos, gain = 0.8}) + local damage = 1.5 + obj:punch(self.object, 1.0, { + full_punch_interval=1.0, + damage_groups={fleshy=damage}, + }, nil) self.object:remove() + local toughness = 0.9 + if math.random() < toughness then + minetest.add_item(self.lastpos, 'throwing:arrow_dig') + else + minetest.add_item(self.lastpos, 'default:stick') + end end - else - if not minetest.setting_getbool("creative_mode") then - minetest.add_item(pos, "throwing:arrow_dig") - end - local n = minetest.get_node(pos).name - if n ~= "bedrock:bedrock" and n ~= "default:chest_locked" and n ~= "bones:bones" and n ~= "default:chest" and n ~= "default:furnace" then - minetest.dig_node(pos) - end - minetest.sound_play("throwing_dig_arrow", {pos = self.lastpos, gain = 0.8}) - self.object:remove() end end end - if self.lastpos.x ~= nil then - if minetest.registered_nodes[node.name].walkable then - if not minetest.setting_getbool("creative_mode") then - minetest.add_item(self.lastpos, "throwing:arrow_dig") - end - local n = minetest.get_node(pos).name - if n ~= "bedrock:bedrock" and n ~= "default:chest_locked" and n ~= "bones:bones" and n ~= "default:chest" and n ~= "default:furnace" then + if self.lastpos.x~=nil then + if node.name ~= "air" then + self.object:remove() + if node.diggable ~= false then minetest.dig_node(pos) end - minetest.sound_play("throwing_dig_arrow", {pos = self.lastpos, gain = 0.8}) - self.object:remove() + local toughness = 0.65 + if math.random() < toughness then + minetest.add_item(self.lastpos, 'default:pick_steel') + else + minetest.add_item(self.lastpos, 'default:stick') + end end end - self.lastpos= {x = pos.x, y = pos.y, z = pos.z} + self.lastpos={x=pos.x, y=pos.y, z=pos.z} end minetest.register_entity("throwing:arrow_dig_entity", THROWING_ARROW_ENTITY) minetest.register_craft({ - output = "throwing:arrow_dig", + output = 'throwing:arrow_dig', recipe = { - {"default:stick", "default:stick", "default:pick_wood"}, + {'default:stick', 'default:stick', 'default:pick_steel'}, } }) minetest.register_craft({ - output = "throwing:arrow_dig", + output = 'throwing:arrow_dig', recipe = { - {"default:pick_wood", "default:stick", "default:stick"}, + {'default:pick_steel', 'default:stick', 'default:stick'}, } }) diff --git a/mods/throwing/dig_arrow_admin.lua b/mods/throwing/dig_arrow_admin.lua deleted file mode 100755 index f2367a96..00000000 --- a/mods/throwing/dig_arrow_admin.lua +++ /dev/null @@ -1,78 +0,0 @@ -minetest.register_craftitem("throwing:arrow_dig_admin", { - description = "Admin Dig Arrow", - inventory_image = "throwing_arrow_dig_admin.png", - groups = {not_in_creative_inventory = 1}, -}) - -minetest.register_node("throwing:arrow_dig_admin_box", { - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - -- Shaft - {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, - -- Spitze - {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, - {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, - -- Federn - {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, - {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, - {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, - {6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17}, - - {7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17}, - {8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17}, - {8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17}, - {7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17}, - } - }, - tiles = {"throwing_arrow_dig_admin.png", "throwing_arrow_dig_admin.png", "throwing_arrow_dig_admin_back.png", "throwing_arrow_dig_admin_front.png", "throwing_arrow_dig_admin_2.png", "throwing_arrow_dig_admin.png"}, - groups = {not_in_creative_inventory = 1}, -}) - -local THROWING_ARROW_ENTITY = { - physical = false, - timer = 0, - visual = "wielditem", - visual_size = {x = 0.125, y = 0.125}, - textures = {"throwing:arrow_dig_admin_box"}, - lastpos= {}, - collisionbox = {0, 0, 0, 0, 0, 0}, -} - -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 self.timer > 0.2 then - local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1) - for k, obj in pairs(objs) do - if obj:get_luaentity() ~= nil then - if obj:get_luaentity().name ~= "throwing:arrow_dig_admin_entity" and obj:get_luaentity().name ~= "__builtin:item" then - local n = minetest.get_node(pos).name - minetest.log("action", n .. " was removed using throwing:arrow_dig_admin at " .. pos_to_string(vector.round(pos)) .. ".") - minetest.remove_node(pos) - self.object:remove() - end - else - local n = minetest.get_node(pos).name - minetest.log("action", n .. " was removed using throwing:arrow_dig_admin at " .. pos_to_string(vector.round(pos)) .. ".") - minetest.remove_node(pos) - self.object:remove() - end - end - end - - if self.lastpos.x ~= nil then - if minetest.registered_nodes[node.name].walkable then - local n = minetest.get_node(pos).name - minetest.log("action", n .. " was removed using throwing:arrow_dig_admin at " .. pos_to_string(vector.round(pos)) .. ".") - minetest.remove_node(pos) - self.object:remove() - end - end - self.lastpos= {x = pos.x, y = pos.y, z = pos.z} -end - -minetest.register_entity("throwing:arrow_dig_admin_entity", THROWING_ARROW_ENTITY) diff --git a/mods/throwing/fire_arrow.lua b/mods/throwing/fire_arrow.lua index 2a98b373..9457a879 100755 --- a/mods/throwing/fire_arrow.lua +++ b/mods/throwing/fire_arrow.lua @@ -1,5 +1,5 @@ minetest.register_craftitem("throwing:arrow_fire", { - description = "Torch Arrow", + description = "Fire Arrow", inventory_image = "throwing_arrow_fire.png", }) @@ -10,10 +10,10 @@ minetest.register_node("throwing:arrow_fire_box", { fixed = { -- Shaft {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, - -- Spitze + --Spitze {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, - -- Federn + --Federn {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, @@ -26,69 +26,100 @@ minetest.register_node("throwing:arrow_fire_box", { } }, tiles = {"throwing_arrow_fire.png", "throwing_arrow_fire.png", "throwing_arrow_fire_back.png", "throwing_arrow_fire_front.png", "throwing_arrow_fire_2.png", "throwing_arrow_fire.png"}, - groups = {not_in_creative_inventory = 1}, + groups = {not_in_creative_inventory=1}, }) -local THROWING_ARROW_ENTITY = { +local THROWING_ARROW_ENTITY={ physical = false, - timer = 0, + timer=0, visual = "wielditem", - visual_size = {x = 0.125, y = 0.125}, + visual_size = {x=0.1, y=0.1}, textures = {"throwing:arrow_fire_box"}, - lastpos= {}, - collisionbox = {0, 0, 0, 0, 0, 0}, + lastpos={}, + collisionbox = {0,0,0,0,0,0}, } THROWING_ARROW_ENTITY.on_step = function(self, dtime) - self.timer = self.timer + dtime + self.timer=self.timer+dtime local pos = self.object:getpos() local node = minetest.get_node(pos) - if self.timer > 0.2 then - local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1) + 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:arrow_fire_entity" and obj:get_luaentity().name ~= "__builtin:item" then - if self.node ~= "" then - minetest.set_node(self.lastpos, {name="default:torch"}) - minetest.sound_play("default_place_node", {pos = self.lastpos}) - end + local damage = 4 + obj:punch(self.object, 1.0, { + full_punch_interval=1.0, + damage_groups={fleshy=damage}, + }, nil) self.object:remove() + minetest.add_item(self.lastpos, 'default:stick') end - else - if self.node ~= "" then - minetest.set_node(self.lastpos, {name="default:torch"}) - minetest.sound_play("default_place_node", {pos = self.lastpos}) - end - self.object:remove() end end end - if self.lastpos.x ~= nil then - if minetest.registered_nodes[node.name].walkable then - if self.node ~= "" then - minetest.set_node(self.lastpos, {name="default:torch"}) - minetest.sound_play("default_place_node", {pos = self.lastpos}) - end + if self.lastpos.x~=nil then + if node.name ~= "air" and node.name ~= "throwing:light" then + minetest.set_node(self.lastpos, {name="fire:basic_flame"}) self.object:remove() end + if math.floor(self.lastpos.x+0.5) ~= math.floor(pos.x+0.5) or math.floor(self.lastpos.y+0.5) ~= math.floor(pos.y+0.5) or math.floor(self.lastpos.z+0.5) ~= math.floor(pos.z+0.5) then + if minetest.get_node(self.lastpos).name == "throwing:light" then + minetest.remove_node(self.lastpos) + end + if minetest.get_node(pos).name == "air" then + minetest.set_node(pos, {name="throwing:light"}) + end + end end - self.lastpos= {x = pos.x, y = pos.y, z = pos.z} + self.lastpos={x=pos.x, y=pos.y, z=pos.z} end minetest.register_entity("throwing:arrow_fire_entity", THROWING_ARROW_ENTITY) -minetest.register_craft({ - output = "throwing:arrow_fire 1", - recipe = { - {"default:stick", "default:stick", "default:torch"}, +minetest.register_node("throwing:light", { + drawtype = "airlike", + paramtype = "light", + sunlight_propagates = true, + tiles = {"throwing_empty.png"}, + light_source = LIGHT_MAX-4, + selection_box = { + type = "fixed", + fixed = { + {0,0,0,0,0,0} + } }, + groups = {not_in_creative_inventory=1} +}) + +minetest.register_abm({ + nodenames = {"throwing:light"}, + interval = 10, + chance = 1, + action = function(pos, node) + minetest.remove_node(pos) + end }) minetest.register_craft({ - output = "throwing:arrow_fire 1", + output = 'throwing:arrow_fire 4', recipe = { - {"default:torch", "default:stick", "default:stick"}, + {'default:stick', 'default:stick', 'bucket:bucket_lava'}, }, + replacements = { + {"bucket:bucket_lava", "bucket:bucket_empty"} + } +}) + +minetest.register_craft({ + output = 'throwing:arrow_fire 4', + recipe = { + {'bucket:bucket_lava', 'default:stick', 'default:stick'}, + }, + replacements = { + {"bucket:bucket_lava", "bucket:bucket_empty"} + } }) diff --git a/mods/throwing/fireworks_arrows.lua b/mods/throwing/fireworks_arrows.lua new file mode 100755 index 00000000..4dd38fe8 --- /dev/null +++ b/mods/throwing/fireworks_arrows.lua @@ -0,0 +1,195 @@ +local function throwing_register_fireworks(color, desc) + minetest.register_craftitem("throwing:arrow_fireworks_" .. color, { + description = desc .. "fireworks arrow", + inventory_image = "throwing_arrow_fireworks_" .. color .. ".png", + }) + + minetest.register_node("throwing:arrow_fireworks_" .. color .. "_box", { + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + -- Shaft + {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, + --Spitze + {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, + {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, + --Federn + {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, + {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, + {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, + {6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17}, + + {7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17}, + {8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17}, + {8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17}, + {7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17}, + } + }, + tiles = {"throwing_arrow_fireworks_" .. color .. ".png", "throwing_arrow_fireworks_" .. color .. ".png", "throwing_arrow_fireworks_" .. color .. "_back.png", "throwing_arrow_fireworks_" .. color .. "_front.png", "throwing_arrow_fireworks_" .. color .. "_2.png", "throwing_arrow_fireworks_" .. color .. ".png"}, + groups = {not_in_creative_inventory=1}, + }) + + local THROWING_ARROW_ENTITY={ + physical = false, + timer=0, + visual = "wielditem", + visual_size = {x=0.1, y=0.1}, + textures = {"throwing:arrow_fireworks_" .. color .. "_box"}, + lastpos={}, + collisionbox = {0,0,0,0,0,0}, + } + + local radius = 0.5 + + local function add_effects(pos, radius) + minetest.add_particlespawner({ + amount = 256, + time = 0.2, + minpos = vector.subtract(pos, radius / 2), + maxpos = vector.add(pos, radius / 2), + minvel = {x=-5, y=-5, z=-5}, + maxvel = {x=5, y=5, z=5}, + minacc = {x=0, y=-8, z=0}, + --~ maxacc = {x=-20, y=-50, z=-50}, + minexptime = 2.5, + maxexptime = 3, + minsize = 1, + maxsize = 2.5, + texture = "throwing_sparkle_" .. color .. ".png", + }) + end + + + local function boom(pos) + minetest.sound_play("throwing_firework_boom", {pos=pos, gain=1, max_hear_distance=2*64}) + if minetest.get_node(pos).name == 'air' or minetest.get_node(pos).name == 'throwing:firework_trail' then + minetest.add_node(pos, {name="throwing:firework_boom"}) + minetest.get_node_timer(pos):start(0.2) + end + add_effects(pos, radius) + end + + -- Back to the arrow + + 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 self.timer < 0.07 then + minetest.sound_play("throwing_firework_launch", {pos=pos, gain=0.8, max_hear_distance=2*64}) + end + minetest.add_particlespawner({ + amount = 16, + time = 0.1, + minpos = pos, + maxpos = pos, + minvel = {x=-5, y=-5, z=-5}, + maxvel = {x=5, y=5, z=5}, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 0.3, + maxexptime = 0.5, + minsize = 0.5, + maxsize = 1, + texture = "throwing_sparkle.png", + }) + 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:arrow_fireworks_" .. color .. "_entity" and obj:get_luaentity().name ~= "__builtin:item" then + local damage = 2 + obj:punch(self.object, 1.0, { + full_punch_interval=1.0, + damage_groups={fleshy=damage}, + }, nil) + self.object:remove() + boom(pos) + end + end + end + end + if self.timer > 2 then + self.object:remove() + boom(self.lastpos) + end + if self.lastpos.x~=nil then + if node.name ~= "air" and node.name ~= "throwing:firework_trail" then + self.object:remove() + boom(self.lastpos) + end + end + if node.name == 'air' then + minetest.add_node(pos, {name="throwing:firework_trail"}) + minetest.get_node_timer(pos):start(0.1) + end + self.lastpos={x=pos.x, y=pos.y, z=pos.z} + end + + minetest.register_entity("throwing:arrow_fireworks_" .. color .. "_entity", THROWING_ARROW_ENTITY) + + minetest.register_craft({ + output = 'throwing:arrow_fireworks_' .. color .. ' 8', + recipe = { + {'default:stick', 'tnt:gunpowder', 'dye:' .. color}, + } + }) + + minetest.register_craft({ + output = 'throwing:arrow_fireworks_' .. color .. ' 8', + recipe = { + {'dye:' .. color, 'tnt:gunpowder', 'default:stick'}, + } + }) +end + +--~ Arrows + +if not DISABLE_FIREWORKS_BLUE_ARROW then + throwing_register_fireworks('blue', 'Blue') +end + +if not DISABLE_FIREWORKS_RED_ARROW then + throwing_register_fireworks('red', 'Red') +end + +--~ Nodes + +minetest.register_node("throwing:firework_trail", { + drawtype = "airlike", + light_source = 9, + walkable = false, + drop = "", + groups = {dig_immediate=3}, + on_timer = function(pos, elapsed) + minetest.remove_node(pos) + end, +}) + +minetest.register_node("throwing:firework_boom", { + drawtype = "plantlike", + tiles = {"throwing_sparkle.png"}, + light_source = default.LIGHT_MAX, + walkable = false, + drop = "", + groups = {dig_immediate=3}, + on_timer = function(pos, elapsed) + minetest.remove_node(pos) + end, + after_destruct = function(pos, oldnode) + minetest.set_node(pos, {name="throwing:firework_light"}) + minetest.get_node_timer(pos):start(3) + end, +}) + +minetest.register_node("throwing:firework_light", { + drawtype = "airlike", + light_source = default.LIGHT_MAX, + walkable = false, + drop = "", + groups = {dig_immediate=3}, + on_timer = function(pos, elapsed) + minetest.remove_node(pos) + end, +}) diff --git a/mods/throwing/functions.lua b/mods/throwing/functions.lua new file mode 100755 index 00000000..568ad6e6 --- /dev/null +++ b/mods/throwing/functions.lua @@ -0,0 +1,131 @@ +--~ +--~ Shot and reload system +--~ + +local players = {} + +minetest.register_on_joinplayer(function(player) + local playerName = player:get_player_name() + players[playerName] = { + reloading=false, + } +end) + +minetest.register_on_leaveplayer(function(player) + local playerName = player:get_player_name() + players[playerName] = nil +end) + +function throwing_shoot_arrow (itemstack, player, stiffness, is_cross) + local arrow = itemstack:get_metadata() + itemstack:set_metadata("") + player:set_wielded_item(itemstack) + local playerpos = player:getpos() + local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow) + local dir = player:get_look_dir() + obj:setvelocity({x=dir.x*stiffness, y=dir.y*stiffness, z=dir.z*stiffness}) + obj:setacceleration({x=dir.x*-3, y=-10, z=dir.z*-3}) + obj:setyaw(player:get_look_yaw()+math.pi) + if is_cross then + minetest.sound_play("throwing_crossbow_sound", {pos=playerpos}) + else + minetest.sound_play("throwing_bow_sound", {pos=playerpos}) + end + obj:get_luaentity().player = player + obj:get_luaentity().inventory = player:get_inventory() + obj:get_luaentity().stack = player:get_inventory():get_stack("main", player:get_wield_index()-1) + return true +end + +function throwing_unload (itemstack, player, unloaded, wear) + if itemstack:get_metadata() then + for _,arrow in ipairs(throwing_arrows) do + if itemstack:get_metadata() == arrow[2] then + if not minetest.setting_getbool("creative_mode") then + player:get_inventory():add_item("main", arrow[1]) + end + end + end + end + if wear >= 65535 then + player:set_wielded_item({}) + else + player:set_wielded_item({name=unloaded, wear=wear}) + end +end + +function throwing_reload (itemstack, player, pos, is_cross, loaded) + local playerName = player:get_player_name() + players[playerName]['reloading'] = false + if itemstack:get_name() == player:get_wielded_item():get_name() then + if (pos.x == player:getpos().x and pos.y == player:getpos().y and pos.z == player:getpos().z) or not is_cross then + local wear = itemstack:get_wear() + for _,arrow in ipairs(throwing_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 + player:get_inventory():remove_item("main", arrow[1]) + end + local meta = arrow[2] + player:set_wielded_item({name=loaded, wear=wear, metadata=meta}) + end + end + end + end +end + +-- Bows and crossbows + +function throwing_register_bow (name, desc, scale, stiffness, reload_time, toughness, is_cross, craft) + minetest.register_tool("throwing:" .. name, { + description = desc, + inventory_image = "throwing_" .. name .. ".png", + wield_scale = scale, + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + local pos = user:getpos() + local playerName = user:get_player_name() + if not players[playerName]['reloading'] then + players[playerName]['reloading'] = true + minetest.after(reload_time, throwing_reload, itemstack, user, pos, is_cross, "throwing:" .. name .. "_loaded") + end + return itemstack + end, + }) + + minetest.register_tool("throwing:" .. name .. "_loaded", { + description = desc, + inventory_image = "throwing_" .. name .. "_loaded.png", + wield_scale = scale, + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + local wear = itemstack:get_wear() + if not minetest.setting_getbool("creative_mode") then + wear = wear + (65535/toughness) + end + local unloaded = "throwing:" .. name + throwing_shoot_arrow(itemstack, user, stiffness, is_cross) + minetest.after(0, throwing_unload, itemstack, user, unloaded, wear) + return itemstack + end, + on_drop = function(itemstack, dropper, pointed_thing) + local wear = itemstack:get_wear() + local unloaded = "throwing:" .. name + minetest.after(0, throwing_unload, itemstack, dropper, unloaded, wear) + end, + groups = {not_in_creative_inventory=1}, + }) + + minetest.register_craft({ + output = 'throwing:' .. name, + recipe = craft + }) + + minetest.register_craft({ + output = 'throwing:' .. name, + recipe = { + {craft[1][3], craft[1][2], craft[1][1]}, + {craft[2][3], craft[2][2], craft[2][1]}, + {craft[3][3], craft[3][2], craft[3][1]}, + } + }) +end diff --git a/mods/throwing/golden_arrow.lua b/mods/throwing/golden_arrow.lua deleted file mode 100755 index ead0c203..00000000 --- a/mods/throwing/golden_arrow.lua +++ /dev/null @@ -1,98 +0,0 @@ -minetest.register_craftitem("throwing:arrow_gold", { - description = "Golden Arrow", - inventory_image = "throwing_arrow_gold.png", -}) - -minetest.register_node("throwing:arrow_gold_box", { - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - -- Shaft - {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, - -- Spitze - {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, - {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, - -- Federn - {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, - {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, - {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, - {6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17}, - - {7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17}, - {8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17}, - {8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17}, - {7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17}, - } - }, - tiles = {"throwing_arrow_gold.png", "throwing_arrow_gold.png", "throwing_arrow_gold_back.png", "throwing_arrow_gold_front.png", "throwing_arrow_gold_2.png", "throwing_arrow_gold.png"}, - groups = {not_in_creative_inventory = 1}, -}) - -local THROWING_arrow_gold_ENTITY = { - physical = false, - timer = 0, - visual = "wielditem", - visual_size = {x = 0.125, y = 0.125}, - textures = {"throwing:arrow_gold_box"}, - lastpos= {}, - collisionbox = {0, 0, 0, 0, 0, 0}, -} - -THROWING_arrow_gold_ENTITY.on_step = function(self, dtime) - self.timer = self.timer + dtime - local pos = self.object:getpos() - local node = minetest.get_node(pos) - - if self.timer > 0.2 then - local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 1) - for k, obj in pairs(objs) do - if obj:get_luaentity() ~= nil then - if obj:get_luaentity().name ~= "throwing:arrow_gold_entity" and obj:get_luaentity().name ~= "__builtin:item" then - local damage = 5 - obj:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups= {fleshy = damage}, - }, nil) - minetest.sound_play("throwing_arrow", {pos = self.lastpos, gain = 0.8}) - self.object:remove() - end - else - local damage = 5 - obj:punch(self.object, 1.0, { - full_punch_interval = 1.0, - damage_groups= {fleshy = damage}, - }, nil) - minetest.sound_play("throwing_arrow", {pos = self.lastpos, gain = 0.8}) - self.object:remove() - end - end - end - - if self.lastpos.x ~= nil then - if minetest.registered_nodes[node.name].walkable then - if not minetest.setting_getbool("creative_mode") then - minetest.add_item(self.lastpos, "throwing:arrow_gold") - end - minetest.sound_play("throwing_arrow", {pos = self.lastpos, gain = 0.8}) - self.object:remove() - end - end - self.lastpos= {x = pos.x, y = pos.y, z = pos.z} -end - -minetest.register_entity("throwing:arrow_gold_entity", THROWING_arrow_gold_ENTITY) - -minetest.register_craft({ - output = "throwing:arrow_gold 16", - recipe = { - {"default:stick", "default:stick", "default:gold_ingot"}, - } -}) - -minetest.register_craft({ - output = "throwing:arrow_gold 16", - recipe = { - {"default:gold_ingot", "default:stick", "default:stick"}, - } -}) diff --git a/mods/throwing/init.lua b/mods/throwing/init.lua index 6dd0d7bb..be1d42a7 100755 --- a/mods/throwing/init.lua +++ b/mods/throwing/init.lua @@ -1,188 +1,66 @@ -arrows = { - {"throwing:arrow", "throwing:arrow_entity"}, - {"throwing:arrow_gold", "throwing:arrow_gold_entity"}, +throwing_arrows = { + {"throwing:arrow_steel", "throwing:arrow_steel_entity"}, + {"throwing:arrow_stone", "throwing:arrow_stone_entity"}, + {"throwing:arrow_obsidian", "throwing:arrow_obsidian_entity"}, {"throwing:arrow_fire", "throwing:arrow_fire_entity"}, {"throwing:arrow_teleport", "throwing:arrow_teleport_entity"}, {"throwing:arrow_dig", "throwing:arrow_dig_entity"}, - {"throwing:arrow_dig_admin", "throwing:arrow_dig_admin_entity"}, - {"throwing:arrow_build", "throwing:arrow_build_entity"} + {"throwing:arrow_build", "throwing:arrow_build_entity"}, + {"throwing:arrow_tnt", "throwing:arrow_tnt_entity"}, + {"throwing:arrow_torch", "throwing:arrow_torch_entity"}, + {"throwing:arrow_diamond", "throwing:arrow_diamond_entity"}, + {"throwing:arrow_shell", "throwing:arrow_shell_entity"}, + {"throwing:arrow_fireworks_blue", "throwing:arrow_fireworks_blue_entity"}, + {"throwing:arrow_fireworks_red", "throwing:arrow_fireworks_red_entity"}, } -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 - if not minetest.setting_getbool("creative_mode") then - player:get_inventory():remove_item("main", arrow[1]) - end - local playerpos = player:getpos() - local obj = minetest.add_entity({x=playerpos.x,y=playerpos.y+1.5,z=playerpos.z}, arrow[2]) - local dir = player:get_look_dir() - obj:setvelocity({x=dir.x*19, y=dir.y*19, z=dir.z*19}) - obj:setacceleration({x=dir.x*-3, y=-10, z=dir.z*-3}) - obj:setyaw(player:get_look_yaw()+math.pi) - minetest.sound_play("throwing_sound", {pos=playerpos, gain = 0.5}) - if obj:get_luaentity().player == "" then - obj:get_luaentity().player = player - end - obj:get_luaentity().node = player:get_inventory():get_stack("main", 1):get_name() - return true - end - end - return false +dofile(minetest.get_modpath("throwing").."/defaults.lua") + +local input = io.open(minetest.get_modpath("throwing").."/throwing.conf", "r") +if input then + dofile(minetest.get_modpath("throwing").."/throwing.conf") + input:close() + input = nil end +dofile(minetest.get_modpath("throwing").."/functions.lua") -minetest.register_tool("throwing:bow_wood", { - description = "Wooden Bow", - inventory_image = "throwing_bow_wood.png", - on_use = function(itemstack, user, pointed_thing) - if throwing_shoot_arrow(itemstack, user, pointed_thing) then - if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/25) - end - end - return itemstack - end, -}) +dofile(minetest.get_modpath("throwing").."/tools.lua") -minetest.register_craft({ - output = "throwing:bow_wood", - recipe = { - {"farming:cotton", "default:wood", ""}, - {"farming:cotton", "", "default:wood"}, - {"farming:cotton", "default:wood", ""}, - } -}) +dofile(minetest.get_modpath("throwing").."/standard_arrows.lua") - - -minetest.register_tool("throwing:bow_stone", { - description = "Stone Bow", - inventory_image = "throwing_bow_stone.png", - on_use = function(itemstack, user, pointed_thing) - if throwing_shoot_arrow(item, user, pointed_thing) then - if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/75) - end - end - return itemstack - end, -}) - -minetest.register_craft({ - output = "throwing:bow_stone", - recipe = { - {"farming:cotton", "default:cobble", ""}, - {"farming:cotton", "", "default:cobble"}, - {"farming:cotton", "default:cobble", ""}, - } -}) - - - -minetest.register_tool("throwing:bow_steel", { - description = "Steel Bow", - inventory_image = "throwing_bow_steel.png", - on_use = function(itemstack, user, pointed_thing) - if throwing_shoot_arrow(item, user, pointed_thing) then - if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/200) - end - end - return itemstack - end, -}) - -minetest.register_craft({ - output = "throwing:bow_steel", - recipe = { - {"farming:cotton", "default:steel_ingot", ""}, - {"farming:cotton", "", "default:steel_ingot"}, - {"farming:cotton", "default:steel_ingot", ""}, - } -}) - - - -minetest.register_tool("throwing:bow_bronze", { - description = "Bronze Bow", - inventory_image = "throwing_bow_bronze.png", - stack_max = 1, - on_use = function(itemstack, user, pointed_thing) - if throwing_shoot_arrow(item, user, pointed_thing) then - if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/250) - end - end - return itemstack - end, -}) - -minetest.register_craft({ - output = "throwing:bow_bronze", - recipe = { - {"farming:cotton", "default:bronze_ingot", ""}, - {"farming:cotton", "", "default:bronze_ingot"}, - {"farming:cotton", "default:bronze_ingot", ""}, - } -}) - - - -minetest.register_tool("throwing:bow_mese", { - description = "Mese Bow", - inventory_image = "throwing_bow_mese.png", - on_use = function(itemstack, user, pointed_thing) - if throwing_shoot_arrow(item, user, pointed_thing) then - if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/350) - end - end - return itemstack - end, -}) - -minetest.register_craft({ - output = "throwing:bow_mese", - recipe = { - {"farming:cotton", "default:mese_crystal", ""}, - {"farming:cotton", "", "default:mese_crystal"}, - {"farming:cotton", "default:mese_crystal", ""}, - } -}) - - - -minetest.register_tool("throwing:bow_diamond", { - description = "Diamond Bow", - inventory_image = "throwing_bow_diamond.png", - on_use = function(itemstack, user, pointed_thing) - if throwing_shoot_arrow(item, user, pointed_thing) then - if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/500) - end - end - return itemstack - end, -}) - -minetest.register_craft({ - output = "throwing:bow_diamond", - recipe = { - {"farming:cotton", "default:diamond", ""}, - {"farming:cotton", "", "default:diamond"}, - {"farming:cotton", "default:diamond", ""}, - } -}) - -dofile(minetest.get_modpath("throwing") .. "/arrow.lua") -dofile(minetest.get_modpath("throwing") .. "/golden_arrow.lua") -dofile(minetest.get_modpath("throwing") .. "/fire_arrow.lua") -dofile(minetest.get_modpath("throwing") .. "/teleport_arrow.lua") -dofile(minetest.get_modpath("throwing") .. "/dig_arrow.lua") -dofile(minetest.get_modpath("throwing") .. "/dig_arrow_admin.lua") -dofile(minetest.get_modpath("throwing") .. "/build_arrow.lua") - -if minetest.setting_getbool("log_mods") then - minetest.log("action", "Carbone: [throwing] loaded.") +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 + +if not DISABLE_TELEPORT_ARROW then + dofile(minetest.get_modpath("throwing").."/teleport_arrow.lua") +end + +if not DISABLE_DIG_ARROW then + dofile(minetest.get_modpath("throwing").."/dig_arrow.lua") +end + +if not DISABLE_BUILD_ARROW then + dofile(minetest.get_modpath("throwing").."/build_arrow.lua") +end + +if minetest.get_modpath('fire') and minetest.get_modpath('tnt') and not DISABLE_TNT_ARROW then + dofile(minetest.get_modpath("throwing").."/tnt_arrow.lua") +end + +if not DISABLE_TORCH_ARROW then + dofile(minetest.get_modpath("throwing").."/torch_arrow.lua") +end + +if minetest.get_modpath('tnt') and not DISABLE_SHELL_ARROW then + dofile(minetest.get_modpath("throwing").."/shell_arrow.lua") +end + +if minetest.get_modpath('tnt') then + dofile(minetest.get_modpath("throwing").."/fireworks_arrows.lua") +end + +if minetest.setting_get("log_mods") then + minetest.log("action", "throwing loaded") end diff --git a/mods/throwing/screenshot.png b/mods/throwing/screenshot.png new file mode 100755 index 00000000..32a89d13 Binary files /dev/null and b/mods/throwing/screenshot.png differ diff --git a/mods/throwing/shell_arrow.lua b/mods/throwing/shell_arrow.lua new file mode 100755 index 00000000..76750e9f --- /dev/null +++ b/mods/throwing/shell_arrow.lua @@ -0,0 +1,118 @@ +minetest.register_craftitem("throwing:arrow_shell", { + description = "Shell arrow", + inventory_image = "throwing_arrow_shell.png", +}) + +minetest.register_node("throwing:arrow_shell_box", { + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + -- Shaft + {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, + --Spitze + {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, + {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, + --Federn + {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, + {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, + {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, + {6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17}, + + {7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17}, + {8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17}, + {8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17}, + {7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17}, + } + }, + tiles = {"throwing_arrow_shell.png", "throwing_arrow_shell.png", "throwing_arrow_shell_back.png", "throwing_arrow_shell_front.png", "throwing_arrow_shell_2.png", "throwing_arrow_shell.png"}, + groups = {not_in_creative_inventory=1}, +}) + +local THROWING_ARROW_ENTITY={ + physical = false, + timer=0, + visual = "wielditem", + visual_size = {x=0.1, y=0.1}, + textures = {"throwing:arrow_shell_box"}, + lastpos={}, + collisionbox = {0,0,0,0,0,0}, +} + +local radius = 1 + +local function add_effects(pos, radius) + minetest.add_particlespawner({ + amount = 8, + time = 0.5, + minpos = vector.subtract(pos, radius / 2), + maxpos = vector.add(pos, radius / 2), + minvel = {x=-10, y=-10, z=-10}, + maxvel = {x=10, y=10, z=10}, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 0.5, + maxexptime = 1, + minsize = 0.5, + maxsize = 1, + texture = "tnt_smoke.png", + }) +end + + +local function boom(pos) + minetest.sound_play("shell_explode", {pos=pos, gain=1.5, max_hear_distance=2*64}) + minetest.set_node(pos, {name="tnt:boom"}) + minetest.get_node_timer(pos):start(0.1) + add_effects(pos, radius) +end + +-- Back to the arrow + +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 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:arrow_shell_entity" and obj:get_luaentity().name ~= "__builtin:item" then + 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}, + }, nil) + self.object:remove() + boom(pos) + 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 + self.object:remove() + boom(self.lastpos) + end + end + self.lastpos={x=pos.x, y=pos.y, z=pos.z} +end + +minetest.register_entity("throwing:arrow_shell_entity", THROWING_ARROW_ENTITY) + +minetest.register_craft({ + output = 'throwing:arrow_shell 8', + recipe = { + {'default:stick', 'tnt:gunpowder', 'default:bronze_ingot'}, + } +}) + +minetest.register_craft({ + output = 'throwing:arrow_shell 8', + recipe = { + {'default:bronze_ingot', 'tnt:gunpowder', 'default:stick'}, + } +}) diff --git a/mods/throwing/sounds/throwing_arrow.ogg b/mods/throwing/sounds/throwing_arrow.ogg deleted file mode 100755 index dcc9652a..00000000 Binary files a/mods/throwing/sounds/throwing_arrow.ogg and /dev/null differ diff --git a/mods/throwing/sounds/throwing_bow_sound.ogg b/mods/throwing/sounds/throwing_bow_sound.ogg new file mode 100755 index 00000000..411598c4 Binary files /dev/null and b/mods/throwing/sounds/throwing_bow_sound.ogg differ diff --git a/mods/throwing/sounds/throwing_build_arrow.ogg b/mods/throwing/sounds/throwing_build_arrow.ogg deleted file mode 100755 index 0d1126d3..00000000 Binary files a/mods/throwing/sounds/throwing_build_arrow.ogg and /dev/null differ diff --git a/mods/throwing/sounds/throwing_crossbow_sound.ogg b/mods/throwing/sounds/throwing_crossbow_sound.ogg new file mode 100755 index 00000000..e30b1e02 Binary files /dev/null and b/mods/throwing/sounds/throwing_crossbow_sound.ogg differ diff --git a/mods/throwing/sounds/throwing_dig_arrow.ogg b/mods/throwing/sounds/throwing_dig_arrow.ogg deleted file mode 100755 index b6edbf77..00000000 Binary files a/mods/throwing/sounds/throwing_dig_arrow.ogg and /dev/null differ diff --git a/mods/throwing/sounds/throwing_firework_boom.ogg b/mods/throwing/sounds/throwing_firework_boom.ogg new file mode 100755 index 00000000..c25b96ab Binary files /dev/null and b/mods/throwing/sounds/throwing_firework_boom.ogg differ diff --git a/mods/throwing/sounds/throwing_firework_launch.ogg b/mods/throwing/sounds/throwing_firework_launch.ogg new file mode 100755 index 00000000..e6165a45 Binary files /dev/null and b/mods/throwing/sounds/throwing_firework_launch.ogg differ diff --git a/mods/throwing/sounds/throwing_shell_explode.ogg b/mods/throwing/sounds/throwing_shell_explode.ogg new file mode 100755 index 00000000..ec827f8e Binary files /dev/null and b/mods/throwing/sounds/throwing_shell_explode.ogg differ diff --git a/mods/throwing/sounds/throwing_sound.ogg b/mods/throwing/sounds/throwing_sound.ogg deleted file mode 100755 index 2d3aca33..00000000 Binary files a/mods/throwing/sounds/throwing_sound.ogg and /dev/null differ diff --git a/mods/throwing/sounds/throwing_teleport_arrow.ogg b/mods/throwing/sounds/throwing_teleport_arrow.ogg deleted file mode 100755 index 5628b87b..00000000 Binary files a/mods/throwing/sounds/throwing_teleport_arrow.ogg and /dev/null differ diff --git a/mods/throwing/standard_arrows.lua b/mods/throwing/standard_arrows.lua new file mode 100755 index 00000000..900b4b8d --- /dev/null +++ b/mods/throwing/standard_arrows.lua @@ -0,0 +1,114 @@ +function throwing_register_arrow_standard (kind, desc, eq, toughness, craft) + minetest.register_craftitem("throwing:arrow_" .. kind, { + description = desc .. " arrow", + inventory_image = "throwing_arrow_" .. kind .. ".png", + }) + + minetest.register_node("throwing:arrow_" .. kind .. "_box", { + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + -- Shaft + {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, + --Spitze + {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, + {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, + --Federn + {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, + {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, + {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, + {6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17}, + + {7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17}, + {8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17}, + {8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17}, + {7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17}, + } + }, + tiles = {"throwing_arrow_" .. kind .. ".png", "throwing_arrow_" .. kind .. ".png", "throwing_arrow_" .. kind .. "_back.png", "throwing_arrow_" .. kind .. "_front.png", "throwing_arrow_" .. kind .. "_2.png", "throwing_arrow_" .. kind .. ".png"}, + groups = {not_in_creative_inventory=1}, + }) + + local THROWING_ARROW_ENTITY={ + physical = false, + timer=0, + visual = "wielditem", + visual_size = {x=0.1, y=0.1}, + textures = {"throwing:arrow_" .. kind .. "_box"}, + lastpos={}, + collisionbox = {0,0,0,0,0,0}, + } + + 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 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:arrow_" .. kind .. "_entity" and obj:get_luaentity().name ~= "__builtin:item" then + local speed = vector.length(self.object:getvelocity()) + local damage = ((speed + eq)^1.2)/10 + obj:punch(self.object, 1.0, { + full_punch_interval=1.0, + 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 + 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 + 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 + end + end + self.lastpos={x=pos.x, y=pos.y, z=pos.z} + end + + minetest.register_entity("throwing:arrow_" .. kind .. "_entity", THROWING_ARROW_ENTITY) + + minetest.register_craft({ + output = 'throwing:arrow_' .. kind .. ' 16', + recipe = { + {'default:stick', 'default:stick', craft}, + } + }) + + minetest.register_craft({ + output = 'throwing:arrow_' .. kind .. ' 16', + recipe = { + {craft, 'default:stick', 'default:stick'}, + } + }) +end + +if not DISABLE_STONE_ARROW then + throwing_register_arrow_standard ('stone', 'Stone', 0, 0.88, 'group:stone') +end + +if not DISABLE_STEEL_ARROW then + throwing_register_arrow_standard ('steel', 'Steel', 5, 0.94, 'default:steel_ingot') +end + +if not DISABLE_DIAMOND_ARROW then + throwing_register_arrow_standard ('diamond', 'Diamond', 10, 0.97, 'default:diamond') +end + +if not DISABLE_OBSIDIAN_ARROW then + throwing_register_arrow_standard ('obsidian', 'Obsidian', 15, 0.88, 'default:obsidian') +end diff --git a/mods/throwing/teleport_arrow.lua b/mods/throwing/teleport_arrow.lua index 0564a20b..0eadc6e3 100755 --- a/mods/throwing/teleport_arrow.lua +++ b/mods/throwing/teleport_arrow.lua @@ -10,10 +10,10 @@ minetest.register_node("throwing:arrow_teleport_box", { fixed = { -- Shaft {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, - -- Spitze + --Spitze {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, - -- Federn + --Federn {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, @@ -26,79 +26,64 @@ minetest.register_node("throwing:arrow_teleport_box", { } }, tiles = {"throwing_arrow_teleport.png", "throwing_arrow_teleport.png", "throwing_arrow_teleport_back.png", "throwing_arrow_teleport_front.png", "throwing_arrow_teleport_2.png", "throwing_arrow_teleport.png"}, - groups = {not_in_creative_inventory = 1}, + groups = {not_in_creative_inventory=1}, }) -local THROWING_ARROW_ENTITY = { +local THROWING_ARROW_ENTITY={ physical = false, - timer = 0, + timer=0, visual = "wielditem", - visual_size = {x = 0.125, y = 0.125}, + visual_size = {x=0.1, y=0.1}, textures = {"throwing:arrow_teleport_box"}, - lastpos= {}, - collisionbox = {0, 0, 0, 0, 0, 0}, + lastpos={}, + collisionbox = {0,0,0,0,0,0}, player = "", } THROWING_ARROW_ENTITY.on_step = function(self, dtime) - self.timer = self.timer + dtime + self.timer=self.timer+dtime local pos = self.object:getpos() local node = minetest.get_node(pos) - if self.timer > 0.2 then - local objs = minetest.get_objects_inside_radius({x = pos.x, y = pos.y, z = pos.z}, 2) + 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:arrow_teleport_entity" and obj:get_luaentity().name ~= "__builtin:item" then - if self.player ~= "" then - if not minetest.is_protected(pos, self.player:get_player_name()) then - self.player:setpos(pos) - end - self.player:get_inventory():add_item("main", ItemStack("throwing:arrow_teleport")) - minetest.sound_play("throwing_teleport_arrow", {pos = self.lastpos}) - end self.object:remove() - end - else - if self.player ~= "" then - if not minetest.is_protected(pos, self.player:get_player_name()) then + if self.player ~= "" then self.player:setpos(pos) + self.player:get_inventory():add_item("main", ItemStack("default:stick 2")) end - self.player:get_inventory():add_item("main", ItemStack("throwing:arrow_teleport")) - minetest.sound_play("throwing_teleport_arrow", {pos = self.lastpos}) end - self.object:remove() end end end - if self.lastpos.x ~= nil then - if minetest.registered_nodes[node.name].walkable then - if self.player ~= "" then - if not minetest.is_protected(self.lastpos, self.player:get_player_name()) then - self.player:setpos(self.lastpos) - end - self.player:get_inventory():add_item("main", ItemStack("throwing:arrow_teleport")) - minetest.sound_play("throwing_teleport_arrow", {pos = self.lastpos}) - end + if self.lastpos.x~=nil then + if node.name ~= "air" then self.object:remove() + if self.player ~= "" then + self.player:setpos(self.lastpos) + self.player:get_inventory():add_item("main", ItemStack("default:stick 2")) + end end end - self.lastpos= {x = pos.x, y = pos.y, z = pos.z} + self.lastpos={x=pos.x, y=pos.y, z=pos.z} end minetest.register_entity("throwing:arrow_teleport_entity", THROWING_ARROW_ENTITY) minetest.register_craft({ - output = "throwing:arrow_teleport", + output = 'throwing:arrow_teleport', recipe = { - {"default:stick", "default:stick", "default:diamond"}, + {'default:stick', 'default:stick', 'default:mese_crystal_fragment'} } }) minetest.register_craft({ - output = "throwing:arrow_teleport", + output = 'throwing:arrow_teleport', recipe = { - {"default:diamond", "default:stick", "default:stick"}, + {'default:mese_crystal_fragment', 'default:stick', 'default:stick'} } }) diff --git a/mods/throwing/textures/throwing_arbalest.png b/mods/throwing/textures/throwing_arbalest.png new file mode 100755 index 00000000..7036a589 Binary files /dev/null and b/mods/throwing/textures/throwing_arbalest.png differ diff --git a/mods/throwing/textures/throwing_arbalest_loaded.png b/mods/throwing/textures/throwing_arbalest_loaded.png new file mode 100755 index 00000000..0749f5aa Binary files /dev/null and b/mods/throwing/textures/throwing_arbalest_loaded.png differ diff --git a/mods/throwing/textures/throwing_arrow.png b/mods/throwing/textures/throwing_arrow.png deleted file mode 100755 index 95b876c3..00000000 Binary files a/mods/throwing/textures/throwing_arrow.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_arrow_2.png b/mods/throwing/textures/throwing_arrow_2.png deleted file mode 100755 index 83d1a02b..00000000 Binary files a/mods/throwing/textures/throwing_arrow_2.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_arrow_back.png b/mods/throwing/textures/throwing_arrow_back.png deleted file mode 100755 index a1630a87..00000000 Binary files a/mods/throwing/textures/throwing_arrow_back.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_arrow_build.png b/mods/throwing/textures/throwing_arrow_build.png index 0683f1ed..09d01ec3 100755 Binary files a/mods/throwing/textures/throwing_arrow_build.png and b/mods/throwing/textures/throwing_arrow_build.png differ diff --git a/mods/throwing/textures/throwing_arrow_build_2.png b/mods/throwing/textures/throwing_arrow_build_2.png index 215b2c4d..4fdbd921 100755 Binary files a/mods/throwing/textures/throwing_arrow_build_2.png and b/mods/throwing/textures/throwing_arrow_build_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_build_back.png b/mods/throwing/textures/throwing_arrow_build_back.png index 654b2a9a..621f258d 100755 Binary files a/mods/throwing/textures/throwing_arrow_build_back.png and b/mods/throwing/textures/throwing_arrow_build_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_build_front.png b/mods/throwing/textures/throwing_arrow_build_front.png index ac7c6a3b..4a651a5a 100755 Binary files a/mods/throwing/textures/throwing_arrow_build_front.png and b/mods/throwing/textures/throwing_arrow_build_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_diamond.png b/mods/throwing/textures/throwing_arrow_diamond.png new file mode 100755 index 00000000..ae34eb07 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_diamond.png differ diff --git a/mods/throwing/textures/throwing_arrow_diamond_2.png b/mods/throwing/textures/throwing_arrow_diamond_2.png new file mode 100755 index 00000000..9bc1219d Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_diamond_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_diamond_back.png b/mods/throwing/textures/throwing_arrow_diamond_back.png new file mode 100755 index 00000000..0c92fba4 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_diamond_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_diamond_front.png b/mods/throwing/textures/throwing_arrow_diamond_front.png new file mode 100755 index 00000000..791c88d3 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_diamond_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_dig.png b/mods/throwing/textures/throwing_arrow_dig.png index 3499404e..f54a7aea 100755 Binary files a/mods/throwing/textures/throwing_arrow_dig.png and b/mods/throwing/textures/throwing_arrow_dig.png differ diff --git a/mods/throwing/textures/throwing_arrow_dig_2.png b/mods/throwing/textures/throwing_arrow_dig_2.png index 4028eba1..33703870 100755 Binary files a/mods/throwing/textures/throwing_arrow_dig_2.png and b/mods/throwing/textures/throwing_arrow_dig_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_dig_admin.png b/mods/throwing/textures/throwing_arrow_dig_admin.png deleted file mode 100755 index 582c0349..00000000 Binary files a/mods/throwing/textures/throwing_arrow_dig_admin.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_arrow_dig_admin_2.png b/mods/throwing/textures/throwing_arrow_dig_admin_2.png deleted file mode 100755 index 89d3dc6c..00000000 Binary files a/mods/throwing/textures/throwing_arrow_dig_admin_2.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_arrow_dig_admin_back.png b/mods/throwing/textures/throwing_arrow_dig_admin_back.png deleted file mode 100755 index 55ab50f2..00000000 Binary files a/mods/throwing/textures/throwing_arrow_dig_admin_back.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_arrow_dig_admin_front.png b/mods/throwing/textures/throwing_arrow_dig_admin_front.png deleted file mode 100755 index e182cb7a..00000000 Binary files a/mods/throwing/textures/throwing_arrow_dig_admin_front.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_arrow_dig_back.png b/mods/throwing/textures/throwing_arrow_dig_back.png index 8246d1d9..3bc4a607 100755 Binary files a/mods/throwing/textures/throwing_arrow_dig_back.png and b/mods/throwing/textures/throwing_arrow_dig_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_dig_front.png b/mods/throwing/textures/throwing_arrow_dig_front.png index a8fbc774..7a294996 100755 Binary files a/mods/throwing/textures/throwing_arrow_dig_front.png and b/mods/throwing/textures/throwing_arrow_dig_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_fire.png b/mods/throwing/textures/throwing_arrow_fire.png index 0dfb8b9f..8f5075a3 100755 Binary files a/mods/throwing/textures/throwing_arrow_fire.png and b/mods/throwing/textures/throwing_arrow_fire.png differ diff --git a/mods/throwing/textures/throwing_arrow_fire_2.png b/mods/throwing/textures/throwing_arrow_fire_2.png index 010c3ec4..ed0aa5fb 100755 Binary files a/mods/throwing/textures/throwing_arrow_fire_2.png and b/mods/throwing/textures/throwing_arrow_fire_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_fire_back.png b/mods/throwing/textures/throwing_arrow_fire_back.png index b840508f..8a7d9930 100755 Binary files a/mods/throwing/textures/throwing_arrow_fire_back.png and b/mods/throwing/textures/throwing_arrow_fire_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_fire_front.png b/mods/throwing/textures/throwing_arrow_fire_front.png index b56bd830..3994257d 100755 Binary files a/mods/throwing/textures/throwing_arrow_fire_front.png and b/mods/throwing/textures/throwing_arrow_fire_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_fireworks_blue.png b/mods/throwing/textures/throwing_arrow_fireworks_blue.png new file mode 100755 index 00000000..36c30bcd Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_fireworks_blue.png differ diff --git a/mods/throwing/textures/throwing_arrow_fireworks_blue_2.png b/mods/throwing/textures/throwing_arrow_fireworks_blue_2.png new file mode 100755 index 00000000..672805c6 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_fireworks_blue_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_fireworks_blue_back.png b/mods/throwing/textures/throwing_arrow_fireworks_blue_back.png new file mode 100755 index 00000000..85956a63 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_fireworks_blue_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_fireworks_blue_front.png b/mods/throwing/textures/throwing_arrow_fireworks_blue_front.png new file mode 100755 index 00000000..fca7c928 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_fireworks_blue_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_fireworks_red.png b/mods/throwing/textures/throwing_arrow_fireworks_red.png new file mode 100755 index 00000000..fe0fd89d Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_fireworks_red.png differ diff --git a/mods/throwing/textures/throwing_arrow_fireworks_red_2.png b/mods/throwing/textures/throwing_arrow_fireworks_red_2.png new file mode 100755 index 00000000..566c5cb3 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_fireworks_red_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_fireworks_red_back.png b/mods/throwing/textures/throwing_arrow_fireworks_red_back.png new file mode 100755 index 00000000..8e90fc5b Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_fireworks_red_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_fireworks_red_front.png b/mods/throwing/textures/throwing_arrow_fireworks_red_front.png new file mode 100755 index 00000000..d84e5a1e Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_fireworks_red_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_front.png b/mods/throwing/textures/throwing_arrow_front.png deleted file mode 100755 index 2fcc3db0..00000000 Binary files a/mods/throwing/textures/throwing_arrow_front.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_arrow_gold.png b/mods/throwing/textures/throwing_arrow_gold.png deleted file mode 100755 index 4fe80d49..00000000 Binary files a/mods/throwing/textures/throwing_arrow_gold.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_arrow_gold_2.png b/mods/throwing/textures/throwing_arrow_gold_2.png deleted file mode 100755 index 8a2932cf..00000000 Binary files a/mods/throwing/textures/throwing_arrow_gold_2.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_arrow_gold_back.png b/mods/throwing/textures/throwing_arrow_gold_back.png deleted file mode 100755 index 7831e3aa..00000000 Binary files a/mods/throwing/textures/throwing_arrow_gold_back.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_arrow_gold_front.png b/mods/throwing/textures/throwing_arrow_gold_front.png deleted file mode 100755 index 21c50e78..00000000 Binary files a/mods/throwing/textures/throwing_arrow_gold_front.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_arrow_obsidian.png b/mods/throwing/textures/throwing_arrow_obsidian.png new file mode 100755 index 00000000..86e5ef24 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_obsidian.png differ diff --git a/mods/throwing/textures/throwing_arrow_obsidian_2.png b/mods/throwing/textures/throwing_arrow_obsidian_2.png new file mode 100755 index 00000000..fefcd91b Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_obsidian_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_obsidian_back.png b/mods/throwing/textures/throwing_arrow_obsidian_back.png new file mode 100755 index 00000000..bd1232fe Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_obsidian_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_obsidian_front.png b/mods/throwing/textures/throwing_arrow_obsidian_front.png new file mode 100755 index 00000000..f74c13e4 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_obsidian_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_shell.png b/mods/throwing/textures/throwing_arrow_shell.png new file mode 100755 index 00000000..a1204d0b Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_shell.png differ diff --git a/mods/throwing/textures/throwing_arrow_shell_2.png b/mods/throwing/textures/throwing_arrow_shell_2.png new file mode 100755 index 00000000..ad7bc435 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_shell_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_shell_back.png b/mods/throwing/textures/throwing_arrow_shell_back.png new file mode 100755 index 00000000..4b64eaf4 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_shell_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_shell_front.png b/mods/throwing/textures/throwing_arrow_shell_front.png new file mode 100755 index 00000000..06b94543 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_shell_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_steel.png b/mods/throwing/textures/throwing_arrow_steel.png new file mode 100755 index 00000000..3d706101 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_steel.png differ diff --git a/mods/throwing/textures/throwing_arrow_steel_2.png b/mods/throwing/textures/throwing_arrow_steel_2.png new file mode 100755 index 00000000..b989983a Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_steel_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_steel_back.png b/mods/throwing/textures/throwing_arrow_steel_back.png new file mode 100755 index 00000000..c7edf565 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_steel_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_steel_front.png b/mods/throwing/textures/throwing_arrow_steel_front.png new file mode 100755 index 00000000..38ccec45 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_steel_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_stone.png b/mods/throwing/textures/throwing_arrow_stone.png new file mode 100755 index 00000000..c7a14e9c Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_stone.png differ diff --git a/mods/throwing/textures/throwing_arrow_stone_2.png b/mods/throwing/textures/throwing_arrow_stone_2.png new file mode 100755 index 00000000..23617ef0 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_stone_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_stone_back.png b/mods/throwing/textures/throwing_arrow_stone_back.png new file mode 100755 index 00000000..293334e9 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_stone_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_stone_front.png b/mods/throwing/textures/throwing_arrow_stone_front.png new file mode 100755 index 00000000..c93a35c4 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_stone_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_teleport.png b/mods/throwing/textures/throwing_arrow_teleport.png index e0b6f080..235745a5 100755 Binary files a/mods/throwing/textures/throwing_arrow_teleport.png and b/mods/throwing/textures/throwing_arrow_teleport.png differ diff --git a/mods/throwing/textures/throwing_arrow_teleport_2.png b/mods/throwing/textures/throwing_arrow_teleport_2.png index 1a3c6fe9..db786ca0 100755 Binary files a/mods/throwing/textures/throwing_arrow_teleport_2.png and b/mods/throwing/textures/throwing_arrow_teleport_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_teleport_back.png b/mods/throwing/textures/throwing_arrow_teleport_back.png index ecd3e708..325c2037 100755 Binary files a/mods/throwing/textures/throwing_arrow_teleport_back.png and b/mods/throwing/textures/throwing_arrow_teleport_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_teleport_front.png b/mods/throwing/textures/throwing_arrow_teleport_front.png index 1233c148..c2e693f5 100755 Binary files a/mods/throwing/textures/throwing_arrow_teleport_front.png and b/mods/throwing/textures/throwing_arrow_teleport_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_tnt.png b/mods/throwing/textures/throwing_arrow_tnt.png new file mode 100755 index 00000000..6625cb0a Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_tnt.png differ diff --git a/mods/throwing/textures/throwing_arrow_tnt_2.png b/mods/throwing/textures/throwing_arrow_tnt_2.png new file mode 100755 index 00000000..426ebff8 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_tnt_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_tnt_back.png b/mods/throwing/textures/throwing_arrow_tnt_back.png new file mode 100755 index 00000000..230bb185 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_tnt_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_tnt_front.png b/mods/throwing/textures/throwing_arrow_tnt_front.png new file mode 100755 index 00000000..38d22e30 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_tnt_front.png differ diff --git a/mods/throwing/textures/throwing_arrow_torch.png b/mods/throwing/textures/throwing_arrow_torch.png new file mode 100755 index 00000000..0126df17 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_torch.png differ diff --git a/mods/throwing/textures/throwing_arrow_torch_2.png b/mods/throwing/textures/throwing_arrow_torch_2.png new file mode 100755 index 00000000..6bf9e11d Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_torch_2.png differ diff --git a/mods/throwing/textures/throwing_arrow_torch_back.png b/mods/throwing/textures/throwing_arrow_torch_back.png new file mode 100755 index 00000000..12754c79 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_torch_back.png differ diff --git a/mods/throwing/textures/throwing_arrow_torch_front.png b/mods/throwing/textures/throwing_arrow_torch_front.png new file mode 100755 index 00000000..764a2632 Binary files /dev/null and b/mods/throwing/textures/throwing_arrow_torch_front.png differ diff --git a/mods/throwing/textures/throwing_bow_bronze.png b/mods/throwing/textures/throwing_bow_bronze.png deleted file mode 100755 index 3ea0e822..00000000 Binary files a/mods/throwing/textures/throwing_bow_bronze.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_bow_composite.png b/mods/throwing/textures/throwing_bow_composite.png new file mode 100755 index 00000000..630af5a2 Binary files /dev/null and b/mods/throwing/textures/throwing_bow_composite.png differ diff --git a/mods/throwing/textures/throwing_bow_composite_loaded.png b/mods/throwing/textures/throwing_bow_composite_loaded.png new file mode 100755 index 00000000..67bf8e5e Binary files /dev/null and b/mods/throwing/textures/throwing_bow_composite_loaded.png differ diff --git a/mods/throwing/textures/throwing_bow_diamond.png b/mods/throwing/textures/throwing_bow_diamond.png deleted file mode 100755 index 9050c220..00000000 Binary files a/mods/throwing/textures/throwing_bow_diamond.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_bow_mese.png b/mods/throwing/textures/throwing_bow_mese.png deleted file mode 100755 index 38579985..00000000 Binary files a/mods/throwing/textures/throwing_bow_mese.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_bow_royal.png b/mods/throwing/textures/throwing_bow_royal.png new file mode 100755 index 00000000..43c20f89 Binary files /dev/null and b/mods/throwing/textures/throwing_bow_royal.png differ diff --git a/mods/throwing/textures/throwing_bow_royal_loaded.png b/mods/throwing/textures/throwing_bow_royal_loaded.png new file mode 100755 index 00000000..3416f2e3 Binary files /dev/null and b/mods/throwing/textures/throwing_bow_royal_loaded.png differ diff --git a/mods/throwing/textures/throwing_bow_steel.png b/mods/throwing/textures/throwing_bow_steel.png index 7688b286..0e1d3d1b 100755 Binary files a/mods/throwing/textures/throwing_bow_steel.png and b/mods/throwing/textures/throwing_bow_steel.png differ diff --git a/mods/throwing/textures/throwing_bow_steel_loaded.png b/mods/throwing/textures/throwing_bow_steel_loaded.png new file mode 100755 index 00000000..16150a6b Binary files /dev/null and b/mods/throwing/textures/throwing_bow_steel_loaded.png differ diff --git a/mods/throwing/textures/throwing_bow_stone.png b/mods/throwing/textures/throwing_bow_stone.png deleted file mode 100755 index 6a22e571..00000000 Binary files a/mods/throwing/textures/throwing_bow_stone.png and /dev/null differ diff --git a/mods/throwing/textures/throwing_bow_wood.png b/mods/throwing/textures/throwing_bow_wood.png index 163721d3..9a6c6da7 100755 Binary files a/mods/throwing/textures/throwing_bow_wood.png and b/mods/throwing/textures/throwing_bow_wood.png differ diff --git a/mods/throwing/textures/throwing_bow_wood_loaded.png b/mods/throwing/textures/throwing_bow_wood_loaded.png new file mode 100755 index 00000000..251e643e Binary files /dev/null and b/mods/throwing/textures/throwing_bow_wood_loaded.png differ diff --git a/mods/throwing/textures/throwing_crossbow.png b/mods/throwing/textures/throwing_crossbow.png new file mode 100755 index 00000000..f8a400b4 Binary files /dev/null and b/mods/throwing/textures/throwing_crossbow.png differ diff --git a/mods/throwing/textures/throwing_crossbow_loaded.png b/mods/throwing/textures/throwing_crossbow_loaded.png new file mode 100755 index 00000000..5d2b0c7e Binary files /dev/null and b/mods/throwing/textures/throwing_crossbow_loaded.png differ diff --git a/mods/throwing/textures/throwing_empty.png b/mods/throwing/textures/throwing_empty.png index 4b5b3029..6bbd5547 100755 Binary files a/mods/throwing/textures/throwing_empty.png and b/mods/throwing/textures/throwing_empty.png differ diff --git a/mods/throwing/textures/throwing_longbow.png b/mods/throwing/textures/throwing_longbow.png new file mode 100755 index 00000000..7bdae2f2 Binary files /dev/null and b/mods/throwing/textures/throwing_longbow.png differ diff --git a/mods/throwing/textures/throwing_longbow_loaded.png b/mods/throwing/textures/throwing_longbow_loaded.png new file mode 100755 index 00000000..e03299a5 Binary files /dev/null and b/mods/throwing/textures/throwing_longbow_loaded.png differ diff --git a/mods/throwing/textures/throwing_sparkle.png b/mods/throwing/textures/throwing_sparkle.png new file mode 100755 index 00000000..432786e7 Binary files /dev/null and b/mods/throwing/textures/throwing_sparkle.png differ diff --git a/mods/throwing/textures/throwing_sparkle_blue.png b/mods/throwing/textures/throwing_sparkle_blue.png new file mode 100755 index 00000000..d4710a31 Binary files /dev/null and b/mods/throwing/textures/throwing_sparkle_blue.png differ diff --git a/mods/throwing/textures/throwing_sparkle_red.png b/mods/throwing/textures/throwing_sparkle_red.png new file mode 100755 index 00000000..59ec68c8 Binary files /dev/null and b/mods/throwing/textures/throwing_sparkle_red.png differ diff --git a/mods/throwing/throwing.conf b/mods/throwing/throwing.conf new file mode 100755 index 00000000..8bd77242 --- /dev/null +++ b/mods/throwing/throwing.conf @@ -0,0 +1,34 @@ +# +# You can disable or disable any bow and arrow by writing lines like these inside throwing.conf +# +# Bows +DISABLE_WOODEN_BOW = false +DISABLE_LONGBOW = false +DISABLE_COMPOSITE_BOW = false +DISABLE_STEEL_BOW = false +DISABLE_ROYAL_BOW = false +# +# Crossbows +DISABLE_CROSSBOW = false +DISABLE_ARBALEST = false +DISABLE_AUTOMATED_ARBALEST = false +# +# Arrow +# Special Arrows +DISABLE_TELEPORT_ARROW = false +DISABLE_DIG_ARROW = false +DISABLE_BUILD_ARROW = false +DISABLE_TNT_ARROW = true # Desactivated because too dangerous +DISABLE_FIRE_ARROW = true # Desactivated because too dangerous +DISABLE_TORCH_ARROW = false +DISABLE_SHELL_ARROW = false # /!\ Need test it /!\ + +# Fireworks arrows +DISABLE_FIREWORKS_BLUE_ARROW = false +DISABLE_FIREWORKS_RED_ARROW = false + +# Normal arrows +DISABLE_STONE_ARROW = false +DISABLE_STEEL_ARROW = false +DISABLE_DIAMOND_ARROW = false +DISABLE_OBSIDIAN_ARROW = false diff --git a/mods/throwing/throwing.conf.example b/mods/throwing/throwing.conf.example new file mode 100755 index 00000000..f0e1ba5b --- /dev/null +++ b/mods/throwing/throwing.conf.example @@ -0,0 +1,52 @@ +# You can disable or disable any bow and arrow by writing lines like these inside throwing.conf +# +# DISABLE_WOODEN_BOW = true +# +# +# DISABLE_LONGBOW = true +# +# +# DISABLE_COMPOSITE_BOW = true +# +# +# DISABLE_STEEL_BOW = true +# +# +# DISABLE_ROYAL_BOW = true +# +# +# DISABLE_CROSSBOW = true +# +# +# DISABLE_BUILD_ARROW = false +# +# +# DISABLE_DIG_ARROW = false +# +# +# DISABLE_DIAMOND_ARROW = true +# +# +# DISABLE_OBSIDIAN_ARROW = true +# +# +# DISABLE_SHELL_ARROW = true +# +# +# DISABLE_STEEL_ARROW = true +# +# +# DISABLE_STONE_ARROW = false +# +# +# DISABLE_TELEPORT_ARROW = false +# +# +# DISABLE_FIRE_ARROW = false +# +# +# DISABLE_TNT_ARROW = false +# +# +# DISABLE_TORCH_ARROW = true +# \ No newline at end of file diff --git a/mods/throwing/tnt_arrow.lua b/mods/throwing/tnt_arrow.lua new file mode 100755 index 00000000..d0a4f7dc --- /dev/null +++ b/mods/throwing/tnt_arrow.lua @@ -0,0 +1,286 @@ +minetest.register_craftitem("throwing:arrow_tnt", { + description = "TNT arrow", + inventory_image = "throwing_arrow_tnt.png", +}) + +minetest.register_node("throwing:arrow_tnt_box", { + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + -- Shaft + {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, + --Spitze + {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, + {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, + --Federn + {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, + {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, + {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, + {6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17}, + + {7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17}, + {8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17}, + {8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17}, + {7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17}, + } + }, + tiles = {"throwing_arrow_tnt.png", "throwing_arrow_tnt.png", "throwing_arrow_tnt_back.png", "throwing_arrow_tnt_front.png", "throwing_arrow_tnt_2.png", "throwing_arrow_tnt.png"}, + groups = {not_in_creative_inventory=1}, +}) + +local THROWING_ARROW_ENTITY={ + physical = false, + timer=0, + visual = "wielditem", + visual_size = {x=0.1, y=0.1}, + textures = {"throwing:arrow_tnt_box"}, + lastpos={}, + collisionbox = {0,0,0,0,0,0}, +} + +-- TNT functions copied, would be nice to directly call them through an API... + +-- loss probabilities array (one in X will be lost) +local loss_prob = {} + +loss_prob["default:cobble"] = 3 +loss_prob["default:dirt"] = 4 + +local radius = tonumber(minetest.setting_get("tnt_radius") or 3) + +-- Fill a list with data for content IDs, after all nodes are registered +local cid_data = {} +minetest.after(0, function() + for name, def in pairs(minetest.registered_nodes) do + cid_data[minetest.get_content_id(name)] = { + name = name, + drops = def.drops, + flammable = def.groups.flammable, + } + end +end) + +local function rand_pos(center, pos, radius) + pos.x = center.x + math.random(-radius, radius) + pos.z = center.z + math.random(-radius, radius) +end + +local function eject_drops(drops, pos, radius) + local drop_pos = vector.new(pos) + for _, item in pairs(drops) do + local count = item:get_count() + local max = item:get_stack_max() + if count > max then + item:set_count(max) + end + while count > 0 do + if count < max then + item:set_count(count) + end + rand_pos(pos, drop_pos, radius) + local obj = minetest.add_item(drop_pos, item) + if obj then + obj:get_luaentity().collect = true + obj:setacceleration({x=0, y=-10, z=0}) + obj:setvelocity({x=math.random(-3, 3), y=10, + z=math.random(-3, 3)}) + end + count = count - max + end + end +end + +local function add_drop(drops, item) + item = ItemStack(item) + local name = item:get_name() + if loss_prob[name] ~= nil and math.random(1, loss_prob[name]) == 1 then + return + end + + local drop = drops[name] + if drop == nil then + drops[name] = item + else + drop:set_count(drop:get_count() + item:get_count()) + end +end + +local fire_node = {name="fire:basic_flame"} + +local function destroy(drops, pos, cid) + if minetest.is_protected(pos, "") then + return + end + local def = cid_data[cid] + if def and def.flammable then + minetest.set_node(pos, fire_node) + else + minetest.dig_node(pos) + if def then + local node_drops = minetest.get_node_drops(def.name, "") + for _, item in ipairs(node_drops) do + add_drop(drops, item) + end + end + end +end + + +local function calc_velocity(pos1, pos2, old_vel, power) + local vel = vector.direction(pos1, pos2) + vel = vector.normalize(vel) + vel = vector.multiply(vel, power) + + -- Divide by distance + local dist = vector.distance(pos1, pos2) + dist = math.max(dist, 1) + vel = vector.divide(vel, dist) + + -- Add old velocity + vel = vector.add(vel, old_vel) + return vel +end + +local function entity_physics(pos, radius) + -- Make the damage radius larger than the destruction radius + radius = radius * 2 + local objs = minetest.get_objects_inside_radius(pos, radius) + for _, obj in pairs(objs) do + local obj_pos = obj:getpos() + local obj_vel = obj:getvelocity() + local dist = math.max(1, vector.distance(pos, obj_pos)) + + if obj_vel ~= nil then + obj:setvelocity(calc_velocity(pos, obj_pos, + obj_vel, radius * 10)) + end + + local damage = (5 / dist) * radius + obj:set_hp(obj:get_hp() - damage) + end +end + +local function add_effects(pos, radius) + minetest.add_particlespawner({ + amount = 128, + time = 1, + minpos = vector.subtract(pos, radius / 2), + maxpos = vector.add(pos, radius / 2), + minvel = {x=-20, y=-20, z=-20}, + maxvel = {x=20, y=20, z=20}, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 1, + maxexptime = 3, + minsize = 8, + maxsize = 16, + texture = "tnt_smoke.png", + }) +end + + +local function explode(pos, radius) + local pos = vector.round(pos) + local vm = VoxelManip() + local pr = PseudoRandom(os.time()) + local p1 = vector.subtract(pos, radius) + local p2 = vector.add(pos, radius) + local minp, maxp = vm:read_from_map(p1, p2) + local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local data = vm:get_data() + + local drops = {} + local p = {} + + local c_air = minetest.get_content_id("air") + local c_tnt = minetest.get_content_id("tnt:tnt") + local c_tnt_burning = minetest.get_content_id("tnt:tnt_burning") + local c_gunpowder = minetest.get_content_id("tnt:gunpowder") + local c_gunpowder_burning = minetest.get_content_id("tnt:gunpowder_burning") + local c_boom = minetest.get_content_id("tnt:boom") + local c_fire = minetest.get_content_id("fire:basic_flame") + + for z = -radius, radius do + for y = -radius, radius do + local vi = a:index(pos.x + (-radius), pos.y + y, pos.z + z) + for x = -radius, radius do + if (x * x) + (y * y) + (z * z) <= + (radius * radius) + pr:next(-radius, radius) then + local cid = data[vi] + p.x = pos.x + x + p.y = pos.y + y + p.z = pos.z + z + if cid == c_tnt or cid == c_gunpowder then + burn(p) + elseif cid ~= c_tnt_burning and + cid ~= c_gunpowder_burning and + cid ~= c_air and + cid ~= c_fire and + cid ~= c_boom then + destroy(drops, p, cid) + end + end + vi = vi + 1 + end + end + end + + return drops +end + + +local function boom(pos) + minetest.sound_play("tnt_explode", {pos=pos, gain=1.5, max_hear_distance=2*64}) + minetest.set_node(pos, {name="tnt:boom"}) + minetest.get_node_timer(pos):start(0.5) + + local drops = explode(pos, radius) + entity_physics(pos, radius) + eject_drops(drops, pos, radius) + add_effects(pos, radius) +end + +-- Back to the arrow + +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 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:arrow_tnt_entity" and obj:get_luaentity().name ~= "__builtin:item" then + self.object:remove() + boom(pos) + end + end + end + end + + if self.lastpos.x~=nil then + if node.name ~= "air" then + self.object:remove() + boom(self.lastpos) + end + end + self.lastpos={x=pos.x, y=pos.y, z=pos.z} +end + +minetest.register_entity("throwing:arrow_tnt_entity", THROWING_ARROW_ENTITY) + +minetest.register_craft({ + output = 'throwing:arrow_tnt', + recipe = { + {'default:stick', 'tnt:tnt', 'default:bronze_ingot'}, + } +}) + +minetest.register_craft({ + output = 'throwing:arrow_tnt', + recipe = { + {'default:bronze_ingot', 'tnt:tnt', 'default:stick'}, + } +}) diff --git a/mods/throwing/tools.lua b/mods/throwing/tools.lua new file mode 100755 index 00000000..45e8f410 --- /dev/null +++ b/mods/throwing/tools.lua @@ -0,0 +1,55 @@ +if not DISABLE_WOODEN_BOW then + throwing_register_bow ('bow_wood', 'Wooden bow', {x=1, y=1, z=0.5}, 11, 0.8, 50, false, { + {'', 'default:stick', ''}, + {'farming:string', '', 'default:stick'}, + {'', 'default:stick', ''}, + }) +end + +if not DISABLE_LONGBOW then + throwing_register_bow ('longbow', 'Longbow', {x=1, y=2.5, z=0.5}, 17, 1.8, 100, false, { + {'farming:string', 'group:wood', ''}, + {'farming:string', '', 'group:wood'}, + {'farming:string', 'group:wood', ''}, + }) +end + +if not DISABLE_COMPOSITE_BOW then + throwing_register_bow ('bow_composite', 'Composite bow', {x=1, y=1.4, z=0.5}, 17, 1, 150, false, { + {'farming:string', 'group:wood', ''}, + {'farming:string', '', 'default:steel_ingot'}, + {'farming:string', 'group:wood', ''}, + }) +end + +if not DISABLE_STEEL_BOW then + throwing_register_bow ('bow_steel', 'Steel bow', {x=1, y=1.4, z=0.5}, 20, 1.3, 250, false, { + {'farming:string', 'default:steel_ingot', ''}, + {'farming:string', '', 'default:steel_ingot'}, + {'farming:string', 'default:steel_ingot', ''}, + }) +end + +if not DISABLE_ROYAL_BOW then + throwing_register_bow ('bow_royal', 'Royal bow', {x=1, y=1.5, z=0.5}, 18, 1.4, 750, false, { + {'farming:string', 'group:wood', 'default:diamond'}, + {'farming:string', '', 'default:gold_ingot'}, + {'farming:string', 'group:wood', 'default:diamond'}, + }) +end + +if not DISABLE_CROSSBOW then + throwing_register_bow ('crossbow', 'Crossbow', {x=1, y=1.3, z=0.5}, 28, 5, 80, true, { + {'group:wood', 'farming:string', ''}, + {'default:steel_ingot', 'farming:string', 'group:wood'}, + {'group:wood', 'farming:string', ''}, + }) +end + +if not DISABLE_ARBALEST then + throwing_register_bow ('arbalest', 'Arbalest', {x=1, y=1.3, z=0.5}, 35, 7.5, 120, true, { + {'default:steel_ingot', 'farming:string', 'default:stick'}, + {'default:steel_ingot', 'farming:string', 'default:steel_ingot'}, + {'default:steel_ingot', 'farming:string', 'default:stick'}, + }) +end diff --git a/mods/throwing/torch_arrow.lua b/mods/throwing/torch_arrow.lua new file mode 100755 index 00000000..004b73d4 --- /dev/null +++ b/mods/throwing/torch_arrow.lua @@ -0,0 +1,104 @@ +minetest.register_craftitem("throwing:arrow_torch", { + description = "Torch Arrow", + inventory_image = "throwing_arrow_torch.png", +}) + +minetest.register_node("throwing:arrow_torch_box", { + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + -- Shaft + {-6.5/17, -1.5/17, -1.5/17, 6.5/17, 1.5/17, 1.5/17}, + --Spitze + {-4.5/17, 2.5/17, 2.5/17, -3.5/17, -2.5/17, -2.5/17}, + {-8.5/17, 0.5/17, 0.5/17, -6.5/17, -0.5/17, -0.5/17}, + --Federn + {6.5/17, 1.5/17, 1.5/17, 7.5/17, 2.5/17, 2.5/17}, + {7.5/17, -2.5/17, 2.5/17, 6.5/17, -1.5/17, 1.5/17}, + {7.5/17, 2.5/17, -2.5/17, 6.5/17, 1.5/17, -1.5/17}, + {6.5/17, -1.5/17, -1.5/17, 7.5/17, -2.5/17, -2.5/17}, + + {7.5/17, 2.5/17, 2.5/17, 8.5/17, 3.5/17, 3.5/17}, + {8.5/17, -3.5/17, 3.5/17, 7.5/17, -2.5/17, 2.5/17}, + {8.5/17, 3.5/17, -3.5/17, 7.5/17, 2.5/17, -2.5/17}, + {7.5/17, -2.5/17, -2.5/17, 8.5/17, -3.5/17, -3.5/17}, + } + }, + tiles = {"throwing_arrow_torch.png", "throwing_arrow_torch.png", "throwing_arrow_torch_back.png", "throwing_arrow_torch_front.png", "throwing_arrow_torch_2.png", "throwing_arrow_torch.png"}, + groups = {not_in_creative_inventory=1}, +}) + +local THROWING_ARROW_ENTITY={ + physical = false, + timer=0, + visual = "wielditem", + visual_size = {x=0.1, y=0.1}, + textures = {"throwing:arrow_torch_box"}, + lastpos={}, + collisionbox = {0,0,0,0,0,0}, + node = "", +} + +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 self.timer>0.2 then + local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, 0.5) + for k, obj in pairs(objs) do + if obj:get_luaentity() ~= nil then + if obj:get_luaentity().name ~= "throwing:arrow_torch_entity" and obj:get_luaentity().name ~= "__builtin:item" then + local damage = 0.5 + obj:punch(self.object, 1.0, { + full_punch_interval=1.0, + damage_groups={fleshy=damage}, + }, nil) + self.object:remove() + local toughness = 0.9 + if math.random() < toughness then + minetest.add_item(self.lastpos, 'throwing:arrow_torch') + else + minetest.add_item(self.lastpos, 'default:stick') + end + end + end + end + end + + if self.lastpos.x~=nil then + if node.name ~= "air" 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) + local wall=minetest.dir_to_wallmounted(dir) + minetest.add_node(self.lastpos, {name="default:torch", param2 = wall}) + else + local toughness = 0.9 + if math.random() < toughness then + minetest.add_item(self.lastpos, 'throwing:arrow_torch') + else + minetest.add_item(self.lastpos, 'default:stick') + end + end + end + end + self.lastpos={x=pos.x, y=pos.y, z=pos.z} +end + +minetest.register_entity("throwing:arrow_torch_entity", THROWING_ARROW_ENTITY) + +minetest.register_craft({ + output = 'throwing:arrow_torch 4', + recipe = { + {'default:stick', 'default:stick', 'group:coal'}, + } +}) + +minetest.register_craft({ + output = 'throwing:arrow_torch 4', + recipe = { + {'group:coal', 'default:stick', 'default:stick'}, + } +}) diff --git a/other_things/Tableau-valeurs-MFF.ods b/other_things/Tableau-valeurs-MFF.ods index 99feb23c..e4c4d842 100755 Binary files a/other_things/Tableau-valeurs-MFF.ods and b/other_things/Tableau-valeurs-MFF.ods differ diff --git a/other_things/World Edit schems/race.we b/other_things/World Edit schems/race.we old mode 100644 new mode 100755