From c45af465283c1ebfe3b1b2d49dd4a3f6bf8c30ac Mon Sep 17 00:00:00 2001 From: Das15 <62486730+Das15@users.noreply.github.com> Date: Sat, 4 Nov 2023 21:39:33 +0100 Subject: [PATCH] Removed unnecessary old code and cleaned it up --- code/game/machinery/doors/airlock_types.dm | 1 - code/game/machinery/doors/door.dm | 99 +++++++------------ code/game/machinery/doors/windowdoor.dm | 1 - .../shuttle/computers/escape_pod_computer.dm | 1 - 4 files changed, 37 insertions(+), 65 deletions(-) diff --git a/code/game/machinery/doors/airlock_types.dm b/code/game/machinery/doors/airlock_types.dm index f4d09796194c..feb699fd245e 100644 --- a/code/game/machinery/doors/airlock_types.dm +++ b/code/game/machinery/doors/airlock_types.dm @@ -138,7 +138,6 @@ opacity = 0 assembly_type = /obj/structure/airlock_assembly/airlock_assembly_research glass = 1 - heat_proof = 1 req_one_access = list(ACCESS_CIVILIAN_RESEARCH, ACCESS_CIVILIAN_COMMAND, ACCESS_WY_COLONIAL) /obj/structure/machinery/door/airlock/glass_mining/colony diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 4e384629f971..a574625f968b 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -1,4 +1,3 @@ - /obj/structure/machinery/door name = "\improper Door" desc = "It opens and closes." @@ -13,6 +12,7 @@ var/open_layer = DOOR_OPEN_LAYER var/closed_layer = DOOR_CLOSED_LAYER var/id = "" + var/width = 1 var/secondsElectrified = 0 var/visible = TRUE @@ -20,32 +20,22 @@ var/operating = FALSE var/autoclose = FALSE var/glass = FALSE - /// If FALSE it speeds up the autoclosing timing + /// If FALSE it speeds up the autoclosing timing. var/normalspeed = TRUE - var/openspeed = 1 SECONDS //How many seconds does it take to open it? Default 1 second. Use only if you have long door opening animations - var/heat_proof = FALSE // For glass airlocks/opacity firedoors - var/air_properties_vary_with_direction = 0 - /// Fixes multi_tile doors opacity issues - var/list/filler_turfs = list() //Previously this was just a single turf, because no one had forseen someone creating doors longer than 2, - // because that would NEVER happen, NEVER + /// Time to open/close airlock, default is 1 second. + var/openspeed = 1 SECONDS + /// Fixes multi_tile doors opacity issues. + var/list/filler_turfs = list() //Previously this was just var, because no one had forseen someone creating doors more than 2 tiles wide /// Stops it being forced open through normal means (Hunters/Zombies/Aliens). var/heavy = FALSE /// Resistance to masterkey var/masterkey_resist = FALSE var/masterkey_mod = 0.1 - - - //Multi-tile doors - dir = EAST - var/width = 1 + dir = EAST //So multitile doors are directioned properly /obj/structure/machinery/door/Initialize(mapload, ...) . = ..() - if(density) - layer = closed_layer - update_flags_heat_protection(get_turf(src)) - else - layer = open_layer + layer = density ? closed_layer : open_layer handle_multidoor() /obj/structure/machinery/door/Destroy() @@ -60,7 +50,7 @@ if (PF) PF.flags_can_pass_all = NONE -/// Also refreshes filler_turfs list +/// Also refreshes filler_turfs list. /obj/structure/machinery/door/proc/change_filler_opacity(new_opacity) // I have no idea why do we null opacity first before... changing it for(var/turf/filler_turf in filler_turfs) @@ -70,7 +60,8 @@ for(var/turf/filler in locate_filler_turfs()) filler.set_opacity(new_opacity) filler_turfs += filler -/// Updates collision box and opacity of multi_tile airlocks + +/// Updates collision box and opacity of multi_tile airlocks. /obj/structure/machinery/door/proc/handle_multidoor() if(width > 1) if(dir in list(EAST, WEST)) @@ -81,6 +72,7 @@ bound_height = width * world.icon_size change_filler_opacity(opacity) +/// Finds turfs which should be filler ones. /obj/structure/machinery/door/proc/locate_filler_turfs() var/turf/filler_temp var/list/located_turfs = list() @@ -101,7 +93,8 @@ return FALSE /obj/structure/machinery/door/Collided(atom/movable/AM) - if(panel_open || operating) return + if(panel_open || operating) + return if(ismob(AM)) var/mob/M = AM if(world.time - M.last_bumped <= openspeed) return //Can bump-open one airlock per second. This is to prevent shock spam. @@ -109,12 +102,10 @@ if(!M.is_mob_restrained() && M.mob_size > MOB_SIZE_SMALL) bumpopen(M) return - if(istype(AM, /obj)) var/obj/O = AM if(O.buckled_mob) Collided(O.buckled_mob) - if(istype(AM, /obj/structure/machinery/bot)) var/obj/structure/machinery/bot/bot = AM if(src.check_access(bot.botcard)) @@ -122,16 +113,17 @@ open() return - /obj/structure/machinery/door/proc/bumpopen(mob/user as mob) - if(operating) return + if(operating) + return src.add_fingerprint(user) if(!src.requiresID()) user = null - if(density) - if(allowed(user)) open() - else flick("door_deny", src) + if(allowed(user)) + open() + else + flick("door_deny", src) return /obj/structure/machinery/door/attack_remote(mob/user) @@ -144,9 +136,7 @@ add_fingerprint(user) if(operating) return - if(!Adjacent(user)) - user = null //so allowed(user) always succeeds - if(!requiresID()) + if(!Adjacent(user) || !requiresID()) user = null //so allowed(user) always succeeds if(allowed(user)) if(density) @@ -157,15 +147,15 @@ if(density) flick("door_deny", src) - /obj/structure/machinery/door/attackby(obj/item/I, mob/user) if(!(I.flags_item & NOBLUDGEON)) try_to_activate_door(user) - return 1 + return TRUE /obj/structure/machinery/door/emp_act(severity) - if(prob(20/severity) && (istype(src,/obj/structure/machinery/door/airlock) || istype(src,/obj/structure/machinery/door/window)) ) - open() + if(prob(20/severity)) + if((istype(src, /obj/structure/machinery/door/airlock) || istype(src, /obj/structure/machinery/door/window))) + open() if(prob(40/severity)) if(secondsElectrified == 0) secondsElectrified = -1 @@ -173,48 +163,41 @@ secondsElectrified = 0 ..() - /obj/structure/machinery/door/ex_act(severity) - if(unacidable) return + if(unacidable) + return if(density) switch(severity) if(0 to EXPLOSION_THRESHOLD_LOW) if(prob(80)) - var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread - s.set_up(2, 1, src) - s.start() + var/datum/effect_system/spark_spread/spark = new /datum/effect_system/spark_spread + spark.set_up(2, 1, src) + spark.start() if(EXPLOSION_THRESHOLD_LOW to INFINITY) qdel(src) else switch(severity) if(0 to EXPLOSION_THRESHOLD_MEDIUM) if(prob(80)) - var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread - s.set_up(2, 1, src) - s.start() + var/datum/effect_system/spark_spread/spark = new /datum/effect_system/spark_spread + spark.set_up(2, 1, src) + spark.start() else qdel(src) return - /obj/structure/machinery/door/get_explosion_resistance() if(density) if(unacidable) - return 1000000 + return 1000000 //I have no idea why do we use magic number here... else return EXPLOSION_THRESHOLD_LOW //this should exactly match the amount of damage needed to destroy the door else return 0 - /obj/structure/machinery/door/update_icon() - if(density) - icon_state = "door1" - else - icon_state = "door0" - return - + icon_state = density ? "door1" : "door0" /obj/structure/machinery/door/proc/do_animate(animation) switch(animation) @@ -232,7 +215,6 @@ flick("door_deny", src) return - /obj/structure/machinery/door/proc/open(forced=0) if(!density) return TRUE @@ -255,11 +237,9 @@ if(operating) operating = FALSE - if(autoclose) addtimer(CALLBACK(src, PROC_REF(autoclose)), normalspeed ? 150 + openspeed : 5) - /obj/structure/machinery/door/proc/close() if(density) return TRUE @@ -283,17 +263,12 @@ /obj/structure/machinery/door/proc/requiresID() return TRUE - -/obj/structure/machinery/door/proc/update_flags_heat_protection(turf/source) - - /obj/structure/machinery/door/proc/autoclose() - var/obj/structure/machinery/door/airlock/A = src - if(!A.density && !A.operating && !A.locked && !A.welded && A.autoclose) + var/obj/structure/machinery/door/airlock/airlock = src + if(!airlock.density && !airlock.operating && !airlock.locked && !airlock.welded && airlock.autoclose) close() return -/// It WONT WORK with airlocks bigger than 2 tiles, also is wonky as hell /obj/structure/machinery/door/Move(new_loc, new_dir) . = ..() if(width > 1) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 2b57fbd0a44d..bd544c5c3f5a 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -11,7 +11,6 @@ flags_atom = ON_BORDER opacity = FALSE var/obj/item/circuitboard/airlock/electronics = null - air_properties_vary_with_direction = 1 /obj/structure/machinery/door/window/Initialize() . = ..() diff --git a/code/modules/shuttle/computers/escape_pod_computer.dm b/code/modules/shuttle/computers/escape_pod_computer.dm index 6f9292cfc048..99478dcf6884 100644 --- a/code/modules/shuttle/computers/escape_pod_computer.dm +++ b/code/modules/shuttle/computers/escape_pod_computer.dm @@ -204,7 +204,6 @@ /obj/structure/machinery/door/airlock/evacuation name = "\improper Evacuation Airlock" icon = 'icons/obj/structures/doors/pod_doors.dmi' - heat_proof = 1 unslashable = TRUE unacidable = TRUE var/obj/docking_port/mobile/crashable/escape_shuttle/linked_shuttle