Notice: You will need MT 5.1.0 or newer to run this mod
This is my attempt at improving combat mechanics via raycasting.
This mod provides an api to easily add melee weapons like the following:
Code: Select all
w_api.register_weapon("w_api:sword", {
description = "Large Sword", --item description
inventory_image = "w_api_sword.png", --inventory image
primary_use = {
ent_bl = true, --if true multiple rays in the same swing cant 'hit' the same ent
crit_mp = 1.5, --value for damage to be multiplied by when the user gets a critical hit
kb_mp = 2, --value for knockback vector to be multiplied by
swing_delay = 0.3, --delay till start of swing [in seconds]
slash_dir = 0, --direction of weapon slash, "right" is left -> right, "left" is right -> left
dmg = 2, --the amount of damage to deal to the target object
delay = 0.1, --delay between each raycast [in seconds]
depth = 1, --how many ents any individual raycast can damage
range = 4, --range of weapon [in meters]
spread = 10, --offset between rays [in degrees]
amount = 4 --amount of total raycasts on either side of the center ray, set to 1 for only the center ray
}
})
Spoiler
Since 1.0.0:
- Knockback for entities and players per raycast, knockback is calculated by the hitters lookdir multiplied by the magnitude of the players velocity --todo, make knockback for each ray calculated by its dir
- Directional-slashes
- Customizable 'swing-arcs'
- Swing-delay per-weapon
- Swing-time per-weapon
- Option to be able to damage several mobs deep into a crowd
- Critical hits and settable multiplier
- Entity blacklisting
- Settable knockback multiplier
- New more logical names for some variables
- Partial secondary attack support
- Updated for complete secondary attack support since engine issue is fixed (ik im late)
- Fixed forum post documentation (wasn't up to date)
- Fixes?
Spoiler
- Would have finished this sooner if i hadn't procrastinated --check
- Crappy texture for example sword --check
- Commented out debug statements left in --check
Everything is licensed under MIT
Credits:
Special thanks to UMTD users Warr1024 --for helping me with some fancy-pants vector math to get me started and GreenDimond --for coming up with a solution to prevent sword spamming
Dependencies:
None!
Downloads:
Github Repo