De-snowflake thrown objects hitting turfs.

* Port of https://github.com/Baystation12/Baystation12/pull/16942
* Actually tell turfs when a thrown object hits them, and let them decide what to do about it!
  * We do this by calling hitby(), which is how it already works for obj and mob, so this makes behavior consistent.
* This allows us to cleanly solve the problem of a thrown object landing on open space without falling.
This commit is contained in:
Leshana
2017-04-13 22:09:46 -04:00
parent b5dbe8492c
commit ff3c5238aa
3 changed files with 14 additions and 6 deletions

View File

@@ -115,12 +115,7 @@
else if(isturf(hit_atom))
src.throwing = 0
var/turf/T = hit_atom
if(T.density)
spawn(2)
step(src, turn(src.last_move, 180))
if(istype(src,/mob/living))
var/mob/living/M = src
M.turf_collision(T, speed)
T.hitby(src,speed)
//decided whether a movable atom being thrown can pass through the turf it is in.
/atom/movable/proc/hit_check(var/speed)

View File

@@ -243,3 +243,11 @@ var/const/enterloopsanity = 100
/turf/proc/update_blood_overlays()
return
// Called when turf is hit by a thrown object
/turf/hitby(atom/movable/AM as mob|obj, var/speed)
if(src.density)
spawn(2)
step(AM, turn(AM.last_move, 180))
if(isliving(AM))
var/mob/living/M = AM
M.turf_collision(src, speed)

View File

@@ -36,6 +36,11 @@
..()
mover.fall()
// Called when thrown object lands on this turf.
/turf/simulated/open/hitby(var/atom/movable/AM, var/speed)
. = ..()
AM.fall()
/turf/simulated/open/proc/update()
below = GetBelow(src)
turf_changed_event.register(below, src, /turf/simulated/open/update_icon)