Page 1 of 1

[Mod] Throwing Redo [throwing]

Posted: Sat Jan 07, 2017 12:10
by Palige
A new implementation of throwing with a cleaner code and providing an API in order to be extendable.

Throwing mod by PilzAdam
Throwing mod by Jeija

This mod is able to replace both throwing mods above without issues (if you name its directory throwing, the itemstrings remain the same).

This mod is actively tested on the Eurythmia server.

GitHub repository (includes issue tracker)

Download
(Also available in .tar.gz)

Configuration and API documentation

Dependencies: default and farming (both included in the minetest game, you don't need to install them)
License for code: MPL-2.0
License for textures: Same as for the textures of the throwing mod by PilzAdam (WTFPL).


Bows:
  • Wooden Bow
  • Stone Bow
  • Steel Bow
  • Bronze Bow
  • Mese Bow
  • Diamond Bow
Arrows:
  • Arrow
  • Golden Arrow
  • Dig Arrow
  • Admin Dig Arrow
  • Teleport Arrow
  • Torch Arrow
  • Build Arrow
  • Drop Arrow

Re: [Mod] Throwing Redo [throwing]

Posted: Sat Jan 07, 2017 17:07
by yzelast
Interesting.But when i get hitted by an arrow the game crashes with the following error:

init.lua 66: attempt to call method "get_player_name" (a nil value)

Re: [Mod] Throwing Redo [throwing]

Posted: Sat Jan 07, 2017 17:37
by Palige
yzelast wrote:Interesting.But when i het hitted by an arrow the game crashes with the following error:

init.lua 66: attempt to call method "get_player_name" (a nil value)
Sorry for this bug ! Now fixed ;-)
Thank you for testing !

Re: [Mod] Throwing Redo [throwing]

Posted: Sun Jan 08, 2017 20:24
by Martno
I tested it a little, and it seems working great with mods redo. Cool.

Re: [Mod] Throwing Redo [throwing]

Posted: Thu Jan 12, 2017 08:29
by texmex
Nice mod! Some bugs though:

• Arrows are placeable. Becomes black and not digable.
• Torch arrow puts all torches upside down, regardless of landing surface direction. Minetest 0.4.15 with new 3d torches.
• Teleport arrow sometimes crash the client (but not the server). Sorry for no log this time.

Re: [Mod] Throwing Redo [throwing]

Posted: Thu Jan 12, 2017 20:00
by Palige
texmex wrote:Nice mod! Some bugs though:

• Arrows are placeable. Becomes black and not digable.
• Torch arrow puts all torches upside down, regardless of landing surface direction. Minetest 0.4.15 with new 3d torches.
• Teleport arrow sometimes crash the client (but not the server). Sorry for no log this time.
Thank you very much for these reports!

The first bug is now fixed. A new setting has been added (defaulting to false): throwing.allow_arrow_placing. If it's true, the arrow can be placed as a normal node (now diggable and coloured). If it's false, the arrow cannot be placed.

The second bug looks really hard to fix. I have replaced minetest.set_node by minetest.place_node, so that the torch is now placed vertically. However, now, it can only be placed if there is a non-air node under it, because it's an attached node (if it cannot be placed in non-creative mode, of course the torch goes back to your inventory).

I tried to reproduce the last bug, but the teleport arrow never crashes for me...

Re: [Mod] Throwing Redo [throwing]

Posted: Thu Jan 12, 2017 21:11
by texmex
Sweet!

The teleport arrow bug could possibly have been triggered by moving fast and shooting the arrow into unloaded territory…

Re: [Mod] Throwing Redo [throwing]

Posted: Fri Jan 13, 2017 12:51
by Palige
texmex wrote:The teleport arrow bug could possibly have been triggered by moving fast and shooting the arrow into unloaded territory…
No crash for me :/

Re: [Mod] Throwing Redo [throwing]

Posted: Mon Jan 16, 2017 23:03
by texmex
Palige wrote:No crash for me :/
Perhaps a freak event :)

I wonder, could this mod be made to extend player's item drop feature? So that you may throw items longer, to a buddy on another cliff perhaps.

