[Mod] Spears [3.1] [spears]

User avatar
Echoes91
Member
Posts: 80
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes
Location: Lombardy, Italy

[Mod] Spears [3.1] [spears]

by Echoes91 » Post

Spears

This mod adds spears to Minetest games. They are versatile weapons that can be used to attack like a normal sword, even if slower, or safely thrown to the bad ones from the distance.
These are the spears introduced within throwing enhanced, now improved, and here is where I'll continue their development.

Image

Download from content DB - Minetest version 5.4.0 required

Run git clone https://gitlab.com/echoes91/spears.git from mods folder to clone the repository. Beware, mess in progress :)

Browse the code and report bugs

Dependencies: default

License:
Code under LGPLv2.1
Textures and sounds under CC-BY 3.0
Spoiler
  • Spears can be thrown using right mouse button, they either hurt someone or stick where they land on; damage depends on speed and material, flight trajectory is ballistic with (unrealistic) drag.
  • Spears can be used to fight, but are slower and weaker than swords.
  • Spears can be used to dig, but are slower and weaker and pickaxes.
  • If you miss the target it's your fault, the spear is fine.
  • You can grab a spear on the fly (or maybe wait until it falls?).
  • You can stick a spear into a block, but if you remove the block then the spear falls (obviously).
  • If you feel clever, throw a spear right above you and look at it to see what happens.
  • You can even throw a spear from above down to your foes, it's easier to hit.
  • Someone once reported to have hit its own foot but it takes practice to do that
  • This mod contains the word "spear" more than 100 times, if you want the exact number count them yourself.
Spoiler
All recipes work also horizontally mirrored. Any member of the same group can be used.

Image Stone spear: Lowest damage and resistance, easiest and cheapest to craft.
| | | stone |
| | stick | |
| stick | | |

Image Steel spear: Good damage and resistance, like steel tools.
| | | Steel ingot |
| | stick | |
| stick | | |

Image Copper spear: Softer than the steel one, but lasts longer.
| | | Copper ingot |
| | stick | |
| stick | | |

Image Bronze spear: Like bronze tools, it's as powerful as steel and lasts longer.
| | | Bronze ingot |
| | stick | |
| stick | | |

Image Obsidian spear: It deals the same damage of a diamond spear but last as long as a steel spear.
| | | Obsidian |
| | stick | |
| stick | | |

Image Diamond spear: Best damage and resistance, like diamond tools.
| | | Diamond |
| | stick | |
| stick | | |

Image Golden spear: A golden-plated celebratory spear, soft like copper but lasting as long as diamond.
| | | Gold ingot |
| | stick | |
| stick | | |
Spoiler
Version 3.0
  • First attempt to detect collisionboxes
  • Implemented settings through settingtypes.txt, deprecating "spears.conf"
Version 2.4
  • Functions rewrite, fixed many vector/variable declarations and unknown node handling
  • Added pigiron support
Version 2.3
  • Updated to Minetest 5.6.0 API
  • Changed receipts to avoid being confused with arrows
  • Various cleansing and fixes
Version 2.2
  • "Hit detection" based on spearhead position
  • Spears go through buildable_to nodes (snow)
  • Ugly fix to not collide in air above slabs (works only if slabs are not rotated)
Version 2.1
  • Spears ding hard blocks (cracky < 3)
  • Fixed stick-into-node position to avoid spears turning black (#2467)
  • Player velocity added to throw (it's physics baby)
Version 2.0
  • Cleaner, streamlined code without deprecated functions
  • Spears hurt players
  • Spears animated in flight
  • Spears stick into nodes
  • New textures
  • New sound when hitting flesh
  • New receipt to fit with default tools
  • Drag depends on fluid
  • Improved instructions
  • New gold-plated spear to celebrate
1.1
  • Update to make use of new API, requires Minetest version 5.2.0
1.0
  • First stable release
Spoiler
    • Spear stick into air if blocks have collision box smaller than 1x1x1
    • Spears fly through mobs meshes if passing too far from entity origin
    • Summing up, we need some way to detect collision boxes
Have fun!
Last edited by Echoes91 on Sat Feb 10, 2024 17:06, edited 21 times in total.

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod] Spears [alpha1] [spears]

by Don » Post

+1
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
Echoes91
Member
Posts: 80
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes
Location: Lombardy, Italy

Re: [Mod] Spears [alpha2] [spears]

by Echoes91 » Post

Added screenshot and fixed a bug causing spears that hit a mob and a node at the same time to duplicate.

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod] Spears [alpha2] [spears]

by Don » Post

Looks awesome. If you don't mind I am going to use this in my subgame.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

User avatar
Echoes91
Member
Posts: 80
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes
Location: Lombardy, Italy

Re: [Mod] Spears [alpha2] [spears]

by Echoes91 » Post

Don wrote:Looks awesome. If you don't mind I am going to use this in my subgame.
Have fun!

User avatar
Desour
Member
Posts: 1469
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [Mod] Spears [alpha2] [spears]

by Desour » Post

the mod looks interesting
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

User avatar
Echoes91
Member
Posts: 80
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes
Location: Lombardy, Italy

