Files
Bubberstation/code/datums/components/hot_ice.dm
SkyratBot e65a48e91f [MIRROR] Adds SIGNAL_HANDLER and SIGNAL_HANDLER_DOES_SLEEP to prevent signal callbacks from blocking (#430)
* 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

* Adds SIGNAL_HANDLER and SIGNAL_HANDLER_DOES_SLEEP to prevent signal callbacks from blocking

Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com>
2020-08-19 20:17:28 -04:00

41 lines
1.2 KiB
Plaintext

/datum/component/hot_ice
var/gas_name
var/gas_amount
var/temp_amount
/datum/component/hot_ice/Initialize(gas_name, gas_amount, temp_amount)
src.gas_name = gas_name
src.gas_amount = gas_amount
src.temp_amount = temp_amount
RegisterSignal(parent, COMSIG_PARENT_ATTACKBY, .proc/attackby_react)
RegisterSignal(parent, COMSIG_ATOM_FIRE_ACT, .proc/flame_react)
/datum/component/hot_ice/UnregisterFromParent()
UnregisterSignal(parent, COMSIG_PARENT_ATTACKBY)
UnregisterSignal(parent, COMSIG_ATOM_FIRE_ACT)
/datum/component/hot_ice/proc/hot_ice_melt(mob/user)
var/turf/open/T = get_turf(parent)
T.atmos_spawn_air("[gas_name]=[gas_amount];TEMP=[temp_amount]")
message_admins("Hot Ice ignited by [ADMIN_LOOKUPFLW(user)] in [ADMIN_VERBOSEJMP(T)]")
log_game("Hot Ice ignited by [key_name(user)] in [AREACOORD(T)]")
if(isturf(parent))
var/turf/K = parent
K.ScrapeAway(1, CHANGETURF_INHERIT_AIR)
else
qdel(parent)
/datum/component/hot_ice/proc/flame_react(datum/source, exposed_temperature, exposed_volume)
SIGNAL_HANDLER
if(exposed_temperature > T0C + 100)
hot_ice_melt()
/datum/component/hot_ice/proc/attackby_react(datum/source, obj/item/thing, mob/user, params)
SIGNAL_HANDLER
if(thing.get_temperature())
hot_ice_melt(user)