[Mod] X Bows [x_bows]

User avatar
SaKeL
Member
Posts: 742
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

[Mod] X Bows [x_bows]

by SaKeL » Post

Bow and Arrows [x_bows]

Adds bow and arrows to Minetest. The goal of this Mod is to make most complete single bow with arrow what will work with MTG damage system, time from last punch as simple as possible. Eventually due to the damage tiers in MTG additional arrows were added.

Thank you for all Mod creators of bow mods for inspiring this Mod.

Video

Image

Image

Features

* bow will force you sneak when loaded (optional dep. playerphysics)
* loaded bow will slightly adjust the player FOV
* bow uses minetest tool capabilities - if the bow is not loaded for long enough (time from last puch) the arrow will fly shorter range
* charged bow in inventory will discharge and give back the arrow when not selected
* arrow uses raycast
* arrow has chance of critical shots/hits (only on full punch interval)
* arrow uses minetest damage calculation (including 3d_armor) for making damage (no hardcoded values)
* arrows stick to nodes, players and entitites
* arrows remove them self from the world after some time
* arrows remove them self if there are already too many arrows attached to node, player, entity
* arrow continues to fly downwards when attached node is dug
* arrow flies under water for short period of time and then sinks
* arrows adjusts pitch when flying
* arrows can be picked up again after stuck in solid nodes
* registers only one entity reused for all arrows
* target block reduces fall damage by -30
* quiver for more arrow storage (can hold only arrows)
* quiver perks when in inventory (faster arrows, more arrow damage...)
* quiver shows temporarily its inventory in HUD overlay when loading or shooting (quickview)
* quiver item shows its content in infotext (hover over the item)
* X Bows API for creating custom shooters and projectiles
* 3d quiver shown in 3rd person view (compatible with 3d armor)

How To

Bow

With the bow selected in hotbar and in your hand, press right click on mouse (PC) or the same action as when placing blocks, to load the bow.
For bow to be loaded you have to have arrows in the arrow/quiver inventory - there should be extra tab in your inventory MOD to show arrow and quiver inventory slots.
Arrows and quivers in the players main inventory don't count and will not be used.
You have to have arrows and/or quiver in dedicated arrow/quiver inventory slots in order to charge the bow.
Charging bow will have slight sound effect and can be fired at any time with left click (PC)
or the same action as when you are digging a block. Waiting for full charge of the bow is recommended
as it will give the arrow full speed (maximum shooting distance) and chance for critical arrow (double damage).

There are few indications on how to know when the bow is fully charged:

* there is a distinct "click" sound
* each arrow has "charge time" in the description
* after shooting, arrow will have particle trail

There are few indications on how to know when the arrow is a critical arrow:

* there is a distinct arrow flying sound
* after shooting, arrow will have red particle trail

If you shoot the arrow before the bow is fully charged the speed/distance will be lower and no arrow particle trail will be shown (also no chance for critical arrow).
Changing the selection in hotbar will unload the bow and give you back arrow from the unloaded bow - this applies also when login in to the game (bow will be discharged and arrow will be returned to inventory) and also when you drop the charged arrow (discharged bow will be dropped with arrow item).
If you have `playerphysics` or `player_monoids` mod installed, charged bow will slow you down until you release the arrow.

Quiver

Quiver item can hold inventory of arrows. When player has quiver in his/hers quiver inventory slot - there should be extra tab in your inventory MOD to show arrow and quiver inventory slots, bow can take arrows from quiver, otherwise arrows outside of the quiver are used to load the bow.
Though, if arrows from quiver are used to load the bow, the arrows have additional speed and damage.
If we are loading/shooting arrows from quiver, there is temporary quickview HUD overlay shown, peeking in to the quivers inventory from which the arrow was taken. Arrows used from quiver will be faster only when the bow is fully charged - see "How To - Bow" for more information on how to know when bow is fully charged.

There are few indications on how to know when the bow shot arrow from quiver:

* there is temporary HUD overview shown peeking in to the quiver inventory
* after shooting, arrow will have blue/purple particle trail (if bow was fully charged)

Dependencies

* none

Optional Dependencies

- default (recipes)
- farming (bow and target recipes)
- 3d_armor (calculates damage including the armor)
- mesecons (target can be used to trigger mesecon signal)
- playerphysics (force sneak when holding charged bow)
- player_monoids (force sneak when holding charged bow)
- wool (quiver recipe)
- i3
- unified_inventory
- simple_skins
- u_skins
- wardrobe
- sfinv
- skinsdb
- player_api (shows 3d quiver)

License
Code
GNU Lesser General Public License v2.1 or later (see included LICENSE file)

Image

Image

Image
Attachments
screenshot.4.png
screenshot.4.png (136.62 KiB) Viewed 3340 times
screenshot-1280.png
screenshot-1280.png (802.36 KiB) Viewed 3889 times
Last edited by SaKeL on Thu Nov 10, 2022 16:05, edited 12 times in total.

