Far Bows [farbows] + Raycast Bows API [rcbows] (1.15-2.2)

u18398

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.8.2)

by u18398 » Post

adding explosive effect to rcbows:

starting line 185, init.lua

Code: Select all

if minetest.registered_items[name].walkable then
						minetest.item_drop(ItemStack(def.drop or def.inventory_arrow), nil, vector.round(self.old_pos))
						self.waiting_for_removal = true
						self.object:remove()
						if def.effects and def.effects.replace_node and not(minetest.is_protected(pos, self.shooter_name)) then
							minetest.set_node(pos, {name = def.effects.replace_node})
						end
						if def.effects and def.effects.boom and not(minetest.is_protected(pos, self.shooter_name)) then
	                                tnt.boom(pos,{description = "BOOM",radius = def.effects.boom})
						end
						return
					end
now you have a new boom effect for your arrow definitions :)
Just add one to an arrow in farbows

Code: Select all

rcbows.register_arrow("farbows:fire_arrow", {
	projectile_texture = "farbows_proyectile_arrow",
	damage = 7,
	inventory_arrow = {
		name = "farbows:inv_fire_arrow",
		description = S("Fire Arrow"),
		inventory_image = "farbows_arrow_fire.png",
	},
	drop = "farbows:inv_arrow",
	effects = {
		--replace_node = "fire:basic_flame",
       boom = 3, --the number is the radius of tnt explosion
		trail_particle = "farbows_particle_fire.png",
	}
})
That's it :)
Now fire arrows will explode if hittinng a node.

It should be added a dependency on tnt and checked if enable_tnt = true :)

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.8.2)

by runs » Post

v1.8.3 (rcbows)
- Added a "explosion" effect.
It requires "tnt" or "explosion" mod as an optional dependency.
It is a table in where to define:
- mod = "tnt" or "explosions",
- radius
- damage = It is "damage_radius" for the "tnt" mod or "strength" for "explosions"

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.8.3)

by runs » Post

v1.8.4
- (rcbows): Added a "no_drop" definition for the arrows for not drops at all.
- (farbows): Added a new "Explosive Arrow" to the "Flamming Bow". Now it requires the TNT mod.

u18398

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.8.3)

by u18398 » Post

runs wrote:v1.8.4
- (rcbows): Added a "no_drop" definition for the arrows for not drops at all.
- (farbows): Added a new "Explosive Arrow" to the "Flamming Bow". Now it requires the TNT mod.
BANG! :D

My map is a big hole now, that works perfectly.
What about an extinguisher arrow, to fight back all the fires and burning forests ? :)

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.8.3)

by runs » Post

Gundul wrote:
runs wrote:v1.8.4
- (rcbows): Added a "no_drop" definition for the arrows for not drops at all.
- (farbows): Added a new "Explosive Arrow" to the "Flamming Bow". Now it requires the TNT mod.
BANG! :D

My map is a big hole now, that works perfectly.
What about an extinguisher arrow, to fight back all the fires and burning forests ? :)
Good idea. I will implement.

u18398

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.8.4)

by u18398 » Post

I added a water effect to your api and also that
explosive and water arrows have effects too when
hitting other objects and not only if nodes.

I made a PR on github if you are interested. :)

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.8.4)

by runs » Post

I will check and if all OK I will merge it.

:-)

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.8.4)

by runs » Post

v1.9
- (rcbows): Added a water effect very suitable for extinguish flames (thanx to Gundul)
- (farbows): Added a "Water Arrow".

PD: Gundul, I've tweaked your code, I've created some functions for the effects, and now the water effect has to define the "flame_node" (for no hard dependency of the fire mod) and added an optional water "particles" effect to it too.

Code: Select all

