Files
kiwistation/code/modules/awaymissions/away_props.dm
T
Jared-Fogle 45c14f6330 Adds SIGNAL_HANDLER and SIGNAL_HANDLER_DOES_SLEEP to prevent signal callbacks from blocking (#52761)
Adds SIGNAL_HANDLER, a macro that sets SHOULD_NOT_SLEEP(TRUE). This should ideally be required on all new signal callbacks.

Adds BLOCKING_SIGNAL_HANDLER, a macro that does nothing except symbolize "this is an older signal that didn't necessitate a code rewrite". It should not be allowed for new work.

This comes from discussion around #52735, which yields by calling input, and (though it sets the return type beforehand) will not properly return the flag to prevent attack from slapping.

To fix 60% of the yielding cases, WrapAdminProcCall no longer waits for another admin's proc call to finish. I'm not an admin, so I don't know how many behinds this has saved, but if this is problematic for admins I can just make it so that it lets you do it anyway. I'm not sure what the point of this babysitting was anyway.

Requested by @optimumtact.
Changelog

cl
admin: Calling a proc while another admin is calling one will no longer wait for the first to finish. You will simply just have to call it again.
/cl
2020-08-20 09:11:28 +12:00

120 lines
3.2 KiB
Plaintext

/obj/effect/oneway
name = "one way effect"
desc = "Only lets things in from it's dir."
icon = 'icons/effects/mapping_helpers.dmi'
icon_state = "field_dir"
invisibility = INVISIBILITY_MAXIMUM
anchored = TRUE
/obj/effect/oneway/CanAllowThrough(atom/movable/mover, turf/target)
. = ..()
var/turf/T = get_turf(src)
var/turf/MT = get_turf(mover)
return . && (T == MT || get_dir(MT,T) == dir)
/obj/effect/wind
name = "wind effect"
desc = "Creates pressure effect in it's direction. Use sparingly."
icon = 'icons/effects/mapping_helpers.dmi'
icon_state = "field_dir"
invisibility = INVISIBILITY_MAXIMUM
var/strength = 30
/obj/effect/wind/Initialize()
. = ..()
START_PROCESSING(SSobj,src)
/obj/effect/wind/process()
var/turf/open/T = get_turf(src)
if(istype(T))
T.consider_pressure_difference(get_step(T,dir),strength)
//Keep these rare due to cost of doing these checks
/obj/effect/path_blocker
name = "magic barrier"
desc = "You shall not pass."
icon = 'icons/effects/mapping_helpers.dmi'
icon_state = "blocker" //todo make this actually look fine when visible
anchored = TRUE
var/list/blocked_types = list()
var/reverse = FALSE //Block if path not present
/obj/effect/path_blocker/Initialize()
. = ..()
if(blocked_types.len)
blocked_types = typecacheof(blocked_types)
/obj/effect/path_blocker/CanAllowThrough(atom/movable/mover, turf/target)
. = ..()
if(blocked_types.len)
var/list/mover_contents = mover.GetAllContents()
for(var/atom/movable/thing in mover_contents)
if(blocked_types[thing.type])
return reverse
return !reverse
/obj/structure/pitgrate
name = "pit grate"
icon = 'icons/obj/smooth_structures/lattice.dmi'
icon_state = "lattice"
plane = FLOOR_PLANE
anchored = TRUE
obj_flags = CAN_BE_HIT | BLOCK_Z_OUT_DOWN | BLOCK_Z_IN_UP
var/id
var/open = FALSE
var/hidden = FALSE
/obj/structure/pitgrate/Initialize()
. = ..()
RegisterSignal(SSdcs,COMSIG_GLOB_BUTTON_PRESSED, .proc/OnButtonPressed)
if(hidden)
update_openspace()
/obj/structure/pitgrate/proc/OnButtonPressed(datum/source,obj/machinery/button/button)
SIGNAL_HANDLER
if(button.id == id) //No range checks because this is admin abuse mostly.
toggle()
/obj/structure/pitgrate/proc/update_openspace()
var/turf/open/transparent/openspace/T = get_turf(src)
if(!istype(T))
return
//Simple way to keep plane conflicts away, could probably be upgraded to something less nuclear with 513
T.invisibility = open ? 0 : INVISIBILITY_MAXIMUM
/obj/structure/pitgrate/proc/toggle()
open = !open
var/talpha
if(open)
talpha = 0
obj_flags &= ~(BLOCK_Z_OUT_DOWN | BLOCK_Z_IN_UP)
else
talpha = 255
obj_flags |= BLOCK_Z_OUT_DOWN | BLOCK_Z_IN_UP
plane = BYOND_LIGHTING_LAYER //What matters it's one above openspace, so our animation is not dependant on what's there. Up to revision with 513
animate(src,alpha = talpha,time = 10)
addtimer(CALLBACK(src,.proc/reset_plane),10)
if(hidden)
update_openspace()
var/turf/T = get_turf(src)
for(var/atom/movable/AM in T)
if(!AM.zfalling)
T.zFall(AM)
/obj/structure/pitgrate/proc/reset_plane()
plane = FLOOR_PLANE
/obj/structure/pitgrate/Destroy()
if(hidden)
open = TRUE
update_openspace()
. = ..()
/obj/structure/pitgrate/hidden
name = "floor"
icon = 'icons/turf/floors.dmi'
icon_state = "floor"
hidden = TRUE