Re: [Mod] Throwing Redo [throwing]

Posted: Tue Jan 17, 2017 15:07
by Palige
texmex wrote:I wonder, could this mod be made to extend player's item drop feature? So that you may throw items longer, to a buddy on another cliff perhaps.
Yeah, definitely, this can be done in 15 lines using the mod API ! And that's a great idea, I'm implementing it

Re: [Mod] Throwing Redo [throwing]

Posted: Tue Jan 17, 2017 15:16
by texmex
Palige wrote:Yeah, definitely, this can be done in 15 lines using the mod API ! And that's a great idea, I'm implementing it
That's great! Because one should be able to…
Spoiler
Image

Re: [Mod] Throwing Redo [throwing]

Posted: Tue Jan 17, 2017 18:08
by Palige
texmex wrote:I wonder, could this mod be made to extend player's item drop feature? So that you may throw items longer, to a buddy on another cliff perhaps.
Done (in 20 lines)!
The dropped item is the item next to the arrow in the inventory.
The drop arrow can be crafted using a copper ingot (because I had no better idea...)

Re: [Mod] Throwing Redo [throwing]

Posted: Tue Jan 17, 2017 20:05
by texmex
Tested it. The feature I hade in mind would extend the native Q key drop function. Perhaps throwing it longer the longer keypress before release. But I wasn't very clear at all, and drop arrow is cool and useful too!

Re: [Mod] Throwing Redo [throwing]

Posted: Tue Jan 17, 2017 20:20
by Palige
texmex wrote:Tested it. The feature I hade in mind would extend the native Q key drop function. Perhaps throwing it longer the longer keypress before release. But I wasn't very clear at all, and drop arrow is cool and useful too!
Unfortunately, this is not possible, because the Minetest API does not provide any way to know whether a player is pressing the Q key (the only keys that the API can tell about are these ones).

Re: [Mod] Throwing Redo [throwing]

Posted: Tue Jan 17, 2017 22:45
by texmex
Palige wrote:Unfortunately, this is not possible, because the Minetest API does not provide any way to know whether a player is pressing the Q key (the only keys that the API can tell are those).
Oh, i see. Well, at least I can start of my sneak key based mod based on this information.

Re: [Mod] Throwing Redo [throwing]

Posted: Sun Jul 09, 2017 16:11
by texmex
Built my Sling mod with this API. Good stuff!

Re: [Mod] Throwing Redo [throwing]

Posted: Mon Sep 23, 2019 15:04
by Steamed_Punk
I just thought i would let you know that your mod README.lua states that:
* throw_itself (optional): whether the bow should throw itself instead of the arrow next to it in the inventory.
If present, allow_shot is ignored.
Default is false.
*Warning*: this field is not known to be currently used by a mod. If you encounter bugs using it, please open
an issue!
This is no longer the case. My mod contains a Tomahawk that can be thrown using the "throw_self" option.
Even if i wasn't the first to use this option i would still like to say "Merci"! Your mod works and does exactly what i need. This could be used for spears, rocks and why not water fights :D the possibilities are almost endless.

Re: [Mod] Throwing Redo [throwing]

Posted: Mon Sep 23, 2019 15:43
by Palige
Steamed_Punk wrote:This is no longer the case. My mod contains a Tomahawk that can be thrown using the "throw_self" option.
Even if i wasn't the first to use this option i would still like to say "Merci"! Your mod works and does exactly what i need. This could be used for spears, rocks and why not water fights :D the possibilities are almost endless.
Thanks! I've updated the README.md, and added mention of your mod :D

Re: [Mod] Throwing Redo [throwing]

Posted: Mon Sep 23, 2019 16:07
by Steamed_Punk
Palige wrote:
Steamed_Punk wrote:This is no longer the case. My mod contains a Tomahawk that can be thrown using the "throw_self" option.
Even if i wasn't the first to use this option i would still like to say "Merci"! Your mod works and does exactly what i need. This could be used for spears, rocks and why not water fights :D the possibilities are almost endless.
Thanks! I've updated the README.md, and added mention of your mod :D
Thanks for the mention i really appreciate it, although it wasn't necessary.