Commit Graph

53 Commits

Author SHA1 Message Date
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
upsilon
8a27df9c24 Fix calls to minetest.is_protected
The name parameter was not specified.
2017-01-13 18:04:41 +01:00
upsilon
a6ce9315b0 Many things:
* Use global variable throwing.modname instead of local modname
* Use minetest.place_node instead of minetest.set_node for torch arrow and build arrow
* Add an error return value to the on_hit function
2017-01-12 20:49:42 +01:00
upsilon
e7ae9a01cf Fix arrow placing issues 2017-01-12 19:17:51 +01:00
upsilon
318bf9e23c Add three settings
throwing.velocity_factor, throwing.horizontal_acceleration_factor, throwing.vertical_acceleration
2017-01-08 15:29:25 +01:00
upsilon
af35502e61 Use get_look_horizontal instead of deprecated get_look_yaw 2017-01-08 15:16:30 +01:00
upsilon
5a38a386eb Remove useless timer condition when checking if hitting the hitter 2017-01-08 10:35:53 +01:00
upsilon
15e57c0397 Another crash bugfix, for the same reason as in the previous commit 2017-01-07 18:48:59 +01:00
upsilon
6d84b5d63a Bugfix: arrow throwed on a player caused a crash 2017-01-07 18:36:06 +01:00