User avatar
cx384
Member
Posts: 653
Joined: Wed Apr 23, 2014 09:38
GitHub: cx384
IRC: cx384

Re: [Mod] X Bows [x_bows]

by cx384 » Post

This mod uses items from the default mod for crafting. So I think you should at least add default to the optional dependencies like you did with farming. Otherwise great mod, I like the sounds.
Can your read this?

User avatar
SaKeL
Member
Posts: 742
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: [Mod] X Bows [x_bows]

by SaKeL » Post

Ah you are correct good catch. 👍

User avatar
daret
Member
Posts: 136
Joined: Tue Nov 12, 2019 20:36
GitHub: daretmavi
In-game: Daretmavi

Re: [Mod] X Bows [x_bows]

by daret » Post

Finally good bow mod with working arrows.
Great work.

User avatar
duckgo
Member
Posts: 205
Joined: Sun Sep 20, 2020 08:01
In-game: duckgo
Contact:

Re: [Mod] X Bows [x_bows]

by duckgo » Post

this mod is fantastic, thanks XD

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

Re: [Mod] X Bows [x_bows]

by Bastrabun » Post

That's exactly what I wanted. Nice! You even thought of arrows losing strength under water :)

Is it on purpose that you can have multiple loaded bows in the inventory?
Whatever I say is CC0

User avatar
SaKeL
Member
Posts: 742
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: [Mod] X Bows [x_bows]

by SaKeL » Post

If you mean multiple loaded bows in multiple inventory slots then yes.

Jackknife
Member
Posts: 189
Joined: Fri Sep 25, 2020 20:07

Re: [Mod] X Bows [x_bows]

by Jackknife » Post

I ran across an interesting bug, when using the anvil mod it duplicates the wooden
bow when I go to repair it.

User avatar
SaKeL
Member
Posts: 742
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: [Mod] X Bows [x_bows]

by SaKeL » Post

@Jackknife this sound like issue in the anvil mod you are using, can you send the link to the anvil mod?

Jackknife
Member
Posts: 189
Joined: Fri Sep 25, 2020 20:07

Re: [Mod] X Bows [x_bows]

by Jackknife » Post


User avatar
SaKeL
Member
Posts: 742
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: [Mod] X Bows [x_bows]

by SaKeL » Post

@Jackknife fixed in x_bows mod, this should not be an issue after you update the mod. Thank you for pointing out this bug.

Jackknife
Member
Posts: 189
Joined: Fri Sep 25, 2020 20:07

Re: [Mod] X Bows [x_bows]

by Jackknife » Post

Works great now

ViniProTheBro
New member
Posts: 1
Joined: Tue Jul 13, 2021 08:11
In-game: ViniProTheBro

Re: [Mod] X Bows [x_bows]

by ViniProTheBro » Post

Since i dont know where if there even is a github for this i will just ask it here, Is there a fix for the crashes when a player is hit and if yes where can i get it?

User avatar
SaKeL
Member
Posts: 742
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: [Mod] X Bows [x_bows]

by SaKeL » Post

ViniProTheBro wrote:
Tue Jul 13, 2021 08:17
Since i dont know where if there even is a github for this i will just ask it here, Is there a fix for the crashes when a player is hit and if yes where can i get it?
Source code and issue tracker can be found on ContentDB here (link also in the description above) https://content.minetest.net/packages/SaKeL/x_bows/

You are the first who is mentioning such a crash. I can have a look in to it if I can reproduce it but could you in the meanwhile share the stack trace error when the crash happens?

wsor4035
Member
Posts: 182
Joined: Sun Aug 11, 2019 21:23
GitHub: wsor4035
IRC: wsor
In-game: wsor

Re: [Mod] X Bows [x_bows]

by wsor4035 » Post

j5uBLfc6NxgersvVj5D5dIsiKDkoQb0o

User avatar
SevenRichieWhite
New member
Posts: 9
Joined: Fri Jun 05, 2020 00:25
IRC: SevenRichieWhite
In-game: SevenRichieWhite
Location: Germany

Re: [Mod] X Bows [x_bows]

by SevenRichieWhite » Post

is there a way to register another bows? :)

ronoaldo
Member
Posts: 177
Joined: Mon Dec 07, 2020 01:04
GitHub: ronoaldo
IRC: ronoaldo
In-game: RonoaldoKakashi
Location: São Paulo, Brasil
Contact:

Re: [Mod] X Bows [x_bows]

by ronoaldo » Post

One player reported that, after using the bow, the binoculars don't work. I tested and it says that the zoom is disabled by a mod, right after using the bow, but not before.

I was looking at the source code and it looks like the logic in the global step is not resetting the FOV, but instead, keeping it replaced:

