[MIRROR] Refactors move procs to support multitle objects (#6423)

* Refactors move procs to support multitle objects

* Update _blob.dm

Co-authored-by: Rohesie <rohesie@gmail.com>
Co-authored-by: Gandalf <jzo123@hotmail.com>
This commit is contained in:
SkyratBot
2021-06-22 22:40:04 +01:00
committed by GitHub
co-authored by Rohesie Gandalf
parent 3d784d4c1e
commit d85a02babd
82 changed files with 349 additions and 300 deletions
+7 -5
View File
@@ -39,16 +39,16 @@
else
RegisterSignal(get_turf(target), COMSIG_ATOM_ENTERED, .proc/on_entered)
/datum/element/caltrop/proc/on_entered(atom/caltrop, atom/movable/AM)
/datum/element/caltrop/proc/on_entered(datum/source, atom/movable/arrived, direction)
SIGNAL_HANDLER
if(!prob(probability))
return
if(!ishuman(AM))
if(!ishuman(arrived))
return
var/mob/living/carbon/human/H = AM
var/mob/living/carbon/human/H = arrived
if(HAS_TRAIT(H, TRAIT_PIERCEIMMUNE))
return
@@ -88,8 +88,10 @@
if(!(flags & CALTROP_SILENT) && !H.has_status_effect(/datum/status_effect/caltropped))
H.apply_status_effect(/datum/status_effect/caltropped)
H.visible_message(span_danger("[H] steps on [caltrop]."), \
span_userdanger("You step on [caltrop]!"))
H.visible_message(
span_danger("[H] steps on [source]."),
span_userdanger("You step on [source]!")
)
H.apply_damage(damage, BRUTE, picked_def_zone, wound_bonus = CANT_WOUND)
H.Paralyze(60)
+17 -11
View File
@@ -11,26 +11,32 @@
return ELEMENT_INCOMPATIBLE
RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/on_target_move)
var/atom/movable/movable_target = target
if(isturf(movable_target.loc))
var/turf/turf_loc = movable_target.loc
if(!isturf(movable_target.loc))
return
for(var/turf/turf_loc as anything in movable_target.locs)
turf_loc.add_opacity_source(target)
/datum/element/light_blocking/Detach(atom/movable/target)
/datum/element/light_blocking/Detach(datum/target)
. = ..()
UnregisterSignal(target, list(COMSIG_MOVABLE_MOVED))
var/atom/movable/movable_target = target
if(isturf(movable_target.loc))
var/turf/turf_loc = movable_target.loc
if(!isturf(movable_target.loc))
return
for(var/turf/turf_loc as anything in movable_target.locs)
turf_loc.remove_opacity_source(target)
///Updates old and new turf loc opacities.
/datum/element/light_blocking/proc/on_target_move(atom/movable/source, atom/OldLoc, Dir, Forced = FALSE)
/datum/element/light_blocking/proc/on_target_move(atom/movable/source, atom/old_loc, dir, forced, list/old_locs)
SIGNAL_HANDLER
if(isturf(OldLoc))
var/turf/old_turf = OldLoc
old_turf.remove_opacity_source(source)
if(isturf(old_loc))
if(old_locs)
for(var/turf/old_turf as anything in old_locs)
old_turf.remove_opacity_source(source)
else
var/turf/old_turf = old_loc
old_turf.remove_opacity_source(source)
if(isturf(source.loc))
var/turf/new_turf = source.loc
new_turf.add_opacity_source(source)
for(var/turf/new_turf as anything in source.locs)
new_turf.add_opacity_source(source)