Fixing "walking down stairs shows falling message" (#47588)

* I'm too tired to even PR it atm.

* Update code/game/turfs/turf.dm

Co-Authored-By: Emmett Gaines <ninjanomnom@gmail.com>

* Update code/game/turfs/turf.dm

Co-Authored-By: Emmett Gaines <ninjanomnom@gmail.com>

* Update code/game/turfs/turf.dm

Co-Authored-By: Emmett Gaines <ninjanomnom@gmail.com>

* atom signal, not movable.
This commit is contained in:
Ghom
2019-11-07 17:26:43 +01:00
committed by Emmett Gaines
parent f8f3021ce4
commit f325b3e5a0
6 changed files with 28 additions and 11 deletions

View File

@@ -121,6 +121,9 @@
#define COMSIG_ATOM_ATTACK_HAND "atom_attack_hand" //from base of atom/attack_hand(): (mob/user)
#define COMSIG_ATOM_ATTACK_PAW "atom_attack_paw" //from base of atom/attack_paw(): (mob/user)
#define COMPONENT_NO_ATTACK_HAND 1 //works on all 3.
//This signal return value bitflags can be found in __DEFINES/misc.dm
#define COMSIG_ATOM_INTERCEPT_Z_FALL "movable_intercept_z_impact" //called for each movable in a turf contents on /turf/zImpact(): (atom/movable/A, levels)
/////////////////
#define COMSIG_ENTER_AREA "enter_area" //from base of area/Entered(): (/area)
@@ -144,7 +147,6 @@
#define COMSIG_TURF_HAS_GRAVITY "turf_has_gravity" //from base of atom/has_gravity(): (atom/asker, list/forced_gravities)
#define COMSIG_TURF_MULTIZ_NEW "turf_multiz_new" //from base of turf/New(): (turf/source, direction)
// /atom/movable signals
#define COMSIG_MOVABLE_PRE_MOVE "movable_pre_move" //from base of atom/movable/Moved(): (/atom)
#define COMPONENT_MOVABLE_BLOCK_PRE_MOVE 1

View File

@@ -463,3 +463,8 @@ GLOBAL_LIST_INIT(pda_styles, sortList(list(MONO, VT, ORBITRON, SHARE)))
#define BAD_ART 12.5
#define GOOD_ART 25
#define GREAT_ART 50
// possible bitflag return values of intercept_zImpact(atom/movable/AM, levels = 1) calls
#define FALL_INTERCEPTED (1<<0) //Stops the movable from falling further and crashing on the ground
#define FALL_NO_MESSAGE (1<<1) //Used to suppress the "[A] falls through [old_turf]" messages where it'd make little sense at all, like going downstairs.
#define FALL_STOP_INTERCEPTING (1<<2) //Used in situations where halting the whole "intercept" loop would be better, like supermatter dusting (and thus deleting) the atom.

View File

@@ -1177,7 +1177,7 @@
return filters[filter_data.Find(name)]
/atom/proc/intercept_zImpact(atom/movable/AM, levels = 1)
return FALSE
. |= SEND_SIGNAL(src, COMSIG_ATOM_INTERCEPT_Z_FALL, AM, levels)
///Sets the custom materials for an item.
/atom/proc/set_custom_materials(list/materials, multiplier = 1)

View File

@@ -111,7 +111,9 @@
T.ChangeTurf(/turf/open/openspace, flags = CHANGETURF_INHERIT_AIR)
/obj/structure/stairs/intercept_zImpact(atom/movable/AM, levels = 1)
return isTerminator()
. = ..()
if(isTerminator())
. |= FALL_INTERCEPTED | FALL_NO_MESSAGE
/obj/structure/stairs/proc/isTerminator() //If this is the last stair in a chain and should move mobs up
if(terminator_mode != STAIR_TERMINATOR_AUTOMATIC)

View File

@@ -141,12 +141,19 @@
/turf/proc/zAirOut(direction, turf/source)
return FALSE
/turf/proc/zImpact(atom/movable/A, levels = 1)
/turf/proc/zImpact(atom/movable/A, levels = 1, turf/prev_turf)
var/flags = NONE
var/mov_name = A.name
for(var/i in contents)
var/atom/thing = i
if(thing.intercept_zImpact(A, levels))
return FALSE
if(zFall(A, ++levels))
flags |= thing.intercept_zImpact(A, levels)
if(flags & FALL_STOP_INTERCEPTING)
break
if(prev_turf && !(flags & FALL_NO_MESSAGE))
prev_turf.visible_message("<span class='danger'>[mov_name] falls through [prev_turf]!</span>")
if(flags & FALL_INTERCEPTED)
return
if(zFall(A, ++levels, src))
return FALSE
A.visible_message("<span class='danger'>[A] crashes into [src]!</span>")
A.onZImpact(src, levels)
@@ -161,11 +168,10 @@
return FALSE
if(!force && (!can_zFall(A, levels, target) || !A.can_zFall(src, levels, target, DOWN)))
return FALSE
A.visible_message("<span class='danger'>[A] falls through [src]!</span>")
A.zfalling = TRUE
A.forceMove(target)
A.zfalling = FALSE
target.zImpact(A, levels)
target.zImpact(A, levels, src)
return TRUE
/turf/proc/handleRCL(obj/item/twohanded/rcl/C, mob/user)

View File

@@ -686,7 +686,9 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
Consume(AM)
/obj/machinery/power/supermatter_crystal/intercept_zImpact(atom/movable/AM, levels)
. = ..()
Bumped(AM)
. |= FALL_STOP_INTERCEPTING | FALL_INTERCEPTED
/obj/machinery/power/supermatter_crystal/proc/Consume(atom/movable/AM)
if(isliving(AM))