Re: [Mod] Spears [alpha3] [spears]

by Echoes91 » Post

Fixed spears that used to self repair while being thrown after reaching maximum wear. Reorganized code files for better visualization.
DS-minetest wrote:the mod looks interesting
I hope so :)

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod] Spears [alpha3] [spears]

by Krock » Post

Why did I not see this mod earlier?!
The throw function works fine but I would like to throw them using the LMB, like with snowballs and shuriken.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Echoes91
Member
Posts: 80
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes
Location: Lombardy, Italy

Re: [Mod] Spears [alpha3] [spears]

by Echoes91 » Post

Krock wrote:Why did I not see this mod earlier?!
The throw function works fine but I would like to throw them using the LMB, like with snowballs and shuriken.
Because it appeared few days ago :) they were introduced within my older mod but it was turning into a big mess.
Assigning a function to the LMB would remove the tool's capabilities (dig and melee attack), while at the RMB would work only if pointing at something (close enough to get a selected target). These are API limitations.

User avatar
Napiophelios
Member
Posts: 1035
Joined: Mon Jul 07, 2014 01:14
GitHub: Napiophelios
IRC: Nappi
In-game: Nappi

Re: [Mod] Spears [alpha3] [spears]

by Napiophelios » Post

I made some 32px textures for this awhile back if you want to use them
spears_textures_32px.zip
License:WTFPL
(3.42 KiB) Downloaded 167 times

Image
spearz32.png
spearz32.png (7.12 KiB) Viewed 3042 times

User avatar
Minetestforfun
Member
Posts: 940
Joined: Tue Aug 05, 2014 14:09
GitHub: MinetestForFun
IRC: MinetestForFun
In-game: MinetestForFun
Location: On earth
Contact:

Re: [Mod] Spears [alpha3] [spears]

by Minetestforfun » Post

Napiophelios wrote:I made some 32px textures for this awhile back if you want to use them
spearz32.png
We also made our 32px textures https://github.com/MinetestForFun/serve ... s/textures
Feel free to re-used them.

User avatar
Echoes91
Member
Posts: 80
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes
Location: Lombardy, Italy

Re: [Mod] Spears [alpha3] [spears]

by Echoes91 » Post

Napiophelios wrote:I made some 32px textures for this awhile back if you want to use them
spears_textures_32px.zip

Image
spearz32.png
Nice! I prefer to keep it as coherent as possible with default game, using 16x16 textures with similar look and feel, however of course everybody must feel free to replace them, you just have to give them the same names and put them into the texture folder.
Minetestforfun wrote:
Napiophelios wrote:I made some 32px textures for this awhile back if you want to use them
spearz32.png
We also made our 32px textures https://github.com/MinetestForFun/serve ... s/textures
Feel free to re-used them.
OMG you have the earliest snapshot, where i didn't even finish to rewrite the README.txt XD. I'd really suggest you to upgrade to the latest release since there was quite some mess that has been fixed.

User avatar
Minetestforfun
Member
Posts: 940
Joined: Tue Aug 05, 2014 14:09
GitHub: MinetestForFun
IRC: MinetestForFun
In-game: MinetestForFun
Location: On earth
Contact:

Re: [Mod] Spears [alpha3] [spears]

by Minetestforfun » Post

Echoes91 wrote: OMG you have the earliest snapshot, where i didn't even finish to rewrite the README.txt XD. I'd really suggest you to upgrade to the latest release since there was quite some mess that has been fixed.
Yes, as you can see here https://github.com/MinetestForFun/serve ... issues/304 we planned to update the mod but we haven't updated the mod for the moment.

My earlier post wasn't for your advice on our updates cycle, but was on the 32px textures we made/use and we want to share with you. ;)

User avatar
swordpaint12
Member
Posts: 191
Joined: Sat Aug 22, 2015 00:50
In-game: [swordpaint12][Belching_Balladeer]
Location: Foobass, isle of Atlantis, castle of Bardvendelle

Re: [Mod] Spears [alpha3] [spears]

by swordpaint12 » Post

I believe I use your throwing mod. Kind of a shame they aren't being developed together anymore, but kind of makes sense. +1
God's not dead; remember that!
Yay for MT! No MC here!
I am a human. I'm younger than 100 years old.
I've been playing Minetest since December 2014.

I'm amazed that I haven't been on here in so long! My latest minetest accomplishment was mining by hand (well, as close as you can get in a computer game) a circle 30 blocks in diameter. It took forever but it's pretty cool.

User avatar
Echoes91
Member
Posts: 80
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes
Location: Lombardy, Italy

Re: [Mod] Spears [alpha3] [spears]

by Echoes91 » Post

Minetestforfun wrote:My earlier post wasn't for your advice on our updates cycle, but was on the 32px textures we made/use and we want to share with you. ;)
Of course, but I felt quite guilty for having published such an unpolished snapshot so I'm hoping for any of its tracks to disappear as soon as possible...
swordpaint12 wrote:I believe I use your throwing mod. Kind of a shame they aren't being developed together anymore, but kind of makes sense. +1
Actually i split them because i noticed that developing one set of features (like spears) wasn't bringing improvements to the others anymore, but just increasing the mess. I thought that spears would have been similar to arrows but now they don't share a single function anymore.
Once all of its sets will be functional and polished as themselves, so that one can concentrate testing and development easily on one without breaking any other, throwing enhanced will probably survive as a modpack.