rcbows.register_arrow("farbows:water_arrow", {
	projectile_texture = "farbows_water_arrow",
	damage = 2,
	inventory_arrow = {
		name = "farbows:inv_water_arrow",
		description = S("Water Arrow"),
		inventory_image = "farbows_arrow_water.png",
	},
	drop = "bucket:bucket_empty",
	effects = {
		trail_particle = "default_water.png",
		water = {
			radius = 5,
			flame_node = "fire:basic_flame",
			particles = true,
		},
	}
})

u18398

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.9)

by u18398 » Post

using farbows:bow_mese and farbows:inv_arrow crashes the game

Code: Select all

2020-05-07 19:23:43: WARNING[Server]: Undeclared global variable "no_drop" accessed at .minetest/mods/rcbows/init.lua:196
2020-05-07 19:23:43: ACTION[Main]: Server: Shutting down
2020-05-07 19:23:43: ACTION[Main]: IRC: Disconnected.
2020-05-07 19:23:44: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'default' in callback luaentity_Step(): .minetest/mods/rcbows/init.lua:208: attempt to index field 'effects' (a nil value)
2020-05-07 19:23:44: ERROR[Main]: stack traceback:
2020-05-07 19:23:44: ERROR[Main]:      .minetest/mods/rcbows/init.lua:208: in function </home/mars/.minetest/mods/rcbows/init.lua:135>

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.9.1)

by runs » Post

v1.9.1 [rcbows]
- Fixed a crash.

u18398

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.9.1)

by u18398 » Post

It is still crashing:

Code: Select all

2020-05-08 06:46:17: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback luaentity_Step(): .minetest/mods/rcbows/init.lua:248: attempt to index field 'effects' (a nil value)
2020-05-08 06:46:17: ERROR[Main]: stack traceback:
2020-05-08 06:46:17: ERROR[Main]:       .minetest/mods/rcbows/init.lua:248: in function 'boom_effect'
2020-05-08 06:46:17: ERROR[Main]:       .minetest/mods/rcbows/init.lua:170: in function <.minetest/mods/rcbows/init.lua:135>
I am using an older version of farbows, without the tnt arrows. But that should not be a problem for an api :)
Or did something change in the arrow or bow definition ?

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.9.1)

by runs » Post

Gundul wrote:
Fri May 08, 2020 16:38
It is still crashing:

Code: Select all

2020-05-08 06:46:17: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback luaentity_Step(): .minetest/mods/rcbows/init.lua:248: attempt to index field 'effects' (a nil value)
2020-05-08 06:46:17: ERROR[Main]: stack traceback:
2020-05-08 06:46:17: ERROR[Main]:       .minetest/mods/rcbows/init.lua:248: in function 'boom_effect'
2020-05-08 06:46:17: ERROR[Main]:       .minetest/mods/rcbows/init.lua:170: in function <.minetest/mods/rcbows/init.lua:135>
I am using an older version of farbows, without the tnt arrows. But that should not be a problem for an api :)
Or did something change in the arrow or bow definition ?
Yes, try the last version. The TNT stuff was when still in the WIP forum. Unfortunately the extinguish part introduced a bug too.

I mean this API should be stable now, and not touched ever, to avoid problems in the future. No more features, only fixes or Minetest new versions adaptions. :-)

u18398

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.9.1)

by u18398 » Post

runs wrote:
Fri May 08, 2020 22:12
Unfortunately the extinguish part introduced a bug too.
Oh really, which one ?

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.9.1)

by runs » Post

Gundul wrote:
Sat May 09, 2020 10:26
runs wrote:
Fri May 08, 2020 22:12
Unfortunately the extinguish part introduced a bug too.
Oh really, which one ?
Already Solved :-)

u18398

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.9.1)

by u18398 » Post

runs wrote:
Sat May 09, 2020 12:27
Already Solved :-)
Sorry but it is not.

Code: Select all

AsyncErr: ServerThread::run Lua: Runtime error from mod 'wildlife' in callback luaentity_Step(): .minetest/mods/rcbows/init.lua:248: attempt to index field 'effects' (a nil value)
stack traceback:
	.minetest/mods/rcbows/init.lua:248: in function 'boom_effect'
	.minetest/mods/rcbows/init.lua:170: in function <.minetest/mods/rcbows/init.lua:135>
