Commit Graph

61 Commits

Author SHA1 Message Date
SmallJoker dfc724fa06 Ensure Minetest 5.7.0 compatibility
The enforced type checking in Minetest revealed this incorrect API use.
2023-10-18 21:45:32 +02:00
Louis Royer 31f0cf5f86
Add toolranks_extras support (#25)
This displays `bow level x` instead of `tool level x` when toolranks is
enabled, and display `Arrows thrown` instead of `Node dug`.

* Add .luacheckrc and fixes warnings from luacheck
2020-08-14 17:33:20 +02:00
upsilon 4c50e6baec
Fix crash when the bow becomes fully worn
The crash only happened if toolranks was enabled.
2020-05-10 16:36:22 +02:00
upsilon 2d2368529f
Fix a typo causing a crash
Fixes #24
2020-04-27 10:49:00 +02:00
upsilon 0dd44bb30c
New physics 2020-04-02 17:17:31 +02:00
Louis Royer bd4d040c4e
Add toolrank optional support (#21)
* Add toolrank support

* Make bow shot able to level up the bow

* Add requested changes

* Change enable_toolranks to no_toolranks

* Remove the overwritting

* no_toolranks in defs in throwing.register_bow

* Toolranks support: minor changes
Reword documentation in README.md, fix a typo in init.lua and enable toolranks even if def.original_description exists---but do not overwrite it.

* Wait until the arrow hits its target before updating bow toolranks uses

* Add a throwing.toolranks settting to allow globally disabling toolranks

Co-authored-by: upsilon <upsilon@langg.net>
2020-04-02 16:11:42 +02:00
upsilon e2cb1286f1
Add throwing.make_arrow_def back for backwards compatibility, and make arrow_step public 2020-02-18 14:45:30 +01:00
upsilon edeba9de8b
Change default allow_shot function to allow items that throw itself to be thrown by default
This seems obvious, but wasn't the case
2020-02-16 18:38:49 +01:00
upsilon b9c78c92b2
Make the data table different for each arrow
I found myself discovering, while re-reading this code (and judging it not so readable, despite myself being its author), that data table of each arrow was in fact a single reference shared between all entities corresponding to an arrow of the same type.
I'm really sorry about this and the catastrophes it may have caused (e.g., it made it easy to duplicate an item using a drop arrow by throwing a random item, and then throwing the item to duplicate before the first arrow hit the ground: both arrows would then produce the stack that was thrown last). I hope no player discovered this on a server that used this mod.

(Also, I don't really see the point of the make_arrow_def function anymore, so I removed it. I wrote this too long ago to remember why I would write such code.)
2020-02-16 18:20:37 +01:00
upsilon 1449f49af7
Move craft registration from throwing to throwing_arrows 2020-02-11 20:01:13 +01:00
Panquesito7 ba63dea0b2 Replace deprecated functions with newer ones 2019-10-27 22:33:33 +01:00
upsilon 35442d8ac4 Revert "Merge throwing and throwing_arrows into a single modpack."
This reverts commit 8545ebb743.
2018-08-20 10:07:08 +02:00
upsilon 8545ebb743
Merge throwing and throwing_arrows into a single modpack. 2018-08-13 10:51:06 +02:00
Alexander Weber 90b85cdb2e support for wielded_light shining
supports also wielded_light.register_item_light("throwing:arrow", light_level) to set the light level
2018-05-09 06:47:31 +02:00
Alexander Weber be9d9753c4 avoid loop in is_arrow() function 2018-05-09 06:47:31 +02:00
Alexander Weber 7104780868 check drawtype="airlike" instead of just "air" 2018-05-09 06:47:31 +02:00
upsilon 042fe054e6
Fix operator precedence mistake 2018-01-05 18:46:59 +01:00
mgl512 dc45bfd616 Fix typo 2017-08-01 11:40:42 +02:00
mgl512 5542c62405 Bow crafting recipe: check for a name override
See #116
2017-08-01 11:15:56 +02:00
upsilon 3dc99c1fce
Split this mod between the API and the bows/arrows
Fixes #13
2017-07-09 18:52:25 +02:00
upsilon e9acbfa6d1
Tell the `allow_shot` function if it is its last run 2017-07-09 11:12:04 +02:00
upsilon 164bf6b5fc
Fix #11 2017-07-08 23:01:58 +02:00
upsilon b39b1b21c3
Prevent starting more than one bow delay at a time 2017-06-27 17:17:08 +02:00
upsilon 3db25456f2
Fix issue #9 2017-06-27 17:09:51 +02:00
upsilon 99e3ce6ed4
Call allow_shot twice
Once before the delay, and one after it
2017-06-25 09:59:35 +02:00
upsilon 973b3430e8
Replace deprecated settings methods 2017-06-23 13:12:11 +02:00
upsilon 094613eb29
Add a sound a delay to the bow 2017-06-21 17:29:20 +02:00
upsilon 000c16d292
Extend throwing.register_bow, change params order 2017-06-21 17:08:32 +02:00
upsilon df73f47285
Automatically fill the "item" field of the arrow luaentity if not existing 2017-06-21 10:51:20 +02:00
upsilon d7fae754f9
Add a spawn_arrow_entity field to the register_bow definition table 2017-06-21 10:39:59 +02:00
upsilon ba249807f1
Avoid arrows shown as unknown item while in air
Fixes #5
2017-06-20 21:37:04 +02:00
upsilon 05365af715
Add a public throwing.make_arrow_def function 2017-06-20 21:23:56 +02:00
upsilon 1be6638b56
Add a cooldown 2017-06-20 20:19:27 +02:00
upsilon 5f94a6b27d
Make arrows craftable again 2017-06-20 17:56:43 +02:00
upsilon 541f102b15
Add a "uses" field, add a gold bow 2017-06-20 17:32:00 +02:00
upsilon ccd667f9b7 Conserve custom definition parameters 2017-06-20 17:09:06 +02:00
upsilon 01c10dff75 Add a throw_itself field to throwing.register_bow definition table 2017-06-20 17:09:06 +02:00
upsilon d33a8b69ca
Make the on_hit field optional 2017-06-20 16:42:35 +02:00
upsilon 552b958dba
Check for the presence of a throwing_entity field in item definition table 2017-06-20 16:39:03 +02:00
upsilon a45399bfea
Allow external mod to choose the bow/arrow prefix 2017-06-20 16:29:36 +02:00
upsilon 1778b89597
Add an allow_shot field to throwing.register_bow definition table
And make the throwing.throw_arrow function able to throw any item
2017-06-20 16:25:34 +02:00
upsilon 4fe2a0c88c
Add a allow_protected definition parameter 2017-03-05 15:30:02 +01:00
upsilon 1351906574 Remove arrow object if it cannot be throw 2017-01-17 19:22:49 +01:00
upsilon 9179e12936 on_throw callback: Add a modulo by the main list size to calculate next_index 2017-01-17 19:16:19 +01:00
upsilon 307b2d60e6 Improve API again 2017-01-17 19:03:53 +01:00
upsilon c3ac46697b Improve the API by using definition tables.
This commit totally breaks retro-compatibility.
2017-01-17 17:43:10 +01:00
upsilon ba3838842b Improve the API
This commit breaks retro-compatibility. (Although not too much)
2017-01-17 16:32:30 +01:00
upsilon 709bb4ec16 Record protection violations 2017-01-15 13:05:05 +01:00
upsilon 13aaea70fa Fix some logging messages 2017-01-15 12:17:52 +01:00
upsilon ad966cf06d Crashfix: avoid last_pos to be nil when calling the on_hit function
should fix https://github.com/Mynetest/Mynetest-server/issues/64
2017-01-15 12:03:54 +01:00