User avatar
swordpaint12
Member
Posts: 191
Joined: Sat Aug 22, 2015 00:50
In-game: [swordpaint12][Belching_Balladeer]
Location: Foobass, isle of Atlantis, castle of Bardvendelle

Re: [Mod] Spears [alpha3] [spears]

by swordpaint12 » Post

Yes. That makes lots of sense. Maybe eventually you'll upgrade it to a weapons modpack. I dunno. Best of luck!
God's not dead; remember that!
Yay for MT! No MC here!
I am a human. I'm younger than 100 years old.
I've been playing Minetest since December 2014.

I'm amazed that I haven't been on here in so long! My latest minetest accomplishment was mining by hand (well, as close as you can get in a computer game) a circle 30 blocks in diameter. It took forever but it's pretty cool.

npx
Member
Posts: 164
Joined: Thu Apr 09, 2015 21:17
In-game: npx
Location: Turin, Italy

Re: [Mod] Spears [alpha3] [spears]

by npx » Post

Amazing! I love your work!

User avatar
Echoes91
Member
Posts: 80
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes
Location: Lombardy, Italy

Re: [Mod] Spears [1.0] [spears]

by Echoes91 » Post

Updated to 1.0
Since I've not been able to animate spear's flight any better through using API, this first stable version won't bring any drastic change.
However, apart of knowing that everything works good, this release brings a small buff to spears' speed and, consequently, damage at range, two new spears were added and inventory images now are oriented like all the other default's tools.
I've been testing for some hours now, also hosting (and playing) multiplayer, no issue have emerged so far.

Dalethejr
New member
Posts: 3
Joined: Thu Feb 11, 2016 23:48
GitHub: LuaLover
IRC: LuaLover
In-game: LuaLover

Re: [Mod] Spears [1.0] [spears]

by Dalethejr » Post

`
Last edited by Dalethejr on Sun Nov 12, 2023 00:16, edited 1 time in total.

Dalethejr
New member
Posts: 3
Joined: Thu Feb 11, 2016 23:48
GitHub: LuaLover
IRC: LuaLover
In-game: LuaLover

Re: [Mod] Spears [1.0] [spears]

by Dalethejr » Post

`
Last edited by Dalethejr on Sun Nov 12, 2023 00:16, edited 1 time in total.

User avatar
Echoes91
Member
Posts: 80
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes
Location: Lombardy, Italy

Re: [Mod] Spears [1.0] [spears]

by Echoes91 » Post

Dalethejr wrote:Sorry for copying your mod dude, I hadn't seen this before... I'll put a link in my mod so ppl can come see this one
Dalethejr wrote:Also, would you like to combine our mods? viewtopic.php?f=9&t=14044
If you had not seen this one you can't have copied it, so your work is totally yours. Spears are a really ancient weapon so nobody can't patent such an idea :)
I have not enough time to develop mods right now, however i released them as free software (see the licence) which means that anybody can look at the code, modify it and publish it again as long as is under the same licence (and possibly with some credits to the author).
If you would like to improve my work or merge some features into yours you're welcome, surely it's better to join forces instead of developing something redundant.
I see that your mod has more features other than spears and since mines are older (so probably more refined) you could create a modpack containing my repo cloned among with your new weapons.

Dalethejr
New member
Posts: 3
Joined: Thu Feb 11, 2016 23:48
GitHub: LuaLover
IRC: LuaLover
In-game: LuaLover

Re: [Mod] Spears [1.0] [spears]

by Dalethejr » Post

`
Last edited by Dalethejr on Sun Nov 12, 2023 00:15, edited 1 time in total.

User avatar
Echoes91
Member
Posts: 80
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes
Location: Lombardy, Italy

Re: [Mod] Spears [1.1] [spears]

by Echoes91 » Post

I'm glad to announce that in Update 1.1 spears can be finally thrown using right mouse button!

This thanks to new API -> It requires Minetest version 5.2.0 or newer

User avatar
Echoes91
Member
Posts: 80
Joined: Thu Feb 19, 2015 13:21
In-game: Echoes
Location: Lombardy, Italy

Re: [Mod] Spears [2.0] [spears]

by Echoes91 » Post

Version 2.0 has arrived and it's a pretty big update. It has:
  • - Cleaner, streamlined code without deprecated functions
    - Spears hurt players
    - Spears animated in flight
    - Spears stick into nodes
    - New textures
    - New sound when hitting flesh
    - New receipt to fit with default tools
    - Drag now depends on fluid
    - Rewritten instructions
    - New gold-plated spear to celebrate
Please report bugs and have fun!

Bastrabun
Member
Posts: 211
Joined: Mon Nov 04, 2019 19:48

Re: [Mod] Spears [2.0] [spears]

by Bastrabun » Post

I'm going to test that mod for my server :)

Are you planning on submitting it to content db?
Whatever I say is CC0

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests