Adds Reach Variable to Weapons

Melee weapons can now potentially attack from farther away.
Obstacles are taken into account, so you cannot hit people through windows, but you can attack over specific things such as tables, or other people.
Currently only the spear can do this, with a range of two tiles, however the attack speed for the spear was reduced, so it may remain a situational weapon.
The intention for this is to make specific weapons feel different to each other besides 'does more damage', and I got ideas on other kinds of weapon adjustments later to make them feel a bit more unique.
This commit is contained in:
Neerti
2017-12-01 12:42:40 -05:00
parent c4e19538b0
commit 5796b14220
4 changed files with 16 additions and 3 deletions

View File

@@ -121,7 +121,7 @@
// A is a turf or is on a turf, or in something on a turf (pen in a box); but not something in something on a turf (pen in a box in a backpack)
sdepth = A.storage_depth_turf()
if(isturf(A) || isturf(A.loc) || (sdepth != -1 && sdepth <= 1))
if(A.Adjacent(src)) // see adjacent.dm
if(A.Adjacent(src) || (W && W.attack_can_reach(src, A, W.reach)) ) // see adjacent.dm
if(W)
// Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example)
var/resolved = W.resolve_attackby(A,src)