At line 343 in the source code (https://bitbucket.org/minetest_gamers/x ... #lines-343), it says player:set_fov(1, true, 0.4) but I believe that it should be set to zero according to this: https://minetest.gitlab.io/minetest/cla ... er-objects

Code: Select all

-- sneak, fov adjustments when bow is charged
minetest.register_globalstep(function(dtime)
	bow_charged_timer = bow_charged_timer + dtime

	if bow_charged_timer > 0.5 then
		for _, player in ipairs(minetest.get_connected_players()) do
			local name = player:get_player_name()
			local stack = player:get_wielded_item()
			local item = stack:get_name()

			if not item then
				return
			end

			if not x_bows.player_bow_sneak[name] then
				x_bows.player_bow_sneak[name] = {}
			end

			if item == 'x_bows:bow_wood_charged' and not x_bows.player_bow_sneak[name].sneak then
				if minetest.get_modpath('playerphysics') then
					playerphysics.add_physics_factor(player, 'speed', 'x_bows:bow_wood_charged', 0.25)
				end

				x_bows.player_bow_sneak[name].sneak = true
				player:set_fov(0.9, true, 0.4)
			elseif item ~= 'x_bows:bow_wood_charged' and x_bows.player_bow_sneak[name].sneak then
				if minetest.get_modpath('playerphysics') then
					playerphysics.remove_physics_factor(player, 'speed', 'x_bows:bow_wood_charged')
				end

				x_bows.player_bow_sneak[name].sneak = false
				player:set_fov(1, true, 0.4)
			end
		end

		bow_charged_timer = 0
	end
end)
Servers: Mercurio | Tools: ContentDB CLI | Mods: minenews

ronoaldo
Member
Posts: 177
Joined: Mon Dec 07, 2020 01:04
GitHub: ronoaldo
IRC: ronoaldo
In-game: RonoaldoKakashi
Location: São Paulo, Brasil
Contact:

Re: [Mod] X Bows [x_bows]

by ronoaldo » Post

I can confirm that changing that particular line to zero fixes the interaction with the binoculars (zoom).
Servers: Mercurio | Tools: ContentDB CLI | Mods: minenews

Jackknife
Member
Posts: 189
Joined: Fri Sep 25, 2020 20:07

Re: [Mod] X Bows [x_bows]

by Jackknife » Post

I have come across an issue. I'm using the latest version of Minetest.

2022-03-10 17:13:36: ACTION[Server]: singleplayer uses x_bows:bow_wood_charged, pointing at [nothing]
2022-03-10 17:13:36: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'x_bows' in callback item_OnUse(): Invalid float vector dimension range 'x' (expected -2.14748e+06 < x < 2.14748e+06 got -5.6633e+06).
2022-03-10 17:13:36: ERROR[Main]: stack traceback:
2022-03-10 17:13:36: ERROR[Main]: [C]: in function 'set_velocity'
2022-03-10 17:13:36: ERROR[Main]: ...wnloads\minetest-5.5.0-win64\bin\..\mods\x_bows\init.lua:214: in function <...wnloads\minetest-5.5.0-win64\bin\..\mods\x_bows\init.lua:157>

Murphy
New member
Posts: 1
Joined: Mon Mar 14, 2022 07:47

Re: [Mod] X Bows [x_bows]

by Murphy » Post

that's what i need

Jackknife
Member
Posts: 189
Joined: Fri Sep 25, 2020 20:07

Re: [Mod] X Bows [x_bows]

by Jackknife » Post

Is this mod still being developed?

Jackknife
Member
Posts: 189
Joined: Fri Sep 25, 2020 20:07

Re: [Mod] X Bows [x_bows]

by Jackknife » Post

2022-04-19 15:18:30: ACTION[Server]: singleplayer uses x_bows:bow_wood_charged, pointing at [nothing]
2022-04-19 15:18:30: ERROR[Main]: ServerError: AsyncErr: Lua: Runtime error from mod 'x_bows' in callback item_OnUse(): Invalid float vector dimension range 'x' (expected -2.14748e+06 < x < 2.14748e+06 got 1.1469e+07).
2022-04-19 15:18:30: ERROR[Main]: stack traceback:
2022-04-19 15:18:30: ERROR[Main]: [C]: in function 'set_velocity'
2022-04-19 15:18:30: ERROR[Main]: ...wnloads\minetest-5.5.0-win64\bin\..\mods\x_bows\init.lua:214: in function <...wnloads\minetest-5.5.0-win64\bin\..\mods\x_bows\init.lua:157>

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

Re: [Mod] X Bows [x_bows]

by Bastrabun » Post

This happens when you load an arrow, keep the bow loaded, then stop the server, restart the server and then immediately fire the arrow. We had that, too:

https://gitea.your-land.de/your-land/bu ... ssues/1251
Whatever I say is CC0

Jackknife
Member
Posts: 189
Joined: Fri Sep 25, 2020 20:07

Re: [Mod] X Bows [x_bows]

by Jackknife » Post

It only acted up on one of my worlds but not the others. That’s the one thing I couldn’t figure out. I thought it was another mod causing it to crash

Jackknife
Member
Posts: 189
Joined: Fri Sep 25, 2020 20:07

Re: [Mod] X Bows [x_bows]

by Jackknife » Post

Is there a chance for crossbows to be added at a later update?

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 15 guests