On github you can see that you replaced an AND by an OR when checking for effect definition and ownership.
That was right to do.

But you forgot to do this also in the part when an arrow hits an object and not a node.
The AND must be also replaced by an OR.

And this was not introduced by adding the water effect to your api. the and/or issue was there before. I copy/pasted
your code from the node check part to the object check part.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.9.1)

by runs » Post

Gundul wrote:
Sat May 09, 2020 13:06
runs wrote:
Sat May 09, 2020 12:27
Already Solved :-)
Sorry but it is not.

Code: Select all

AsyncErr: ServerThread::run Lua: Runtime error from mod 'wildlife' in callback luaentity_Step(): .minetest/mods/rcbows/init.lua:248: attempt to index field 'effects' (a nil value)
stack traceback:
	.minetest/mods/rcbows/init.lua:248: in function 'boom_effect'
	.minetest/mods/rcbows/init.lua:170: in function <.minetest/mods/rcbows/init.lua:135>
On github you can see that you replaced an AND by an OR when checking for effect definition and ownership.
That was right to do.

But you forgot to do this also in the part when an arrow hits an object and not a node.
The AND must be also replaced by an OR.

And this was not introduced by adding the water effect to your api. the and/or issue was there before. I copy/pasted
your code from the node check part to the object check part.
You're right, solved now :-)

u18398

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.9.1)

by u18398 » Post

runs wrote:
Sat May 09, 2020 13:10


You're right, solved now :-)
Yes, thank you. Now it works again :)

User avatar
CaptainKlutz
New member
Posts: 2
Joined: Wed May 13, 2020 13:50
GitHub: CaptainKlutz
In-game: CaptainKlutz

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.9.1)

by CaptainKlutz » Post

Thank you for the excellent mod. I've been working on a fork of this for Civtest, you may want to check out the repository and the accompanying weapons and cherry pick some of my additions/fixes :) keep up the good work
Feature dev of Civtest: Github, Discord

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.9.1)

by runs » Post

CaptainKlutz wrote:
Wed May 13, 2020 14:00
Thank you for the excellent mod. I've been working on a fork of this for Civtest, you may want to check out the repository and the accompanying weapons and cherry pick some of my additions/fixes :) keep up the good work
Thanx. I will fix and add some of your tweaks.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.9.1)

by runs » Post

v1.10
- Added "stack_max" def for arrows.
- Support for animated particles on the trail particle.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.10)

by runs » Post

v1.11 [rcbows]

- Changed the sounds to other Open Source ones.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.11)

by runs » Post

v1.12 [rcbows]
- Fixed some things reported by luacheck. My commitment to quality is indisputable.

Merak
Member
Posts: 116
Joined: Sat Nov 05, 2016 20:34

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.12)

by Merak » Post

What determines what arrow is used?
How is the tripwire hook used?
It would be good if this info were somewhere besides this forum, such as a wiki page or
doc in-game help.

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.12)

by runs » Post

- README.md for help. Maybe not too much complete.
- Tripwire is for craft the crossbow only.
- Bow with multiple arroews uses the first ones of the list of arrows always. Remove the arrows (save them in chest) to use the other.
Now that I think about it, maybe it would be possible to implement it using the arrows of the hotbar from left to right in order. I'll try to make it so.

Merak
Member
Posts: 116
Joined: Sat Nov 05, 2016 20:34

Re: Far Bows [farbows] + Raycast Bows API [rcbows] (1.12)

by Merak » Post

runs wrote:
Mon May 18, 2020 13:12
README.md for help.
I had done that.
By experimentation, I have determined the following:
The wooden bow, mese bow, and crossbow can only shoot the normal arrow.
The flaming bow shoots the three other types or arrows.

Post Reply

Who is online

Users browsing this forum: No registered users and 40 guests