From 510ab936b8af7f7edb46d48757020c2b7af408fb Mon Sep 17 00:00:00 2001 From: Andrea Plati Date: Thu, 8 Oct 2015 23:35:22 +0200 Subject: [PATCH] alpha1 --- README.txt | 107 ++++++++++++++++++++++++++++++++++++++++ sounds/spears_sound.ogg | Bin 0 -> 6224 bytes tools.lua | 18 +++++-- 3 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 README.txt create mode 100644 sounds/spears_sound.ogg diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..9400246 --- /dev/null +++ b/README.txt @@ -0,0 +1,107 @@ +=== SPEARS for MINETEST === + +This mod adds spears to Minetest. It aims at improving the ones introduced within throwing enhanced. + +How to install: +http://wiki.minetest.com/wiki/Installing_Mods + +How to use the mod: +Spear work similarly to other tools such as swords, even if being a little slower. Moreover, a spear can be thrown using the drop key ('Q') or + +License: +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) + + +Changelog: + +Update 1.4.1: +- Fixed spears not retaining wear +- Improved textures +- Torch arrows have light trail + +Update 1.4: +- Added spears, capable of melee and ranged attacks +- Improved arrows textures + +Update 1.3: +- Added automated arbalest, the ultimate weapon +- New arbalest texture coherent with steel color + +Update 1.2: +- Added arbalest +- Defaults initialized + +Update 1.1: +- Added crossbow +- Code shrink +- Offensive arrows go through flora's and farming's +- Small fixes + +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! + +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/sounds/spears_sound.ogg b/sounds/spears_sound.ogg new file mode 100644 index 0000000000000000000000000000000000000000..411598c409817855317c1d3814e8502aaa6721be GIT binary patch literal 6224 zcmai12Ut@{*S?XKV8BoX4VX}bP}D?l2{w8Opb`j35Rek3E1@X6;-UnWE+rsRq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9z!bC*BVd};~v_E3V_kxHV!UT}p}xJJdw zKKVze#)SI4R)5ekX6m;R-)Em(7EXftP^|yB1*LkM@>S* z0+2=P8Bq25KvJ)MyN5Y+=9ct5}o-q8Q zS6vH_JWC(>SmG+g>7C4PC&eAF`e4wYTfp1hLgI%&eXH3OzFH-^u)8)1HCDWcUCnEimQ&4?R%j3WvJrG$IZR{fvIlW z1W=E~1_diMR#NNYt>nsmo}LkIp~O$r3~|+^q7O9oIoSKo3QH7eOtH$}zrBJuLLe*N zCP-W)I5<=@opYM%QuHL)U5z!K_L?FiX}46q*d86C{`A=j`Cu(O>b>1rh(QQ_6r=iP z*E~%_7$Z=Tqusnb*otR2?obrdTk{rN z{P6N^UoXOo6jZ9UduW%hvD zM5d?`@$n60`*hk&l5;}FX;*(vEL6I08agKX!uPO-k1p$i*yooiieCy6%u7qtM@FWu l4Lr-6pBs+2K literal 0 HcmV?d00001 diff --git a/tools.lua b/tools.lua index 7628521..1e2e74c 100644 --- a/tools.lua +++ b/tools.lua @@ -52,6 +52,18 @@ function spears_register_spear(kind, desc, eq, toughness, craft) textures = {"spears:spear_" .. kind}, lastpos={}, collisionbox = {0,0,0,0,0,0}, + on_punch = function(self, puncher) + if puncher then + if puncher:is_player() then + local stack = {name='spears:spear_' .. kind, wear=self.wear+65535/toughness} + local inv = puncher:get_inventory() + if inv:room_for_item("main", stack) then + inv:add_item("main", stack) + self.object:remove() + end + end + end + end, } SPEAR_ENTITY.on_step = function(self, dtime) @@ -69,13 +81,13 @@ function spears_register_spear(kind, desc, eq, toughness, craft) if obj:get_luaentity() ~= nil then if obj:get_luaentity().name ~= "spears:spear_" .. kind .. "_entity" and obj:get_luaentity().name ~= "__builtin:item" then local speed = vector.length(self.object:getvelocity()) - local damage = ((speed + eq)^1.2)/3 + local damage = (speed + eq)^1.12-20 obj:punch(self.object, 1.0, { full_punch_interval=1.0, damage_groups={fleshy=damage}, }, nil) self.object:remove() - minetest.add_item(self.lastpos, {name='spears:spear_' .. kind, count=1, wear=self.wear+65535/toughness, metadata=""}) + minetest.add_item(self.lastpos, {name='spears:spear_' .. kind, wear=self.wear+65535/toughness}) end end end @@ -84,7 +96,7 @@ function spears_register_spear(kind, desc, eq, toughness, craft) if self.lastpos.x~=nil then if node.name ~= "air" and not (string.find(node.name, 'grass') and not string.find(node.name, 'dirt')) and not string.find(node.name, 'flowers:') and not string.find(node.name, 'farming:') then self.object:remove() - minetest.add_item(self.lastpos, {name='spears:spear_' .. kind, count=1, wear=self.wear+65535/toughness, metadata=""}) + minetest.add_item(self.lastpos, {name='spears:spear_' .. kind, wear=self.wear+65535/toughness}) end end self.lastpos={x=pos.x, y=pos.y, z=pos.z}