From a61b150fec4799d8639a70013ac9305c8fbe393d Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Sun, 29 Dec 2024 17:24:39 -0600 Subject: [PATCH] Small Optimizations (#3905) ## About The Pull Request Just some miscellaneous optimizations I've slowly been accumulating, centering around yet another rewrite of ImmediateCalculateAdjacentTurfs(). Others include jukeboxes, scrubbers, and lights, and also includes the elimination of a bunch of Destroy() side effects because those suck ## Why It's Good For The Game I don't know if this will actually do too much but every bit helps, and the code quality is hopefully a bit better ## Changelog :cl: fix: Jukeboxes should not leak across virtual Zs anymore fix: Candles can no longer be used like tiki torches tweak: Ore silos will now only drop materials when dissasembled or destroyed, instead of any deletion /:cl: --- code/__HELPERS/AStar.dm | 2 +- code/_onclick/hud/radial.dm | 2 +- code/controllers/subsystem/jukeboxes.dm | 58 ++++---- code/controllers/subsystem/overmap.dm | 2 +- code/controllers/subsystem/statpanel.dm | 2 +- code/datums/ai_laws.dm | 2 +- code/datums/components/_component.dm | 8 +- code/datums/components/remote_materials.dm | 10 +- code/datums/components/weatherannouncer.dm | 3 +- code/datums/datum.dm | 6 +- code/datums/map_zones.dm | 19 +++ code/game/machinery/cloning.dm | 5 +- code/game/machinery/doors/firedoor.dm | 4 +- code/game/machinery/gulag_item_reclaimer.dm | 5 +- code/game/machinery/slotmachine.dm | 2 +- .../effects/effect_system/effects_smoke.dm | 2 +- code/game/objects/effects/turf_fire.dm | 33 ++--- code/game/objects/items/blueprints.dm | 32 +++-- code/game/objects/items/candle.dm | 51 +++---- .../modules/antagonists/_common/antag_team.dm | 2 +- .../environmental/LINDA_system.dm | 135 +++++++++++------- .../components/unary_devices/vent_pump.dm | 8 +- .../components/unary_devices/vent_scrubber.dm | 56 +++----- .../machinery/portable/scrubber.dm | 2 +- code/modules/cargo/supplypod.dm | 5 +- code/modules/clothing/glasses/_glasses.dm | 2 +- code/modules/donator/_donator.dm | 2 +- code/modules/fishing/fishing_minigame.dm | 2 +- .../food_and_drinks/food/customizables.dm | 6 +- code/modules/food_and_drinks/food/snacks.dm | 2 +- .../kitchen_machinery/big_mortar.dm | 2 +- .../kitchen_machinery/cutting_board.dm | 2 +- .../kitchen_machinery/microwave.dm | 5 +- code/modules/interview/interview_manager.dm | 2 +- code/modules/lighting/lighting_atom.dm | 2 +- code/modules/mining/equipment/miningradio.dm | 1 + code/modules/mining/machine_silo.dm | 3 + .../carbon/alien/utilities/structures.dm | 2 +- .../carbon/human/species_types/jellypeople.dm | 2 +- .../mob/living/silicon/ai/robot_control.dm | 2 +- .../mob/living/simple_animal/bot/bot.dm | 2 +- .../mob/living/simple_animal/hostile/clown.dm | 2 +- .../simple_animal/hostile/retaliate/clown.dm | 2 +- .../computers/item/computer.dm | 14 +- .../computers/item/computer_ui.dm | 12 +- .../computers/item/tablet.dm | 6 +- code/modules/overmap/_overmap_datum.dm | 2 +- code/modules/overmap/docking_ticket.dm | 2 +- code/modules/power/port_gen.dm | 2 +- code/modules/power/power.dm | 2 +- code/modules/projectiles/gun.dm | 27 ++-- code/modules/projectiles/guns/energy.dm | 2 +- .../guns/energy/kinetic_accelerator.dm | 2 +- code/modules/projectiles/guns/energy/pulse.dm | 2 +- code/modules/reagents/chem_splash.dm | 15 +- code/modules/requests/requests_manager.dm | 2 +- code/modules/tgui/states/zlevel.dm | 2 +- code/modules/tgui/tgui_alert.dm | 4 +- code/modules/tgui/tgui_input_list.dm | 4 +- code/modules/vehicles/sealed.dm | 5 +- 60 files changed, 310 insertions(+), 294 deletions(-) diff --git a/code/__HELPERS/AStar.dm b/code/__HELPERS/AStar.dm index 68d30ca3b1bd..0e0de2a95326 100644 --- a/code/__HELPERS/AStar.dm +++ b/code/__HELPERS/AStar.dm @@ -104,7 +104,7 @@ Actual Adjacent procs : if(!start || !end) stack_trace("Invalid A* start or destination") return FALSE - if(start.virtual_z() != end.virtual_z() || start == end) //no pathfinding between z levels + if(start.virtual_z != end.virtual_z || start == end) //no pathfinding between z levels return FALSE if(maxnodes) //if start turf is farther than maxnodes from end turf, no need to do anything diff --git a/code/_onclick/hud/radial.dm b/code/_onclick/hud/radial.dm index 6bc47aa6bcb8..47867e56ede7 100644 --- a/code/_onclick/hud/radial.dm +++ b/code/_onclick/hud/radial.dm @@ -357,6 +357,6 @@ GLOBAL_LIST_EMPTY(radial_menus) /// If provided, will display an info button that will put this text in your chat var/info -/datum/radial_menu_choice/Destroy(force, ...) +/datum/radial_menu_choice/Destroy(force) . = ..() QDEL_NULL(image) diff --git a/code/controllers/subsystem/jukeboxes.dm b/code/controllers/subsystem/jukeboxes.dm index b0d774219a38..30757b947611 100644 --- a/code/controllers/subsystem/jukeboxes.dm +++ b/code/controllers/subsystem/jukeboxes.dm @@ -35,9 +35,7 @@ SUBSYSTEM_DEF(jukeboxes) var/sound/song_to_init = sound(T.song_path) song_to_init.status = SOUND_MUTE for(var/mob/M in GLOB.player_list) - if(!M.client) - continue - if(!(M.client.prefs.toggles & SOUND_INSTRUMENTS)) + if(!(M?.client.prefs.toggles & SOUND_INSTRUMENTS)) continue M.playsound_local(M, null, 100, channel = youvegotafreejukebox[2], S = song_to_init) @@ -88,9 +86,7 @@ SUBSYSTEM_DEF(jukeboxes) return ..() /datum/controller/subsystem/jukeboxes/fire() - if(!activejukeboxes.len) - return - for(var/list/jukeinfo in activejukeboxes) + for(var/list/jukeinfo as anything in activejukeboxes) if(!jukeinfo.len) stack_trace("Active jukebox without any associated metadata.") continue @@ -103,42 +99,38 @@ SUBSYSTEM_DEF(jukeboxes) stack_trace("Nonexistant or invalid object associated with jukebox.") continue var/sound/song_played = sound(juketrack.song_path) - var/area/currentarea = get_area(jukebox) var/turf/currentturf = get_turf(jukebox) - var/list/hearerscache = hearers(7, jukebox) - var/turf/above_turf = currentturf.above() - var/turf/below_turf = currentturf.below() + var/list/hearerscache = get_hearers_in_view(7, jukebox) + + var/datum/virtual_level/zone = currentturf.get_virtual_level() + var/turf/above_turf = zone.get_above_turf(currentturf) + var/turf/below_turf = zone.get_below_turf(currentturf) + + var/list/virtual_ids = list(zone.id) + var/list/areas = list(get_area(jukebox)) + if(above_turf && istransparentturf(above_turf)) + virtual_ids += above_turf.virtual_z + areas += get_area(above_turf) + if(below_turf && istransparentturf(below_turf)) + virtual_ids += below_turf.virtual_z + areas += get_area(below_turf) song_played.falloff = jukeinfo[4] - for(var/mob/M in GLOB.player_list) - if(!M.client) - continue - if(!(M.client.prefs.toggles & SOUND_INSTRUMENTS) || !M.can_hear()) + for(var/mob/M as anything in GLOB.player_list) + if(!(M.client?.prefs.toggles & SOUND_INSTRUMENTS) || !M.can_hear()) M.stop_sound_channel(jukeinfo[2]) continue var/inrange = FALSE - if(jukebox.z == M.z) //todo - expand this to work with mining planet z-levels when robust jukebox audio gets merged to master - song_played.status = SOUND_UPDATE - if(get_area(M) == currentarea) - inrange = TRUE - else if(M in hearerscache) - inrange = TRUE - else if(above_turf?.z == M.z) - song_played.status = SOUND_UPDATE - if(istransparentturf(above_turf) && (get_area(M) == get_area(above_turf))) - inrange = TRUE - else if(below_turf?.z == M.z) + if(jukebox.volume <= 0 || !(M.virtual_z() in virtual_ids)) + song_played.status = SOUND_MUTE | SOUND_UPDATE + else song_played.status = SOUND_UPDATE - if(istransparentturf(below_turf) && (get_area(M) == get_area(below_turf))) + if((get_area(M) in areas) || (M in hearerscache)) inrange = TRUE - else - song_played.status = SOUND_MUTE | SOUND_UPDATE //Setting volume = 0 doesn't let the sound properties update at all, which is lame. - - if(jukebox.volume <= 0) - song_played.status = SOUND_MUTE M.playsound_local(currentturf, null, jukebox.volume, channel = jukeinfo[2], S = song_played, envwet = (inrange ? -250 : 0), envdry = (inrange ? 0 : -10000)) - CHECK_TICK - return + + if(MC_TICK_CHECK) + return diff --git a/code/controllers/subsystem/overmap.dm b/code/controllers/subsystem/overmap.dm index b184d67c77a5..6e2d452f7507 100644 --- a/code/controllers/subsystem/overmap.dm +++ b/code/controllers/subsystem/overmap.dm @@ -2,7 +2,7 @@ SUBSYSTEM_DEF(overmap) name = "Overmap" wait = 10 init_order = INIT_ORDER_OVERMAP - flags = SS_KEEP_TIMING|SS_NO_TICK_CHECK + flags = SS_KEEP_TIMING runlevels = RUNLEVEL_SETUP | RUNLEVEL_GAME ///Defines which generator to use for the overmap diff --git a/code/controllers/subsystem/statpanel.dm b/code/controllers/subsystem/statpanel.dm index 6d6e9549d95f..2c90636638ee 100644 --- a/code/controllers/subsystem/statpanel.dm +++ b/code/controllers/subsystem/statpanel.dm @@ -298,7 +298,7 @@ SUBSYSTEM_DEF(statpanels) . = ..() src.parent = parent -/datum/object_window_info/Destroy(force, ...) +/datum/object_window_info/Destroy(force) atoms_to_show = null atoms_to_images = null atoms_to_imagify = null diff --git a/code/datums/ai_laws.dm b/code/datums/ai_laws.dm index ea947b463917..d4e801f31d89 100644 --- a/code/datums/ai_laws.dm +++ b/code/datums/ai_laws.dm @@ -16,7 +16,7 @@ var/mob/living/silicon/owner var/id = DEFAULT_AI_LAWID -/datum/ai_laws/Destroy(force, ...) +/datum/ai_laws/Destroy(force) if(!QDELETED(owner)) CRASH("AI lawset destroyed even though owner AI is not being destroyed.") owner = null diff --git a/code/datums/components/_component.dm b/code/datums/components/_component.dm index 695b6519f9c7..fffff3e9c12c 100644 --- a/code/datums/components/_component.dm +++ b/code/datums/components/_component.dm @@ -51,7 +51,7 @@ var/list/arguments = raw_args.Copy(2) if(Initialize(arglist(arguments)) == COMPONENT_INCOMPATIBLE) stack_trace("Incompatible [type] assigned to a [parent.type]! args: [json_encode(arguments)]") - qdel(src, TRUE, TRUE) + qdel(src, TRUE) return _JoinParent(parent) @@ -69,15 +69,13 @@ * * Arguments: * * force - makes it not check for and remove the component from the parent - * * silent - deletes the component without sending a [COMSIG_COMPONENT_REMOVING] signal */ -/datum/component/Destroy(force=FALSE, silent=FALSE) +/datum/component/Destroy(force=FALSE) if(!parent) return ..() if(!force) _RemoveFromParent() - if(!silent) - SEND_SIGNAL(parent, COMSIG_COMPONENT_REMOVING, src) + SEND_SIGNAL(parent, COMSIG_COMPONENT_REMOVING, src) parent = null return ..() diff --git a/code/datums/components/remote_materials.dm b/code/datums/components/remote_materials.dm index 16c695fe9c06..8de76721ff26 100644 --- a/code/datums/components/remote_materials.dm +++ b/code/datums/components/remote_materials.dm @@ -23,6 +23,7 @@ handles linking back and forth. src.category = category src.allow_standalone = allow_standalone + RegisterSignal(parent, COMSIG_OBJ_DECONSTRUCT, PROC_REF(OnDeconstruct)) RegisterSignal(parent, COMSIG_PARENT_ATTACKBY, PROC_REF(OnAttackBy)) RegisterSignal(parent, COMSIG_ATOM_MULTITOOL_ACT, PROC_REF(OnMultitool)) @@ -35,12 +36,15 @@ handles linking back and forth. silo.updateUsrDialog() silo = null mat_container = null - else if (mat_container) + mat_container = null + return ..() + +/datum/component/remote_materials/proc/OnDeconstruct(disassembled) + SIGNAL_HANDLER + if(!silo && mat_container) // specify explicitly in case the other component is deleted first var/atom/P = parent mat_container.retrieve_all(P.drop_location()) - mat_container = null - return ..() /datum/component/remote_materials/proc/_MakeLocal() silo = null diff --git a/code/datums/components/weatherannouncer.dm b/code/datums/components/weatherannouncer.dm index 7da27dcbba2f..6cf4b566b84f 100644 --- a/code/datums/components/weatherannouncer.dm +++ b/code/datums/components/weatherannouncer.dm @@ -93,7 +93,8 @@ light.set_light_color(LIGHT_COLOR_YELLOW) if(WEATHER_ALERT_IMMINENT_OR_ACTIVE) light.set_light_color(LIGHT_COLOR_INTENSE_RED) - light.update_light() + if(light.light_system == STATIC_LIGHT) + light.update_light() /// Returns a string we should display to communicate what you should be doing /datum/component/weather_announcer/proc/get_warning_message() diff --git a/code/datums/datum.dm b/code/datums/datum.dm index 97da48745fae..fc7189738b33 100644 --- a/code/datums/datum.dm +++ b/code/datums/datum.dm @@ -85,7 +85,7 @@ * * Returns [QDEL_HINT_QUEUE] */ -/datum/proc/Destroy(force=FALSE, ...) +/datum/proc/Destroy(force) SHOULD_CALL_PARENT(TRUE) tag = null datum_flags &= ~DF_USE_TAG //In case something tries to REF us @@ -111,10 +111,10 @@ var/all_components = dc[/datum/component] if(length(all_components)) for(var/datum/component/component as anything in all_components) - qdel(component, FALSE, TRUE) + qdel(component, FALSE) else var/datum/component/C = all_components - qdel(C, FALSE, TRUE) + qdel(C, FALSE) dc.Cut() clear_signal_refs() diff --git a/code/datums/map_zones.dm b/code/datums/map_zones.dm index bf103242c8db..fe4b487f5c8b 100644 --- a/code/datums/map_zones.dm +++ b/code/datums/map_zones.dm @@ -562,6 +562,25 @@ var/abs_y = Turf.y - low_y return locate(up_linkage.low_x + abs_x, up_linkage.low_y + abs_y, up_linkage.z_value) +/datum/virtual_level/proc/get_zone_step(turf/source, direction) + // multiz dir is just the up/down dir flags + var/multiz_dir = direction & (UP|DOWN) + // while the passed dir is normalized to just the cardinals + direction &= ~(UP|DOWN) + var/turf/my_turf = get_step(source, direction) + if(isnull(my_turf)) + return + switch(multiz_dir) + // the old version of this code prioritized UP over DOWN when + // both were passed. i don't want to fuck with that, so here it is preserved + if(UP|DOWN) + return get_above_turf(my_turf) + if(UP) + return get_above_turf(my_turf) + if(DOWN) + return get_below_turf(my_turf) + return my_turf + /datum/virtual_level/proc/get_client_mobs() return get_alive_client_mobs() + get_dead_client_mobs() diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index ac34d49b847c..c6a276f4ff75 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -64,12 +64,9 @@ begin_processing() /obj/machinery/clonepod/Destroy() - var/mob/living/mob_occupant = occupant - go_out() - if(mob_occupant) - log_cloning("[key_name(mob_occupant)] ejected from [src] at [AREACOORD(src)] due to Destroy().") QDEL_NULL(radio) QDEL_NULL(countdown) + QDEL_NULL(occupant) if(connected) connected.DetachCloner(src) QDEL_LIST(unattached_flesh) diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 1ab88896accb..7cc692b1881c 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -72,7 +72,7 @@ /obj/machinery/door/firedoor/Destroy() remove_from_areas() density = FALSE - air_update_turf(1) + air_update_turf(TRUE) affecting_areas.Cut() return ..() @@ -430,7 +430,7 @@ if(operating || welded) return density = TRUE - air_update_turf(1) + air_update_turf(TRUE) do_animate("closing") update_freelook_sight() if(!(flags_1 & ON_BORDER_1)) diff --git a/code/game/machinery/gulag_item_reclaimer.dm b/code/game/machinery/gulag_item_reclaimer.dm index 81c422ea31fa..185120039dad 100644 --- a/code/game/machinery/gulag_item_reclaimer.dm +++ b/code/game/machinery/gulag_item_reclaimer.dm @@ -12,10 +12,13 @@ var/list/stored_items = list() var/obj/machinery/gulag_teleporter/linked_teleporter = null -/obj/machinery/gulag_item_reclaimer/Destroy() +/obj/machinery/gulag_item_reclaimer/deconstruct(disassembled) for(var/i in contents) var/obj/item/I = i I.forceMove(get_turf(src)) + return ..() + +/obj/machinery/gulag_item_reclaimer/Destroy() if(linked_teleporter) linked_teleporter.linked_reclaimer = null return ..() diff --git a/code/game/machinery/slotmachine.dm b/code/game/machinery/slotmachine.dm index 2038612c2791..6d73a0cf1020 100644 --- a/code/game/machinery/slotmachine.dm +++ b/code/game/machinery/slotmachine.dm @@ -55,7 +55,7 @@ var/obj/item/coin/C = cointype coinvalues["[cointype]"] = initial(C.value) -/obj/machinery/computer/slot_machine/Destroy() +/obj/machinery/computer/slot_machine/deconstruct(disassembled, mob/user) if(balance) give_payout(balance) return ..() diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm index 7fc59d075356..a9aab0a9bd9b 100644 --- a/code/game/objects/effects/effect_system/effects_smoke.dm +++ b/code/game/objects/effects/effect_system/effects_smoke.dm @@ -76,7 +76,7 @@ if(!t_loc) return var/list/newsmokes = list() - for(var/turf/T in t_loc.GetAtmosAdjacentTurfs()) + for(var/turf/T in t_loc.get_atmos_adjacent_turfs()) var/obj/effect/particle_effect/smoke/foundsmoke = locate() in T //Don't spread smoke where there's already smoke! if(foundsmoke) continue diff --git a/code/game/objects/effects/turf_fire.dm b/code/game/objects/effects/turf_fire.dm index 46baaf691e87..9dbcaa27034a 100644 --- a/code/game/objects/effects/turf_fire.dm +++ b/code/game/objects/effects/turf_fire.dm @@ -90,6 +90,18 @@ color = fire_color base_icon_state = "greyscale" + switch(base_icon_state) //switches light color depdning on the flame color + if("greyscale") + light_color = hex_color + if("red") + light_color = LIGHT_COLOR_FIRE + if("blue") + light_color = LIGHT_COLOR_CYAN + if("green") + light_color = LIGHT_COLOR_GREEN + else + light_color = COLOR_VERY_LIGHT_GRAY + open_turf.turf_fire = src START_PROCESSING(SSturf_fire, src) if(power) @@ -187,29 +199,18 @@ return current_fire_state = new_state - switch(base_icon_state) //switches light color depdning on the flame color - if("greyscale") - light_color = hex_color - if("red") - light_color = LIGHT_COLOR_FIRE - if("blue") - light_color = LIGHT_COLOR_CYAN - if("green") - light_color = LIGHT_COLOR_GREEN - else - light_color = COLOR_VERY_LIGHT_GRAY - update_light() - switch(current_fire_state) if(TURF_FIRE_STATE_SMALL) icon_state = "[base_icon_state]_small" - set_light_range(1.5) + light_range = 1.5 if(TURF_FIRE_STATE_MEDIUM) icon_state = "[base_icon_state]_medium" - set_light_range(2.5) + light_range = 2 if(TURF_FIRE_STATE_LARGE) icon_state = "[base_icon_state]_big" - set_light_range(3) + light_range = 3 + + update_light() #undef TURF_FIRE_REQUIRED_TEMP #undef TURF_FIRE_TEMP_BASE diff --git a/code/game/objects/items/blueprints.dm b/code/game/objects/items/blueprints.dm index 232b4570a97e..b165856ea198 100644 --- a/code/game/objects/items/blueprints.dm +++ b/code/game/objects/items/blueprints.dm @@ -214,22 +214,26 @@ sortTim(GLOB.sortedAreas, /proc/cmp_name_asc) return TRUE -/proc/set_area_machinery_title(area/A, title, oldtitle) +/proc/set_area_machinery_title(area/target, title, oldtitle) if(!oldtitle) // or replacetext goes to infinite loop return - for(var/obj/machinery/airalarm/M in A) - M.name = replacetext(M.name,oldtitle,title) - for(var/obj/machinery/power/apc/M in A) - M.name = replacetext(M.name,oldtitle,title) - for(var/obj/machinery/atmospherics/components/unary/vent_scrubber/M in A) - M.name = replacetext(M.name,oldtitle,title) - for(var/obj/machinery/atmospherics/components/unary/vent_pump/M in A) - M.name = replacetext(M.name,oldtitle,title) - for(var/obj/machinery/door/M in A) - M.name = replacetext(M.name,oldtitle,title) - for(var/obj/machinery/fax/M in A) - M.fax_name = replacetext(M.fax_name,oldtitle,title) - //TODO: much much more. Unnamed airlocks, cameras, etc. + + var/static/typecache = typecacheof(list( + /obj/machinery/airalarm, + /obj/machinery/power/apc, + /obj/machinery/atmospherics/components/unary/vent_scrubber, + /obj/machinery/atmospherics/components/unary/vent_pump, + /obj/machinery/door, + /obj/machinery/fax + )) + + for(var/obj/machinery/machine as anything in GLOB.machines) + if(get_area(machine) != target) + continue + if(!is_type_in_typecache(machine, typecache)) + continue + + machine.name = replacetext(machine.name,oldtitle,title) /obj/item/areaeditor/shuttle name = "shuttle expansion permit" diff --git a/code/game/objects/items/candle.dm b/code/game/objects/items/candle.dm index 595c798d4c9e..0ef172f08c58 100644 --- a/code/game/objects/items/candle.dm +++ b/code/game/objects/items/candle.dm @@ -1,4 +1,3 @@ -#define CANDLE_LUMINOSITY 2 /obj/item/candle name = "red candle" desc = "In Greek myth, Prometheus stole fire from the Gods and gave it to \ @@ -8,6 +7,10 @@ item_state = "candle1" w_class = WEIGHT_CLASS_TINY light_color = LIGHT_COLOR_FIRE + light_power = 0.8 + light_range = 2 + light_system = MOVABLE_LIGHT + light_on = FALSE heat = 1000 var/wax = 1000 var/lit = FALSE @@ -39,20 +42,22 @@ return lit * heat /obj/item/candle/proc/light(show_message) - if(!lit) - lit = TRUE - if(show_message) - usr.visible_message(show_message) - set_light(CANDLE_LUMINOSITY, 0.8) + if(lit) + return + lit = TRUE + if(show_message) + usr.visible_message(show_message) + set_light_on(TRUE) + if(!infinite) START_PROCESSING(SSobj, src) - update_appearance() + update_appearance() /obj/item/candle/proc/put_out_candle() if(!lit) return lit = FALSE update_appearance() - set_light(0) + set_light_on(FALSE) return TRUE /obj/item/candle/extinguish() @@ -62,8 +67,7 @@ /obj/item/candle/process() if(!lit) return PROCESS_KILL - if(!infinite) - wax-- + wax-- if(!wax) new /obj/item/trash/candle(loc) qdel(src) @@ -85,43 +89,22 @@ icon_state = "torch_unlit" item_state = "torch" w_class = WEIGHT_CLASS_BULKY - light_color = LIGHT_COLOR_FIRE + light_range = 7 infinite = TRUE heat = 2000 -/obj/item/candle/tribal_torch/attackby(obj/item/W, mob/user, params) - ..() - var/msg = W.ignition_effect(src, user) - if(msg) - light(msg) - set_light(7) - -/obj/item/candle/tribal_torch/fire_act(exposed_temperature, exposed_volume) - if(!src.lit) - light() //honk - set_light(7) - ..() - -/obj/item/candle/attack_self(mob/user) +/obj/item/candle/tribal_torch/attack_self(mob/user) if(!src.lit) to_chat(user, "You start pushing [src] into the ground...") if (do_after(user, 20, target=src)) qdel(src) new /obj/structure/destructible/tribal_torch(get_turf(user)) - light_color = LIGHT_COLOR_ORANGE user.visible_message("[user] plants \the [src] firmly in the ground.", "You plant \the [src] firmly in the ground.") return - else if(lit) - user.visible_message( - "[user] snuffs [src] out.") - lit = FALSE - update_appearance() - set_light(0) + return ..() /obj/item/candle/tribal_torch/update_appearance() icon_state = "torch[lit ? "_lit" : "_unlit"]" item_state = "torch[lit ? "-on" : ""]" return ..() - -#undef CANDLE_LUMINOSITY diff --git a/code/modules/antagonists/_common/antag_team.dm b/code/modules/antagonists/_common/antag_team.dm index 4a910ca4d441..0fcfb0109397 100644 --- a/code/modules/antagonists/_common/antag_team.dm +++ b/code/modules/antagonists/_common/antag_team.dm @@ -18,7 +18,7 @@ GLOBAL_LIST_EMPTY(antagonist_teams) else add_member(starting_members) -/datum/team/Destroy(force, ...) +/datum/team/Destroy(force) GLOB.antagonist_teams -= src . = ..() diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm index 7c324a3f517a..c2d7fbf1db86 100644 --- a/code/modules/atmospherics/environmental/LINDA_system.dm +++ b/code/modules/atmospherics/environmental/LINDA_system.dm @@ -31,62 +31,85 @@ . = FALSE /turf/proc/block_all_conductivity() - conductivity_blocked_directions |= NORTH | SOUTH | EAST | WEST | UP | DOWN + conductivity_blocked_directions |= ALL /atom/movable/proc/BlockThermalConductivity() // Objects that don't let heat through. return FALSE /turf/proc/ImmediateCalculateAdjacentTurfs() + conductivity_blocked_directions = 0 + + if(blocks_air) + for(var/turf/adj_turf as anything in get_atmos_cardinal_adjacent_turfs()) + LAZYREMOVE(adj_turf.atmos_adjacent_turfs, src) + adj_turf.conductivity_blocked_directions |= REVERSE_DIR(get_dir(src, adj_turf)) + adj_turf.__update_auxtools_turf_adjacency_info() + + //Clear all adjacent turfs + LAZYNULL(atmos_adjacent_turfs) + conductivity_blocked_directions = ALL + + __update_auxtools_turf_adjacency_info() + return + var/canpass = CANATMOSPASS(src, src) var/canvpass = CANVERTICALATMOSPASS(src, src) - conductivity_blocked_directions = 0 - - var/src_contains_firelock = 1 + var/src_has_firelock = 0 if(locate(/obj/machinery/door/firedoor) in src) - src_contains_firelock |= 2 + src_has_firelock = 2 - var/list/atmos_adjacent_turfs = list() + var/blocks_thermal = FALSE + if(!thermal_conductivity || !heat_capacity) + blocks_thermal = TRUE + else + for(var/atom/movable/content as anything in contents) + if(content.BlockThermalConductivity()) //the direction and open/closed are already checked on CanAtmosPass() so there are no arguments + blocks_thermal = TRUE + break - for(var/direction in GLOB.cardinals_multiz) - var/turf/current_turf = get_step_multiz(src, direction) - if(!isopenturf(current_turf)) - conductivity_blocked_directions |= direction + //LAZYINITLIST(atmos_adjacent_turfs) with Cut() + if(atmos_adjacent_turfs) + atmos_adjacent_turfs.Cut() + else + atmos_adjacent_turfs = list() - if(current_turf) - atmos_adjacent_turfs -= current_turf - LAZYREMOVE(current_turf.atmos_adjacent_turfs, src) + var/datum/virtual_level/zone = get_virtual_level() + //Turfs above/below can only exist in zones + for(var/direction in (zone ? GLOB.cardinals_multiz : GLOB.cardinals)) + var/turf/current_turf = zone?.get_zone_step(src, direction) || get_step(src, direction) + if(!current_turf || current_turf.blocks_air) + conductivity_blocked_directions |= direction continue - var/other_contains_firelock = 1 - if(locate(/obj/machinery/door/firedoor) in current_turf) - other_contains_firelock |= 2 - //Conductivity Update var/opp = REVERSE_DIR(direction) - //all these must be above zero for auxmos to even consider them - if(!thermal_conductivity || !heat_capacity || !current_turf.thermal_conductivity || !current_turf.heat_capacity) + //these must be above zero for auxmos to even consider them + if(blocks_thermal || !current_turf.thermal_conductivity || !current_turf.heat_capacity) conductivity_blocked_directions |= direction current_turf.conductivity_blocked_directions |= opp else - for(var/obj/O in contents + current_turf.contents) - if(O.BlockThermalConductivity()) //the direction and open/closed are already checked on CanAtmosPass() so there are no arguments + for(var/atom/movable/content as anything in current_turf.contents) + if(content.BlockThermalConductivity()) //the direction and open/closed are already checked on CanAtmosPass() so there are no arguments conductivity_blocked_directions |= direction current_turf.conductivity_blocked_directions |= opp break //End Conductivity Update - if(!(blocks_air || current_turf.blocks_air) && ((direction & (UP|DOWN))? (canvpass && CANVERTICALATMOSPASS(current_turf, src)) : (canpass && CANATMOSPASS(current_turf, src)))) - atmos_adjacent_turfs[current_turf] = other_contains_firelock | src_contains_firelock - LAZYSET(current_turf.atmos_adjacent_turfs, src, src_contains_firelock) + if(((direction & (UP|DOWN)) ? (canvpass && CANVERTICALATMOSPASS(current_turf, src)) : (canpass && CANATMOSPASS(current_turf, src)))) + var/has_firelock = src_has_firelock + if(!src_has_firelock && locate(/obj/machinery/door/firedoor) in current_turf) + has_firelock = 2 + + atmos_adjacent_turfs[current_turf] = has_firelock + LAZYSET(current_turf.atmos_adjacent_turfs, src, has_firelock) else atmos_adjacent_turfs -= current_turf LAZYREMOVE(current_turf.atmos_adjacent_turfs, src) current_turf.__update_auxtools_turf_adjacency_info() UNSETEMPTY(atmos_adjacent_turfs) - src.atmos_adjacent_turfs = atmos_adjacent_turfs __update_auxtools_turf_adjacency_info() /turf/proc/clear_adjacencies() @@ -98,40 +121,48 @@ LAZYNULL(atmos_adjacent_turfs) __update_auxtools_turf_adjacency_info() -/** - * Returns a list of adjacent turfs that can share air with this one. - * alldir includes adjacent diagonal tiles that can share - * air with both of the related adjacent cardinal tiles - */ -/turf/proc/GetAtmosAdjacentTurfs(alldir = FALSE) - var/adjacent_turfs - if (atmos_adjacent_turfs) - adjacent_turfs = atmos_adjacent_turfs.Copy() - else - adjacent_turfs = list() - - if (!alldir) - return adjacent_turfs +/turf/proc/get_atmos_adjacent_turfs() + return LAZYCOPY(atmos_adjacent_turfs) - var/turf/curloc = src +/turf/proc/get_atmos_all_adjacent_turfs() + var/list/adjacent_turfs = LAZYCOPY(atmos_adjacent_turfs) - for (var/direction in GLOB.diagonals_multiz) - var/matchingDirections = 0 - var/turf/S = get_step_multiz(curloc, direction) + for(var/dir in GLOB.diagonals) + var/turf/S = get_step(src, dir) if(!S) continue + adjacent_turfs += S - for (var/checkDirection in GLOB.cardinals_multiz) - var/turf/checkTurf = get_step(S, checkDirection) - if(!S.atmos_adjacent_turfs || !S.atmos_adjacent_turfs[checkTurf]) - continue + var/datum/virtual_level/zone = get_virtual_level() + if(!zone) + return adjacent_turfs - if (adjacent_turfs[checkTurf]) - matchingDirections++ + var/turf/above = zone.get_above_turf(src) + var/turf/below = zone.get_below_turf(src) - if (matchingDirections >= 2) - adjacent_turfs += S - break + if(above) + adjacent_turfs += above + adjacent_turfs += above.atmos_adjacent_turfs + if(below) + adjacent_turfs += below + adjacent_turfs += below.atmos_adjacent_turfs + + return adjacent_turfs + +/turf/proc/get_atmos_cardinal_adjacent_turfs() + var/list/adjacent_turfs = LAZYCOPY(atmos_adjacent_turfs) + + var/datum/virtual_level/zone = get_virtual_level() + if(!zone) + return adjacent_turfs + + var/turf/above = zone.get_above_turf(src) + var/turf/below = zone.get_below_turf(src) + + if(above) + adjacent_turfs += above + if(below) + adjacent_turfs += below return adjacent_turfs diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm index 7a2559724ad1..2caef9b39d59 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm @@ -110,9 +110,9 @@ if(pump_direction & RELEASING) // internal -> external var/pressure_delta = 10000 - if(pressure_checks&EXT_BOUND) + if(pressure_checks & EXT_BOUND) pressure_delta = min(pressure_delta, (external_pressure_bound - environment_pressure)) - if(pressure_checks&INT_BOUND) + if(pressure_checks & INT_BOUND) pressure_delta = min(pressure_delta, (air_contents.return_pressure() - internal_pressure_bound)) if(pressure_delta > 0) @@ -126,9 +126,9 @@ if(environment.return_pressure() > 0) var/our_multiplier = air_contents.return_volume() / (environment.return_temperature() * R_IDEAL_GAS_EQUATION) var/moles_delta = 10000 * our_multiplier - if(pressure_checks&EXT_BOUND) + if(pressure_checks & EXT_BOUND) moles_delta = min(moles_delta, (environment_pressure - external_pressure_bound) * environment.return_volume() / (environment.return_temperature() * R_IDEAL_GAS_EQUATION)) - if(pressure_checks&INT_BOUND) + if(pressure_checks & INT_BOUND) moles_delta = min(moles_delta, (internal_pressure_bound - air_contents.return_pressure()) * our_multiplier) if(moles_delta > 0) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm index 55e397652e48..7706a7e3c421 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm @@ -126,12 +126,11 @@ return TRUE /obj/machinery/atmospherics/components/unary/vent_scrubber/atmosinit() - radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null - radio_filter_out = frequency==initial(frequency)?(RADIO_TO_AIRALARM):null + radio_filter_in = frequency == initial(frequency) ? (RADIO_FROM_AIRALARM) : null + radio_filter_out = frequency == initial(frequency) ? (RADIO_TO_AIRALARM) : null if(frequency) set_frequency(frequency) broadcast_status() - check_turfs() ..() /obj/machinery/atmospherics/components/unary/vent_scrubber/process_atmos() @@ -141,55 +140,35 @@ if(use_static_power != NO_POWER_USE) set_no_power() return FALSE - if(!nodes[1]) + + if(!nodes[1] || !islist(filter_types)) return FALSE - scrub(loc) + + var/datum/gas_mixture/air_contents = airs[1] + if(!air_contents.return_pressure() >= 50 * ONE_ATMOSPHERE) + return FALSE + + var/turf/location = loc + scrub(location) if(widenet) - if(use_static_power != ACTIVE_POWER_USE) - set_active_power() - for(var/turf/tile in adjacent_turfs) + for(var/turf/tile as anything in location.atmos_adjacent_turfs) scrub(tile) - else - if(use_static_power != IDLE_POWER_USE) - set_idle_power() return TRUE /obj/machinery/atmospherics/components/unary/vent_scrubber/proc/scrub(turf/tile) - if(!istype(tile)) - return FALSE var/datum/gas_mixture/environment = tile.return_air() - var/datum/gas_mixture/air_contents = airs[1] - - if(air_contents.return_pressure() >= 50 * ONE_ATMOSPHERE || !islist(filter_types)) - return FALSE if(scrubbing & SCRUBBING) - environment.scrub_into(air_contents, volume_rate/environment.return_volume(), filter_types) - tile.air_update_turf() + environment.scrub_into(airs[1], volume_rate / environment.return_volume(), filter_types) else //Just siphoning all air - environment.transfer_ratio_to(air_contents, volume_rate/environment.return_volume()) - tile.air_update_turf() + environment.transfer_ratio_to(airs[1], volume_rate / environment.return_volume()) + tile.air_update_turf() update_parents() return TRUE -//There is no easy way for an object to be notified of changes to atmos can pass flags -// So we check every machinery process (2 seconds) -/obj/machinery/atmospherics/components/unary/vent_scrubber/process() - if(widenet) - check_turfs() - -//we populate a list of turfs with nonatmos-blocked cardinal turfs AND -// diagonal turfs that can share atmos with *both* of the cardinal turfs - -/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/check_turfs() - adjacent_turfs.Cut() - var/turf/T = get_turf(src) - if(istype(T)) - adjacent_turfs = T.GetAtmosAdjacentTurfs(alldir = 1) - /obj/machinery/atmospherics/components/unary/vent_scrubber/receive_signal(datum/signal/signal) if(!is_operational || !signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command")) return 0 @@ -206,6 +185,11 @@ if("toggle_widenet" in signal.data) widenet = !widenet + if(widenet) + set_active_power() + else + set_idle_power() + var/old_scrubbing = scrubbing if("scrubbing" in signal.data) scrubbing = text2num(signal.data["scrubbing"]) diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm index 1f1f34782aca..7ccf807ea254 100644 --- a/code/modules/atmospherics/machinery/portable/scrubber.dm +++ b/code/modules/atmospherics/machinery/portable/scrubber.dm @@ -146,7 +146,7 @@ ..() if(!holding) var/turf/T = get_turf(src) - for(var/turf/AT in T.GetAtmosAdjacentTurfs(alldir = TRUE)) + for(var/turf/AT as anything in T.get_atmos_all_adjacent_turfs()) scrub(AT.return_air()) /obj/machinery/portable_atmospherics/scrubber/huge/attackby(obj/item/W, mob/user) diff --git a/code/modules/cargo/supplypod.dm b/code/modules/cargo/supplypod.dm index ab737b1ceb78..b9c30f484021 100644 --- a/code/modules/cargo/supplypod.dm +++ b/code/modules/cargo/supplypod.dm @@ -452,8 +452,11 @@ glow_effect.fadeAway(delays[POD_OPENING]) glow_effect = null +/obj/structure/closet/supplypod/deconstruct(disassembled) + . = ..() + open_pod(src, broken = disassembled) //Lets dump our contents by opening up + /obj/structure/closet/supplypod/Destroy() - open_pod(src, broken = TRUE) //Lets dump our contents by opening up deleteRubble() endGlow() return ..() diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm index c2dd59ecc1fb..5e5f11e0ba77 100644 --- a/code/modules/clothing/glasses/_glasses.dm +++ b/code/modules/clothing/glasses/_glasses.dm @@ -321,7 +321,7 @@ patch_one.forceMove(user.drop_location()) patch_two.forceMove(user.drop_location()) to_chat(user, "You undo the knot on the eyepatches.") - Destroy() + qdel(src) /obj/item/clothing/glasses/sunglasses/big desc = "Strangely ancient technology used to help provide rudimentary eye cover. Larger than average enhanced shielding blocks flashes." diff --git a/code/modules/donator/_donator.dm b/code/modules/donator/_donator.dm index 246d773967bf..218c7292c282 100644 --- a/code/modules/donator/_donator.dm +++ b/code/modules/donator/_donator.dm @@ -57,7 +57,7 @@ GLOBAL_PROTECT(donators) load_information() GLOB.donators[ckey] = src -/datum/donator/Destroy(force, ...) +/datum/donator/Destroy(force) if(!force) return QDEL_HINT_LETMELIVE . = ..() diff --git a/code/modules/fishing/fishing_minigame.dm b/code/modules/fishing/fishing_minigame.dm index eeb0696315ed..bf4df70be8e4 100644 --- a/code/modules/fishing/fishing_minigame.dm +++ b/code/modules/fishing/fishing_minigame.dm @@ -64,7 +64,7 @@ if(rod.hook.fishing_hook_traits & FISHING_HOOK_WEIGHTED) special_effects += FISHING_MINIGAME_RULE_WEIGHTED_BAIT -/datum/fishing_challenge/Destroy(force, ...) +/datum/fishing_challenge/Destroy(force) if(!completed) complete(win = FALSE) if(fishing_line) diff --git a/code/modules/food_and_drinks/food/customizables.dm b/code/modules/food_and_drinks/food/customizables.dm index 3147ee9a5de4..aa55dd6ebc0b 100644 --- a/code/modules/food_and_drinks/food/customizables.dm +++ b/code/modules/food_and_drinks/food/customizables.dm @@ -148,9 +148,9 @@ slice.update_customizable_overlays(src) -/obj/item/reagent_containers/food/snacks/customizable/Destroy() - for(. in ingredients) - qdel(.) +/obj/item/reagent_containers/food/snacks/customizable/deconstruct(disassembled) + for(var/ingredient in ingredients) + qdel(ingredient) return ..() diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm index 9e84c272dbb6..ff49bb00e0de 100644 --- a/code/modules/food_and_drinks/food/snacks.dm +++ b/code/modules/food_and_drinks/food/snacks.dm @@ -322,7 +322,7 @@ All foods are distributed among various categories. Use common sense. return result -/obj/item/reagent_containers/food/snacks/Destroy() +/obj/item/reagent_containers/food/snacks/deconstruct(disassembled) if(contents) for(var/atom/movable/something in contents) something.forceMove(drop_location()) diff --git a/code/modules/food_and_drinks/kitchen_machinery/big_mortar.dm b/code/modules/food_and_drinks/kitchen_machinery/big_mortar.dm index 3024c188facf..7b50db0405fa 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/big_mortar.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/big_mortar.dm @@ -28,7 +28,7 @@ . += span_notice("It can be (un)secured with wrench") . += span_notice("You can empty all of the items out of it with Alt Click") -/obj/structure/large_mortar/Destroy() +/obj/structure/large_mortar/deconstruct(disassembled) drop_everything_contained() return ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/cutting_board.dm b/code/modules/food_and_drinks/kitchen_machinery/cutting_board.dm index b0d91d370ab1..122f163ec7f7 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/cutting_board.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/cutting_board.dm @@ -52,7 +52,7 @@ if(length(contents)) . += span_notice("It has [contents[1]] sitting on it.") -/obj/item/cutting_board/Destroy() +/obj/item/cutting_board/deconstruct(disassembled) drop_everything_contained() return ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm index db88c5d0cc15..d3b7e7f152de 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm @@ -38,8 +38,11 @@ create_reagents(100) soundloop = new(list(src), FALSE) -/obj/machinery/microwave/Destroy() +/obj/machinery/microwave/on_deconstruction() eject() + return ..() + +/obj/machinery/microwave/Destroy() QDEL_NULL(soundloop) QDEL_LIST(ingredients) if(wires) diff --git a/code/modules/interview/interview_manager.dm b/code/modules/interview/interview_manager.dm index f5a557a854de..d09d90a8c6d1 100644 --- a/code/modules/interview/interview_manager.dm +++ b/code/modules/interview/interview_manager.dm @@ -18,7 +18,7 @@ GLOBAL_DATUM_INIT(interviews, /datum/interview_manager, new) /// Ckeys which are currently in the cooldown system, they will be unable to create new interviews var/list/cooldown_ckeys = list() -/datum/interview_manager/Destroy(force, ...) +/datum/interview_manager/Destroy(force) QDEL_LIST(open_interviews) QDEL_LIST(interview_queue) QDEL_LIST(closed_interviews) diff --git a/code/modules/lighting/lighting_atom.dm b/code/modules/lighting/lighting_atom.dm index a5a68d98d609..0ef451b29793 100644 --- a/code/modules/lighting/lighting_atom.dm +++ b/code/modules/lighting/lighting_atom.dm @@ -80,7 +80,7 @@ . = ..() var/datum/light_source/L var/thing - for (thing in light_sources) // Cycle through the light sources on this atom and tell them to update. + for(thing in light_sources) // Cycle through the light sources on this atom and tell them to update. L = thing L.source_atom.update_light() diff --git a/code/modules/mining/equipment/miningradio.dm b/code/modules/mining/equipment/miningradio.dm index a0bef397d8ca..d0712db194dc 100644 --- a/code/modules/mining/equipment/miningradio.dm +++ b/code/modules/mining/equipment/miningradio.dm @@ -7,6 +7,7 @@ luminosity = 1 light_power = 1 light_range = 1.6 + light_system = MOVABLE_LIGHT /obj/item/radio/weather_monitor/update_overlays() . = ..() diff --git a/code/modules/mining/machine_silo.dm b/code/modules/mining/machine_silo.dm index 444e72992685..03401c46f587 100644 --- a/code/modules/mining/machine_silo.dm +++ b/code/modules/mining/machine_silo.dm @@ -35,6 +35,9 @@ GLOBAL_LIST_EMPTY(silo_access_logs) connected = null + return ..() + +/obj/machinery/ore_silo/on_deconstruction() var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.retrieve_all() diff --git a/code/modules/mob/living/carbon/alien/utilities/structures.dm b/code/modules/mob/living/carbon/alien/utilities/structures.dm index 0ac30d207a41..c7e8a128c3d3 100644 --- a/code/modules/mob/living/carbon/alien/utilities/structures.dm +++ b/code/modules/mob/living/carbon/alien/utilities/structures.dm @@ -182,7 +182,7 @@ qdel(src) return //lets try to grow in a direction - for(var/turf/check_turf in src_turf.GetAtmosAdjacentTurfs()) + for(var/turf/check_turf as anything in src_turf.get_atmos_adjacent_turfs()) //we cannot grow on blacklisted turfs if(is_type_in_list(check_turf, blacklisted_turfs)) continue diff --git a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm index bd937acaa09f..e70ec71ddd7a 100644 --- a/code/modules/mob/living/carbon/human/species_types/jellypeople.dm +++ b/code/modules/mob/living/carbon/human/species_types/jellypeople.dm @@ -520,7 +520,7 @@ examine_limb_id = SPECIES_JELLYPERSON //Species datums don't normally implement destroy, but JELLIES SUCK ASS OUT OF A STEEL STRAW -/datum/species/jelly/luminescent/Destroy(force, ...) +/datum/species/jelly/luminescent/Destroy(force) QDEL_NULL(glow) return ..() diff --git a/code/modules/mob/living/silicon/ai/robot_control.dm b/code/modules/mob/living/silicon/ai/robot_control.dm index b70ae816b790..c3e2682d52af 100644 --- a/code/modules/mob/living/silicon/ai/robot_control.dm +++ b/code/modules/mob/living/silicon/ai/robot_control.dm @@ -1,7 +1,7 @@ /datum/robot_control var/mob/living/silicon/ai/owner -/datum/robot_control/Destroy(force, ...) +/datum/robot_control/Destroy(force) if(!QDELETED(owner)) CRASH("Robot Control panel destroyed even though owner AI is not being destroyed.") owner = null diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 8cdc5f3c6818..3c7736c06230 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -457,7 +457,7 @@ Pass the desired type path itself, declaring a temporary var beforehand is not r var/turf/T = get_turf(src) if(!T) return - var/list/adjacent = T.GetAtmosAdjacentTurfs() + var/list/adjacent = T.get_atmos_adjacent_turfs() if(shuffle) //If we were on the same tile as another bot, let's randomize our choices so we dont both go the same way adjacent = shuffle(adjacent) shuffle = FALSE diff --git a/code/modules/mob/living/simple_animal/hostile/clown.dm b/code/modules/mob/living/simple_animal/hostile/clown.dm index 756556191ae9..a5883ce91efa 100644 --- a/code/modules/mob/living/simple_animal/hostile/clown.dm +++ b/code/modules/mob/living/simple_animal/hostile/clown.dm @@ -55,7 +55,7 @@ . = ..() if(banana_time && banana_time < world.time) var/turf/T = get_turf(src) - var/list/adjacent = T.GetAtmosAdjacentTurfs() + var/list/adjacent = T.get_atmos_adjacent_turfs() new banana_type(pick(adjacent)) banana_time = world.time + rand(30,60) diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm index 611b5641ff52..220f4dab979f 100644 --- a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm +++ b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm @@ -55,7 +55,7 @@ . = ..() if(banana_time && banana_time < world.time) var/turf/T = get_turf(src) - var/list/adjacent = T.GetAtmosAdjacentTurfs() + var/list/adjacent = T.get_atmos_adjacent_turfs() new banana_type(pick(adjacent)) banana_time = world.time + rand(30,60) diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm index 9697cce45df3..9fd6fae027ba 100644 --- a/code/modules/modular_computers/computers/item/computer.dm +++ b/code/modules/modular_computers/computers/item/computer.dm @@ -6,11 +6,16 @@ desc = "A small portable microcomputer." icon = 'icons/obj/machines/computer.dmi' icon_state = "laptop" - light_on = FALSE integrity_failure = 0.5 max_integrity = 100 armor = list("melee" = 0, "bullet" = 20, "laser" = 20, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 0, "acid" = 0) + light_system = MOVABLE_LIGHT_DIRECTIONAL + light_range = 2.3 + light_power = 0.6 + light_color = "#FFFFFF" + light_on = FALSE + var/enabled = 0 // Whether the computer is turned on. var/screen_on = 1 // Whether the computer is active/opened/it's screen is on. var/device_theme = "ntos" // Sets the theme for the main menu, hardware config, and file browser apps. Overridden by certain non-NT devices. @@ -43,9 +48,9 @@ var/list/idle_threads // Idle programs on background. They still receive process calls but can't be interacted with. var/obj/physical = null // Object that represents our computer. It's used for Adjacent() and UI visibility checks. - var/has_light = FALSE //If the computer has a flashlight/LED light/what-have-you installed - var/comp_light_luminosity = 3 //The brightness of that light - var/comp_light_color //The color of that light + + /// If the computer has a flashlight/LED light/what-have-you installed + var/has_light = FALSE /obj/item/modular_computer/Initialize() @@ -53,7 +58,6 @@ START_PROCESSING(SSobj, src) if(!physical) physical = src - comp_light_color = "#FFFFFF" idle_threads = list() update_appearance() diff --git a/code/modules/modular_computers/computers/item/computer_ui.dm b/code/modules/modular_computers/computers/item/computer_ui.dm index 4729117052b6..bc44d93583d1 100644 --- a/code/modules/modular_computers/computers/item/computer_ui.dm +++ b/code/modules/modular_computers/computers/item/computer_ui.dm @@ -81,7 +81,7 @@ data["has_light"] = has_light data["light_on"] = light_on - data["comp_light_color"] = comp_light_color + data["comp_light_color"] = light_color return data @@ -166,14 +166,14 @@ return 1 if("PC_toggle_light") + if(!has_light) + return FALSE set_light_on(!light_on) - if(light_on) - set_light(comp_light_luminosity, 1, comp_light_color) - else - set_light(0) return TRUE if("PC_light_color") + if(!has_light) + return FALSE var/mob/user = usr var/new_color while(!new_color) @@ -183,9 +183,7 @@ if(color_hex2num(new_color) < 200) //Colors too dark are rejected to_chat(user, "That color is too dark! Choose a lighter one.") new_color = null - comp_light_color = new_color set_light_color(new_color) - update_light() return TRUE if("PC_Eject_Disk") diff --git a/code/modules/modular_computers/computers/item/tablet.dm b/code/modules/modular_computers/computers/item/tablet.dm index 9931e70ca1ba..2ff0f33a79e1 100644 --- a/code/modules/modular_computers/computers/item/tablet.dm +++ b/code/modules/modular_computers/computers/item/tablet.dm @@ -12,7 +12,6 @@ steel_sheet_cost = 1 slot_flags = ITEM_SLOT_ID | ITEM_SLOT_BELT has_light = TRUE //LED flashlight! - comp_light_luminosity = 2.3 //Same as the PDA custom_materials = list(/datum/material/iron = 2000, /datum/material/glass = 1000) // WS Edit - Item Materials var/has_variants = TRUE var/finish_color = null @@ -33,13 +32,13 @@ icon_state_menu = "assign" w_class = WEIGHT_CLASS_SMALL slot_flags = ITEM_SLOT_ID | ITEM_SLOT_BELT - comp_light_luminosity = 6.3 + light_range = 6.3 has_variants = FALSE /// Given to Nuke Ops members. /obj/item/modular_computer/tablet/nukeops icon_state = "tablet-syndicate" - comp_light_luminosity = 6.3 + light_range = 6.3 has_variants = FALSE device_theme = "syndicate" light_color = COLOR_RED @@ -61,7 +60,6 @@ icon_state_unpowered = "tablet-silicon" base_icon_state = "tablet-silicon" has_light = FALSE //tablet light button actually enables/disables the borg lamp - comp_light_luminosity = 0 has_variants = FALSE ///Ref to the borg we're installed in. Set by the borg during our creation. var/mob/living/silicon/robot/borgo diff --git a/code/modules/overmap/_overmap_datum.dm b/code/modules/overmap/_overmap_datum.dm index 5244f2850188..cd6f31f17c88 100644 --- a/code/modules/overmap/_overmap_datum.dm +++ b/code/modules/overmap/_overmap_datum.dm @@ -65,7 +65,7 @@ Initialize(arglist(args)) -/datum/overmap/Destroy(force, ...) +/datum/overmap/Destroy(force) SSovermap.overmap_objects -= src if(current_docking_ticket) QDEL_NULL(current_docking_ticket) diff --git a/code/modules/overmap/docking_ticket.dm b/code/modules/overmap/docking_ticket.dm index 4e6465043246..c1ff60ae2304 100644 --- a/code/modules/overmap/docking_ticket.dm +++ b/code/modules/overmap/docking_ticket.dm @@ -37,7 +37,7 @@ target.current_docking_ticket = src -/datum/docking_ticket/Destroy(force, ...) +/datum/docking_ticket/Destroy(force) if(target) target.current_docking_ticket = null target = null diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index e63cd1298616..3ef4050178c3 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -106,7 +106,7 @@ var/obj/S = sheet_path sheet_name = initial(S.name) -/obj/machinery/power/port_gen/pacman/Destroy() +/obj/machinery/power/port_gen/pacman/deconstruct(disassembled) DropFuel() return ..() diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index 7c7dc8692cb5..3195f4e46ca7 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -131,7 +131,7 @@ use_static_power = NO_POWER_USE /obj/machinery/proc/set_static_power(area/A)//used to set the actual draw to the value of use_static_power - switch(use_power) + switch(use_static_power) if(NO_POWER_USE) set_no_power(A) if(IDLE_POWER_USE) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index a81259680248..8cb1db68d754 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -21,6 +21,8 @@ //trigger guard on the weapon, hulks can't fire them with their big meaty fingers trigger_guard = TRIGGER_GUARD_NORMAL + light_system = MOVABLE_LIGHT_DIRECTIONAL + ///The manufacturer of this weapon. For flavor mostly. If none, this will not show. var/manufacturer = MANUFACTURER_NONE @@ -29,12 +31,12 @@ */ ///Effect for the muzzle flash of the gun. var/obj/effect/muzzle_flash/muzzle_flash + + light_range = 3 + light_color = COLOR_VERY_SOFT_YELLOW + ///Icon state of the muzzle flash effect. var/muzzleflash_iconstate - ///Brightness of the muzzle flash effect. - var/muzzle_flash_lum = 3 - ///Color of the muzzle flash effect. - var/muzzle_flash_color = COLOR_VERY_SOFT_YELLOW /* * Firing @@ -869,14 +871,10 @@ /obj/item/gun/proc/handle_muzzle_flash(mob/living/user, firing_angle) var/atom/movable/flash_loc = user - var/prev_light = light_range - - if(!light_on && (light_range <= muzzle_flash_lum)) - set_light_range(muzzle_flash_lum) - set_light_color(muzzle_flash_color) + if(!light_on) set_light_on(TRUE) - update_light() - addtimer(CALLBACK(src, PROC_REF(reset_light_range), prev_light), 1 SECONDS) + addtimer(CALLBACK(src, TYPE_PROC_REF(/atom, set_light_on), FALSE), 1 SECONDS) + //Offset the pixels. switch(firing_angle) if(0, 360) @@ -951,13 +949,6 @@ addtimer(CALLBACK(src, PROC_REF(remove_muzzle_flash), flash_loc, muzzle_flash), 0.2 SECONDS) -/obj/item/gun/proc/reset_light_range(lightrange) - set_light_range(lightrange) - set_light_color(initial(light_color)) - if(lightrange <= 0) - set_light_on(FALSE) - update_light() - /obj/item/gun/proc/remove_muzzle_flash(atom/movable/flash_loc, obj/effect/muzzle_flash/muzzle_flash) if(!QDELETED(flash_loc)) flash_loc.vis_contents -= muzzle_flash diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index a458866ee996..d9bb74da59de 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -6,7 +6,7 @@ item_state = "spur" muzzleflash_iconstate = "muzzle_flash_laser" - muzzle_flash_color = COLOR_SOFT_RED + light_color = COLOR_SOFT_RED has_safety = TRUE safety = TRUE diff --git a/code/modules/projectiles/guns/energy/kinetic_accelerator.dm b/code/modules/projectiles/guns/energy/kinetic_accelerator.dm index c7cebd1025be..ab0cf6ef90f0 100644 --- a/code/modules/projectiles/guns/energy/kinetic_accelerator.dm +++ b/code/modules/projectiles/guns/energy/kinetic_accelerator.dm @@ -17,7 +17,7 @@ w_class = WEIGHT_CLASS_BULKY muzzleflash_iconstate = "muzzle_flash_light" - muzzle_flash_color = COLOR_WHITE + light_color = COLOR_WHITE var/overheat_time = 16 var/holds_charge = FALSE diff --git a/code/modules/projectiles/guns/energy/pulse.dm b/code/modules/projectiles/guns/energy/pulse.dm index 973297d1b4e4..a63fbad391e6 100644 --- a/code/modules/projectiles/guns/energy/pulse.dm +++ b/code/modules/projectiles/guns/energy/pulse.dm @@ -25,7 +25,7 @@ spread_unwielded = 25 muzzleflash_iconstate = "muzzle_flash_pulse" - muzzle_flash_color = COLOR_BRIGHT_BLUE + light_color = COLOR_BRIGHT_BLUE /obj/item/gun/energy/pulse/emp_act(severity) return diff --git a/code/modules/reagents/chem_splash.dm b/code/modules/reagents/chem_splash.dm index a7340dfa327b..f13c1174af7f 100644 --- a/code/modules/reagents/chem_splash.dm +++ b/code/modules/reagents/chem_splash.dm @@ -41,20 +41,17 @@ var/list/turflist = list() for(var/turf/T in (orange(i, epicenter) - orange(i-1, epicenter))) turflist |= T - for(var/turf/T in turflist) + for(var/turf/T as anything in turflist) if(!(get_dir(T,epicenter) in GLOB.cardinals) && (abs(T.x - epicenter.x) == abs(T.y - epicenter.y))) turflist.Remove(T) turflist.Add(T) // we move the purely diagonal turfs to the end of the list. - for(var/turf/T in turflist) - if(accessible[T]) + for(var/turf/turf as anything in turflist) + if(accessible[turf]) continue - for(var/thing in T.GetAtmosAdjacentTurfs(alldir = TRUE)) - var/turf/NT = thing - if(!(NT in accessible)) + for(var/turf/new_turf as anything in turf.get_atmos_cardinal_adjacent_turfs()) + if(!accessible[new_turf]) continue - if(!(get_dir(T,NT) in GLOB.cardinals)) - continue - accessible[T] = 1 + accessible[turf] = TRUE break var/list/reactable = accessible for(var/turf/T in accessible) diff --git a/code/modules/requests/requests_manager.dm b/code/modules/requests/requests_manager.dm index c8985058dac1..9531f7960473 100644 --- a/code/modules/requests/requests_manager.dm +++ b/code/modules/requests/requests_manager.dm @@ -23,7 +23,7 @@ GLOBAL_DATUM_INIT(requests, /datum/request_manager, new) /// List where requests can be accessed by ID var/list/requests_by_id = list() -/datum/request_manager/Destroy(force, ...) +/datum/request_manager/Destroy(force) QDEL_LIST(requests) return ..() diff --git a/code/modules/tgui/states/zlevel.dm b/code/modules/tgui/states/zlevel.dm index 152e35803d92..6c4fb13f6464 100644 --- a/code/modules/tgui/states/zlevel.dm +++ b/code/modules/tgui/states/zlevel.dm @@ -12,6 +12,6 @@ GLOBAL_DATUM_INIT(z_state, /datum/ui_state/z_state, new) /datum/ui_state/z_state/can_use_topic(src_object, mob/user) var/turf/turf_obj = get_turf(src_object) var/turf/turf_usr = get_turf(user) - if(turf_obj && turf_usr && turf_obj.virtual_z() == turf_usr.virtual_z()) + if(turf_obj && turf_usr && turf_obj.virtual_z == turf_usr.virtual_z) return UI_INTERACTIVE return UI_CLOSE diff --git a/code/modules/tgui/tgui_alert.dm b/code/modules/tgui/tgui_alert.dm index 9d2dd3b5a059..f732bda9abed 100644 --- a/code/modules/tgui/tgui_alert.dm +++ b/code/modules/tgui/tgui_alert.dm @@ -80,7 +80,7 @@ start_time = world.time QDEL_IN(src, timeout) -/datum/tgui_modal/Destroy(force, ...) +/datum/tgui_modal/Destroy(force) SStgui.close_uis(src) QDEL_NULL(buttons) . = ..() @@ -141,7 +141,7 @@ ..(user, title, message, buttons, timeout) src.callback = callback -/datum/tgui_modal/async/Destroy(force, ...) +/datum/tgui_modal/async/Destroy(force) QDEL_NULL(callback) . = ..() diff --git a/code/modules/tgui/tgui_input_list.dm b/code/modules/tgui/tgui_input_list.dm index a02dfac5f55f..2b2c21496836 100644 --- a/code/modules/tgui/tgui_input_list.dm +++ b/code/modules/tgui/tgui_input_list.dm @@ -102,7 +102,7 @@ start_time = world.time QDEL_IN(src, timeout) -/datum/tgui_list_input/Destroy(force, ...) +/datum/tgui_list_input/Destroy(force) SStgui.close_uis(src) QDEL_NULL(buttons) . = ..() @@ -172,7 +172,7 @@ ..(user, message, title, buttons, timeout) src.callback = callback -/datum/tgui_list_input/async/Destroy(force, ...) +/datum/tgui_list_input/async/Destroy(force) QDEL_NULL(callback) . = ..() diff --git a/code/modules/vehicles/sealed.dm b/code/modules/vehicles/sealed.dm index 22b1eb42becb..d883764c172c 100644 --- a/code/modules/vehicles/sealed.dm +++ b/code/modules/vehicles/sealed.dm @@ -89,9 +89,10 @@ user.put_in_hands(inserted_key) inserted_key = null -/obj/vehicle/sealed/Destroy() +/obj/vehicle/sealed/deconstruct(disassembled = TRUE) DumpMobs() - explosion(loc, 0, 1, 2, 3, 0) + if(!disassembled) + explosion(loc, 0, 1, 2, 3, 0) return ..() /obj/vehicle/sealed/proc/DumpMobs(randomstep = TRUE)