[MIRROR] Converts the atmos senstive component over to connect_loc (#5376)

* Converts the atmos senstive component over to connect_loc (#58266)

* Makes all uses of atmos_senstive pass in mapload as context

* Converts atmos senstive to connect_loc, does some general cleanup to the element, and makes it check the state of the tile the thing is on assuming creation didn't happen as a part of map loading

* Updates connect loc to match the new arg list

* Converts the atmos senstive component over to connect_loc

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-05-01 09:44:09 +01:00
committed by GitHub
co-authored by LemonInTheDark
parent c38ebd6f6d
commit 7f083e7cb6
25 changed files with 68 additions and 96 deletions
+22 -18
View File
@@ -4,41 +4,46 @@
//Don't put it on things that tend to clump into one spot, you will cause lag spikes.
/datum/element/atmos_sensitive
element_flags = ELEMENT_DETACH
var/static/list/pass_on = list(COMSIG_TURF_EXPOSE = /atom/proc/check_atmos_process)
/datum/element/atmos_sensitive/Attach(datum/target)
/datum/element/atmos_sensitive/Attach(datum/target, mapload)
if(!isatom(target)) //How
return ELEMENT_INCOMPATIBLE
var/atom/to_track = target
if(isopenturf(to_track.loc))
to_track.RegisterSignal(to_track.loc, COMSIG_TURF_EXPOSE, /atom/proc/check_atmos_process)
RegisterSignal(to_track, COMSIG_MOVABLE_MOVED, .proc/handle_move)
to_track.AddElement(/datum/element/connect_loc, to_track, pass_on)
RegisterSignal(to_track, COMSIG_MOVABLE_MOVED, .proc/react_to_move)
if(!mapload && isopenturf(to_track.loc))
var/turf/open/new_open = to_track.loc
to_track.check_atmos_process(new_open, new_open.air, new_open.air.temperature) //Make sure you're properly registered
return ..()
/datum/element/atmos_sensitive/Detach(datum/source)
var/atom/us = source
us.UnregisterSignal(get_turf(us), COMSIG_TURF_EXPOSE)
us.RemoveElement(/datum/element/connect_loc, pass_on)
if(us.flags_1 & ATMOS_IS_PROCESSING_1)
us.atmos_end()
SSair.atom_process -= us
us.flags_1 &= ~ATMOS_IS_PROCESSING_1
return ..()
/datum/element/atmos_sensitive/proc/handle_move(datum/source, atom/movable/oldloc, direction, forced)
var/atom/microchipped_lad = source
microchipped_lad.UnregisterSignal(oldloc, COMSIG_TURF_EXPOSE)
if(isopenturf(microchipped_lad.loc))
var/turf/open/new_spot = microchipped_lad.loc
microchipped_lad.RegisterSignal(new_spot, COMSIG_TURF_EXPOSE, /atom/proc/check_atmos_process)
microchipped_lad.check_atmos_process(null, new_spot.air, new_spot.temperature) //Make sure you're properly registered
/datum/element/atmos_sensitive/proc/react_to_move(datum/source, atom/movable/oldloc, direction, forced)
SIGNAL_HANDLER
var/atom/atom_source = source
if(isopenturf(atom_source.loc))
var/turf/open/new_open = atom_source.loc
atom_source.check_atmos_process(new_open, new_open.air, new_open.air.temperature) //Make sure you're properly registered
/atom/proc/check_atmos_process(datum/source, datum/gas_mixture/air, exposed_temperature)
SIGNAL_HANDLER
if(should_atmos_process(air, exposed_temperature))
if(flags_1 & ATMOS_IS_PROCESSING_1)
return
SSair.atom_process += src
flags_1 |= ATMOS_IS_PROCESSING_1
else if(flags_1 & ATMOS_IS_PROCESSING_1)
atmos_end(air, exposed_temperature)
atmos_end()
SSair.atom_process -= src
flags_1 &= ~ATMOS_IS_PROCESSING_1
@@ -51,7 +56,7 @@
flags_1 &= ~ATMOS_IS_PROCESSING_1
return
if(!should_atmos_process(spot.air, spot.air.temperature)) //Things can change without a tile becoming active
atmos_end(spot.air, spot.air.temperature)
atmos_end()
SSair.atom_process -= src
flags_1 &= ~ATMOS_IS_PROCESSING_1
return
@@ -59,7 +64,7 @@
/turf/open/process_exposure()
if(!should_atmos_process(air, air.temperature))
atmos_end(air, air.temperature)
atmos_end()
SSair.atom_process -= src
flags_1 &= ~ATMOS_IS_PROCESSING_1
return
@@ -69,11 +74,10 @@
/atom/proc/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
return FALSE
///This is your process() proc
/atom/proc/atmos_expose(datum/gas_mixture/air, exposed_temperature)
return
///What to do when our requirements are no longer met. Null inputs are possible
/atom/proc/atmos_end(datum/gas_mixture/air, exposed_temperature)
///What to do when our requirements are no longer met
/atom/proc/atmos_end()
return
+2 -2
View File
@@ -211,9 +211,9 @@
icon = 'icons/obj/doors/airlocks/station/plasma.dmi'
assemblytype = /obj/structure/door_assembly/door_assembly_plasma
/obj/machinery/door/airlock/plasma/ComponentInitialize()
/obj/machinery/door/airlock/plasma/Initialize(mapload)
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/machinery/door/airlock/plasma/proc/ignite(exposed_temperature)
if(exposed_temperature > 300)
+1 -1
View File
@@ -47,10 +47,10 @@
)
AddElement(/datum/element/connect_loc, src, loc_connections)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/machinery/door/window/ComponentInitialize()
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddComponent(/datum/component/ntnet_interface)
/obj/machinery/door/window/Destroy()
+3 -5
View File
@@ -51,12 +51,10 @@
update_appearance()
myarea = get_area(src)
LAZYADD(myarea.firealarms, src)
AddElement(/datum/element/atmos_sensitive, mapload)
RegisterSignal(SSsecurity_level, COMSIG_SECURITY_LEVEL_CHANGED, .proc/check_security_level)
/obj/machinery/firealarm/ComponentInitialize()
. = ..()
AddElement(/datum/element/atmos_sensitive)
/obj/machinery/firealarm/Destroy()
myarea.firereset(src)
LAZYREMOVE(myarea.firealarms, src)
@@ -138,7 +136,7 @@
update_appearance()
alarm()
/obj/machinery/firealarm/atmos_end(datum/gas_mixture/air, exposed_temperature)
/obj/machinery/firealarm/atmos_end()
if(!detecting)
return
if(triggered)
@@ -31,8 +31,8 @@
slippery_foam = FALSE
var/absorbed_plasma = 0
/obj/effect/particle_effect/foam/firefighting/ComponentInitialize()
..()
/obj/effect/particle_effect/foam/firefighting/Initialize(mapload)
. = ..()
RemoveElement(/datum/element/atmos_sensitive)
/obj/effect/particle_effect/foam/firefighting/process()
@@ -89,15 +89,12 @@
/obj/effect/particle_effect/foam/long_life
lifetime = 150
/obj/effect/particle_effect/foam/Initialize()
/obj/effect/particle_effect/foam/Initialize(mapload)
. = ..()
create_reagents(1000, REAGENT_HOLDER_INSTANT_REACT) //limited by the size of the reagent holder anyway. Works without instant possibly edit in future
START_PROCESSING(SSfastprocess, src)
playsound(src, 'sound/effects/bubbles2.ogg', 80, TRUE, -3)
/obj/effect/particle_effect/foam/ComponentInitialize()
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/effect/particle_effect/foam/ComponentInitialize()
. = ..()
+1 -4
View File
@@ -98,6 +98,7 @@
else //if on the floor, glowshroom on-floor sprite
icon_state = base_icon_state
AddElement(/datum/element/atmos_sensitive, mapload)
COOLDOWN_START(src, spread_cooldown, rand(min_delay_spread, max_delay_spread))
START_PROCESSING(SSobj, src)
@@ -107,10 +108,6 @@
GLOB.glowshrooms--
STOP_PROCESSING(SSobj, src)
/obj/structure/glowshroom/ComponentInitialize()
. = ..()
AddElement(/datum/element/atmos_sensitive)
/**
* Causes glowshroom spreading across the floor/walls.
*/
+2 -2
View File
@@ -7,9 +7,9 @@
density = FALSE
max_integrity = 15
/obj/structure/spider/ComponentInitialize()
/obj/structure/spider/Initialize(mapload)
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/structure/spider/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
if(damage_type == BURN)//the stickiness of the web mutes all attack sounds except fire damage type
+2 -2
View File
@@ -11,9 +11,9 @@
var/state
var/datum/gas_mixture/air_contents = null
/obj/item/latexballon/ComponentInitialize()
/obj/item/latexballon/Initialize(mapload)
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/item/latexballon/proc/blow(obj/item/tank/tank, mob/user)
if (icon_state == "latexballon_bursted")
@@ -156,10 +156,7 @@ GLOBAL_LIST_INIT(xeno_recipes, list ( \
/obj/item/stack/sheet/wethide/Initialize(mapload, new_amount, merge = TRUE, list/mat_override=null, mat_amt=1)
. = ..()
AddElement(/datum/element/dryable, /obj/item/stack/sheet/leather)
/obj/item/stack/sheet/wethide/ComponentInitialize()
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/*
* Leather SHeet
+1
View File
@@ -73,6 +73,7 @@
ion_trail.stop()
UnregisterSignal(user, COMSIG_MOVABLE_MOVED)
UnregisterSignal(user, COMSIG_MOVABLE_PRE_MOVE)
user.remove_movespeed_modifier(/datum/movespeed_modifier/jetpack/fullspeed)
/obj/item/tank/jetpack/proc/move_react(mob/user)
+3 -9
View File
@@ -145,7 +145,7 @@
var/static/list/blacklisted_turfs
/obj/structure/alien/weeds/Initialize()
/obj/structure/alien/weeds/Initialize(mapload)
pixel_x = -4
pixel_y = -4 //so the sprites line up right in the map editor
@@ -161,6 +161,7 @@
set_base_icon()
last_expand = world.time + rand(growth_cooldown_low, growth_cooldown_high)
AddElement(/datum/element/atmos_sensitive, mapload)
///Randomizes the weeds' starting icon, gets redefined by children for them not to share the behavior.
@@ -178,11 +179,6 @@
base_icon_state = "weeds3"
set_smoothed_icon_state(smoothing_junction)
/obj/structure/alien/weeds/ComponentInitialize()
. = ..()
AddElement(/datum/element/atmos_sensitive)
/obj/structure/alien/weeds/proc/expand()
var/turf/U = get_turf(src)
if(is_type_in_typecache(U, blacklisted_turfs))
@@ -286,9 +282,7 @@
if(status == BURST)
obj_integrity = integrity_failure * max_integrity
/obj/structure/alien/egg/ComponentInitialize()
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/structure/alien/egg/update_icon_state()
switch(status)
+2 -2
View File
@@ -244,9 +244,9 @@
smoothing_groups = list(SMOOTH_GROUP_WALLS, SMOOTH_GROUP_PLASMA_WALLS)
canSmoothWith = list(SMOOTH_GROUP_PLASMA_WALLS)
/obj/structure/falsewall/plasma/ComponentInitialize()
/obj/structure/falsewall/plasma/Initialize(mapload)
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/structure/falsewall/plasma/attackby(obj/item/W, mob/user, params)
if(W.get_temperature() > 300)
+2 -2
View File
@@ -18,9 +18,9 @@
var/grille_type = null
var/broken_type = /obj/structure/grille/broken
/obj/structure/grille/ComponentInitialize()
/obj/structure/grille/Initialize(mapload)
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/structure/grille/Destroy()
update_cable_icons_on_turf(get_turf(src))
@@ -249,9 +249,9 @@
icon_state = "plasma"
sheetType = /obj/item/stack/sheet/mineral/plasma
/obj/structure/mineral_door/transparent/plasma/ComponentInitialize()
/obj/structure/mineral_door/transparent/plasma/Initialize(mapload)
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/structure/mineral_door/transparent/plasma/welder_act(mob/living/user, obj/item/I)
return
+2 -2
View File
@@ -91,9 +91,9 @@
name = "statue of a scientist"
icon_state = "sci"
/obj/structure/statue/plasma/ComponentInitialize()
/obj/structure/statue/plasma/Initialize(mapload)
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/structure/statue/plasma/bullet_act(obj/projectile/Proj)
var/burn = FALSE
+3 -3
View File
@@ -67,6 +67,7 @@
flags_1 |= ALLOW_DARK_PAINTS_1
RegisterSignal(src, COMSIG_OBJ_PAINTED, .proc/on_painted)
AddElement(/datum/element/atmos_sensitive, mapload)
var/static/list/loc_connections = list(
COMSIG_ATOM_EXIT = .proc/on_exit,
@@ -77,8 +78,7 @@
/obj/structure/window/ComponentInitialize()
. = ..()
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ,null,CALLBACK(src, .proc/can_be_rotated),CALLBACK(src,.proc/after_rotation))
AddElement(/datum/element/atmos_sensitive)
AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ,null,CALLBACK(src, .proc/can_be_rotated),CALLBACK(src,.proc/after_rotation))
/obj/structure/window/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd)
switch(the_rcd.mode)
@@ -498,7 +498,7 @@
glass_type = /obj/item/stack/sheet/plasmaglass
rad_insulation = RAD_NO_INSULATION
/obj/structure/window/plasma/ComponentInitialize()
/obj/structure/window/plasma/Initialize(mapload, direct)
. = ..()
RemoveElement(/datum/element/atmos_sensitive)
@@ -125,7 +125,7 @@
/turf/open/temperature_expose(datum/gas_mixture/air, exposed_temperature)
SEND_SIGNAL(src, COMSIG_TURF_EXPOSE, air, exposed_temperature)
check_atmos_process(null, air, exposed_temperature) //Manually do this to avoid needing to use elements, don't want 200 second atom init times
check_atmos_process(src, air, exposed_temperature) //Manually do this to avoid needing to use elements, don't want 200 second atom init times
/turf/proc/archive()
temperature_archived = temperature
@@ -103,10 +103,7 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister())
pressure_limit = initial(pressure_limit) * (1 + 0.2 * random_quality)
update_appearance()
/obj/machinery/portable_atmospherics/canister/ComponentInitialize()
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/machinery/portable_atmospherics/canister/interact(mob/user)
. = ..()
+2 -2
View File
@@ -223,9 +223,9 @@
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = -10, ACID = 0) //It's made of plasma. Of course it's flammable.
custom_materials = list(/datum/material/plasma=1000)
/obj/item/clothing/accessory/medal/plasma/ComponentInitialize()
/obj/item/clothing/accessory/medal/plasma/Initialize(mapload)
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/item/clothing/accessory/medal/plasma/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
return exposed_temperature > 300
+2 -5
View File
@@ -332,13 +332,10 @@
var/datum/spacevine_controller/master = null
var/list/mutations = list()
/obj/structure/spacevine/Initialize()
/obj/structure/spacevine/Initialize(mapload)
. = ..()
add_atom_colour("#ffffff", FIXED_COLOUR_PRIORITY)
/obj/structure/spacevine/ComponentInitialize()
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/structure/spacevine/examine(mob/user)
. = ..()
@@ -35,9 +35,9 @@
var/attached = 0
/obj/item/clothing/mask/facehugger/ComponentInitialize()
/obj/item/clothing/mask/facehugger/Initialize(mapload)
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/item/clothing/mask/facehugger/lamarr
name = "Lamarr"
@@ -38,7 +38,7 @@
var/extinguish_fires = TRUE
var/stationary_mode = FALSE
/mob/living/simple_animal/bot/firebot/Initialize()
/mob/living/simple_animal/bot/firebot/Initialize(mapload)
. = ..()
ADD_TRAIT(src, TRAIT_SPACEWALK, INNATE_TRAIT)
update_appearance(UPDATE_ICON)
@@ -49,10 +49,7 @@
prev_access = access_card.access.Copy()
create_extinguisher()
/mob/living/simple_animal/bot/firebot/ComponentInitialize()
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/mob/living/simple_animal/bot/firebot/bot_reset()
create_extinguisher()
+2 -4
View File
@@ -284,6 +284,8 @@
/obj/machinery/power/apc/Initialize(mapload)
. = ..()
AddElement(/datum/element/atmos_sensitive, mapload)
if(!mapload)
return
has_electronics = APC_ELECTRONICS_SECURED
@@ -312,10 +314,6 @@
addtimer(CALLBACK(src, .proc/update), 5)
/obj/machinery/power/apc/ComponentInitialize()
. = ..()
AddElement(/datum/element/atmos_sensitive)
/obj/machinery/power/apc/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
return (exposed_temperature > 2000)
+1 -4
View File
@@ -357,6 +357,7 @@
cell = new/obj/item/stock_parts/cell/emergency_light(src)
RegisterSignal(src, COMSIG_LIGHT_EATER_ACT, .proc/on_light_eater)
AddElement(/datum/element/atmos_sensitive, mapload)
return INITIALIZE_HINT_LATELOAD
/obj/machinery/light/LateInitialize()
@@ -372,10 +373,6 @@
break_light_tube(1)
addtimer(CALLBACK(src, .proc/update, 0), 1)
/obj/machinery/light/ComponentInitialize()
. = ..()
AddElement(/datum/element/atmos_sensitive)
/obj/machinery/light/Destroy()
var/area/A = get_area(src)
if(A)
+2 -4
View File
@@ -173,7 +173,7 @@
/obj/item/radio/mech //this has to go somewhere
subspace_transmission = TRUE
/obj/vehicle/sealed/mecha/Initialize()
/obj/vehicle/sealed/mecha/Initialize(mapload)
. = ..()
if(enclosed)
internal_tank = new (src)
@@ -212,9 +212,7 @@
diag_hud_set_mechstat()
update_appearance()
/obj/mecha/ComponentInitialize()
. = ..()
AddElement(/datum/element/atmos_sensitive)
AddElement(/datum/element/atmos_sensitive, mapload)
/obj/vehicle/sealed/mecha/Destroy()
for(var/ejectee in occupants)