diff --git a/baystation12.dme b/baystation12.dme index cc0918516d7..9962101e104 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -324,7 +324,6 @@ #include "code\game\machinery\turrets.dm" #include "code\game\machinery\vending.dm" #include "code\game\machinery\washing_machine.dm" -#include "code\game\machinery\wishgranter.dm" #include "code\game\machinery\atmoalter\area_atmos_computer.dm" #include "code\game\machinery\atmoalter\canister.dm" #include "code\game\machinery\atmoalter\meter.dm" diff --git a/code/game/area/Space Station 13 areas.dm b/code/game/area/Space Station 13 areas.dm index 8bb76ec226f..6d41985202e 100755 --- a/code/game/area/Space Station 13 areas.dm +++ b/code/game/area/Space Station 13 areas.dm @@ -49,6 +49,8 @@ NOTE: there are two lists of areas in the end of this file: centcom and station // (original area before splitting due to sd_DAL) var/list/related // the other areas of the same type as this // var/list/lights // list of all lights on this area + var/list/all_doors = list() //Added by Strumpetplaya - Alarm Change - Contains a list of doors adjacent to this area + var/air_doors_activated = 0 /*Adding a wizard area teleport list because motherfucking lag -- Urist*/ /*I am far too lazy to make it a proper list of areas so I'll just make it run the usual telepot routine at the start of the game*/ diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index e0e15c0ecd3..3d59d9016da 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -10,7 +10,7 @@ /area/New() icon_state = "" layer = 10 - master = src //moved outside the spawn(1) to avoid runtimes in lighting.dm when it references src.loc.loc.master ~Carn + master = src //moved outside the spawn(1) to avoid runtimes in lighting.dm when it references loc.loc.master ~Carn uid = ++global_uid related = list(src) @@ -62,44 +62,44 @@ return /area/proc/atmosalert(danger_level) -// if(src.type==/area) //No atmos alarms in space +// if(type==/area) //No atmos alarms in space // return 0 //redudant - if(danger_level != src.atmosalm) - //src.updateicon() - //src.mouse_opacity = 0 + if(danger_level != atmosalm) + //updateicon() + //mouse_opacity = 0 if (danger_level==2) var/list/cameras = list() - for(var/area/RA in src.related) - //src.updateicon() + for(var/area/RA in related) + //updateicon() for(var/obj/machinery/camera/C in RA) cameras += C for(var/mob/living/silicon/aiPlayer in player_list) aiPlayer.triggerAlarm("Atmosphere", src, cameras, src) for(var/obj/machinery/computer/station_alert/a in world) a.triggerAlarm("Atmosphere", src, cameras, src) - else if (src.atmosalm == 2) + else if (atmosalm == 2) for(var/mob/living/silicon/aiPlayer in player_list) aiPlayer.cancelAlarm("Atmosphere", src, src) for(var/obj/machinery/computer/station_alert/a in world) a.cancelAlarm("Atmosphere", src, src) - src.atmosalm = danger_level + atmosalm = danger_level return 1 return 0 /area/proc/firealert() - if(src.name == "Space") //no fire alarms in space + if(name == "Space") //no fire alarms in space return - if (!( src.fire )) - src.fire = 1 - src.updateicon() - src.mouse_opacity = 0 - for(var/obj/machinery/door/firedoor/D in src) + if( !fire ) + fire = 1 + updateicon() + mouse_opacity = 0 + for(var/obj/machinery/door/firedoor/D in all_doors) if(!D.blocked) if(D.operating) D.nextstate = CLOSED else if(!D.density) - spawn(0) - D.close() + spawn() + D.close() var/list/cameras = list() for (var/obj/machinery/camera/C in src) cameras += C @@ -107,14 +107,13 @@ aiPlayer.triggerAlarm("Fire", src, cameras, src) for (var/obj/machinery/computer/station_alert/a in world) a.triggerAlarm("Fire", src, cameras, src) - return /area/proc/firereset() - if (src.fire) - src.fire = 0 - src.mouse_opacity = 0 - src.updateicon() - for(var/obj/machinery/door/firedoor/D in src) + if (fire) + fire = 0 + mouse_opacity = 0 + updateicon() + for(var/obj/machinery/door/firedoor/D in all_doors) if(!D.blocked) if(D.operating) D.nextstate = OPEN @@ -125,7 +124,6 @@ aiPlayer.cancelAlarm("Fire", src, src) for (var/obj/machinery/computer/station_alert/a in world) a.cancelAlarm("Fire", src, src) - return /area/proc/readyalert() if(name == "Space") @@ -142,19 +140,19 @@ return /area/proc/partyalert() - if(src.name == "Space") //no parties in space!!! + if(name == "Space") //no parties in space!!! return - if (!( src.party )) - src.party = 1 - src.updateicon() - src.mouse_opacity = 0 + if (!( party )) + party = 1 + updateicon() + mouse_opacity = 0 return /area/proc/partyreset() - if (src.party) - src.party = 0 - src.mouse_opacity = 0 - src.updateicon() + if (party) + party = 0 + mouse_opacity = 0 + updateicon() for(var/obj/machinery/door/firedoor/D in src) if(!D.blocked) if(D.operating) @@ -273,7 +271,7 @@ A:client:ambience_playing = 1 A << sound('sound/ambience/shipambience.ogg', repeat = 1, wait = 0, volume = 35, channel = 2) - switch(src.name) + switch(name) if ("Chapel") sound = pick('sound/ambience/ambicha1.ogg','sound/ambience/ambicha2.ogg','sound/ambience/ambicha3.ogg','sound/ambience/ambicha4.ogg') if ("Morgue") sound = pick('sound/ambience/ambimo1.ogg','sound/ambience/ambimo2.ogg','sound/music/title2.ogg') if ("Space") sound = pick('sound/ambience/ambispace.ogg','sound/music/title2.ogg',) diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm index 2f586ef0e99..efac9a4b4a2 100644 --- a/code/game/machinery/alarm.dm +++ b/code/game/machinery/alarm.dm @@ -1,5 +1,6 @@ -//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 - +//////////////////////////////////////// +//CONTAINS: Air Alarms and Fire Alarms// +//////////////////////////////////////// /proc/RandomAAlarmWires() //to make this not randomize the wires, just set index to 1 and increment it in the flag for loop (after doing everything else). @@ -21,120 +22,31 @@ flagIndex+=1 return AAlarmwires +#define AALARM_WIRE_IDSCAN 1 //Added wires +#define AALARM_WIRE_POWER 2 +#define AALARM_WIRE_SYPHON 3 +#define AALARM_WIRE_AI_CONTROL 4 +#define AALARM_WIRE_AALARM 5 +#define AALARM_MODE_SCRUBBING 1 +#define AALARM_MODE_REPLACEMENT 2 //like scrubbing, but faster. +#define AALARM_MODE_PANIC 3 //constantly sucks all air +#define AALARM_MODE_CYCLE 4 //sucks off all air, then refill and swithes to scrubbing +#define AALARM_MODE_FILL 5 //emergency fill -// A datum for dealing with threshold limit values -// used in /obj/machinery/alarm -/datum/tlv - var/min2 - var/min1 - var/max1 - var/max2 - New(_min2 as num, _min1 as num, _max1 as num, _max2 as num) - min2 = _min2 - min1 = _min1 - max1 = _max1 - max2 = _max2 - proc/get_danger_level(curval as num) - if (max2 >=0 && curval>=max2) - return 2 - if (min2 >=0 && curval<=min2) - return 2 - if (max1 >=0 && curval>=max1) - return 1 - if (min1 >=0 && curval<=min1) - return 1 - return 0 - proc/CopyFrom(datum/tlv/other) - min2 = other.min2 - min1 = other.min1 - max1 = other.max1 - max2 = other.max2 +#define AALARM_SCREEN_MAIN 1 +#define AALARM_SCREEN_VENT 2 +#define AALARM_SCREEN_SCRUB 3 +#define AALARM_SCREEN_MODE 4 +#define AALARM_SCREEN_SENSORS 5 -/obj/machinery/alarm - name = "alarm" - icon = 'icons/obj/monitors.dmi' - icon_state = "alarm0" - anchored = 1 - use_power = 1 - idle_power_usage = 4 - active_power_usage = 8 - power_channel = ENVIRON - req_access = list(access_atmospherics) - var/frequency = 1439 - //var/skipprocess = 0 //Experimenting - var/alarm_frequency = 1437 #define AALARM_REPORT_TIMEOUT 100 - var/datum/radio_frequency/radio_connection - var/locked = 1 - var/wiresexposed = 0 // If it's been screwdrivered open. - var/aidisabled = 0 - var/AAlarmwires = 31 - var/shorted = 0 - var/remote_control = 0 - // Uses code from apc.dm - -#define AALARM_WIRE_IDSCAN 1 //Added wires -#define AALARM_WIRE_POWER 2 -#define AALARM_WIRE_SYPHON 3 -#define AALARM_WIRE_AI_CONTROL 4 -#define AALARM_WIRE_AALARM 5 - - -#define AALARM_MODE_SCRUBBING 1 -#define AALARM_MODE_VENTING 2 //makes draught -#define AALARM_MODE_PANIC 3 //constantly sucks all air -#define AALARM_MODE_REPLACEMENT 4 //sucks off all air, then refill and swithes to scrubbing -#define AALARM_MODE_OFF 5 - var/mode = AALARM_MODE_SCRUBBING - -#define AALARM_SCREEN_MAIN 1 -#define AALARM_SCREEN_VENT 2 -#define AALARM_SCREEN_SCRUB 3 -#define AALARM_SCREEN_MODE 4 -#define AALARM_SCREEN_SENSORS 5 - var/screen = AALARM_SCREEN_MAIN - var/area_uid - var/area/alarm_area - var/danger_level = 0 - - // breathable air according to human/Life() - var/list/TLV = list( - "oxygen" = new/datum/tlv( 16, 19, 135, 140), // Partial pressure, kpa - "carbon dioxide" = new/datum/tlv(-1.0, -1.0, 5, 10), // Partial pressure, kpa - "plasma" = new/datum/tlv(-1.0, -1.0, 0.2, 0.5), // Partial pressure, kpa - "other" = new/datum/tlv(-1.0, -1.0, 0.5, 1.0), // Partial pressure, kpa - "pressure" = new/datum/tlv(ONE_ATMOSPHERE*0.80,ONE_ATMOSPHERE*0.90,ONE_ATMOSPHERE*1.10,ONE_ATMOSPHERE*1.20), /* kpa */ - "temperature" = new/datum/tlv(T0C, T0C+10, T0C+40, T0C+66), // K - ) - -/* - // breathable air according to wikipedia - "oxygen" = new/datum/tlv( 9, 12, 158, 296), // Partial pressure, kpa - "carbon dioxide" = new/datum/tlv(-1.0,-1.0, 0.5, 1), // Partial pressure, kpa -*/ -/obj/machinery/alarm/server - //req_access = list(access_rd) //no, let departaments to work together - TLV = list( - "oxygen" = new/datum/tlv(-1.0, -1.0,-1.0,-1.0), // Partial pressure, kpa - "carbon dioxide" = new/datum/tlv(-1.0, -1.0, 5, 10), // Partial pressure, kpa - "plasma" = new/datum/tlv(-1.0, -1.0, 0.2, 0.5), // Partial pressure, kpa - "other" = new/datum/tlv(-1.0, -1.0, 0.5, 1.0), // Partial pressure, kpa - "pressure" = new/datum/tlv(ONE_ATMOSPHERE*0.80,ONE_ATMOSPHERE*0.90,ONE_ATMOSPHERE*1.40,ONE_ATMOSPHERE*1.60), /* kpa */ - "temperature" = new/datum/tlv(40, 60, 100, 120), // K - ) - -/obj/machinery/alarm/kitchen_cold_room - TLV = list( - "oxygen" = new/datum/tlv( 16, 19, 135, 140), // Partial pressure, kpa - "carbon dioxide" = new/datum/tlv(-1.0, -1.0, 5, 10), // Partial pressure, kpa - "plasma" = new/datum/tlv(-1.0, -1.0, 0.2, 0.5), // Partial pressure, kpa - "other" = new/datum/tlv(-1.0, -1.0, 0.5, 1.0), // Partial pressure, kpa - "pressure" = new/datum/tlv(ONE_ATMOSPHERE*0.80,ONE_ATMOSPHERE*0.90,ONE_ATMOSPHERE*1.50,ONE_ATMOSPHERE*1.60), /* kpa */ - "temperature" = new/datum/tlv(200, 210, 273.15, 283.15), // K - ) +#define RCON_NO 1 +#define RCON_AUTO 2 +#define RCON_YES 3 +//all air alarms in area are connected via magic //all air alarms in area are connected via magic /area var/obj/machinery/alarm/master_air_alarm @@ -143,508 +55,739 @@ var/list/air_vent_info var/list/air_scrub_info -/obj/machinery/alarm/New() - ..() - alarm_area = get_area(loc) - if (alarm_area.master) - alarm_area = alarm_area.master - area_uid = alarm_area.uid - if (name == "alarm") - name = "[alarm_area.name] Air Alarm" +/obj/machinery/alarm + name = "alarm" + icon = 'monitors.dmi' + icon_state = "alarm0" + anchored = 1 + use_power = 1 + idle_power_usage = 4 + active_power_usage = 8 + power_channel = ENVIRON + req_access = list(access_atmospherics, access_engine_equip) + var/frequency = 1439 + //var/skipprocess = 0 //Experimenting + var/alarm_frequency = 1437 + var/remote_control = 0 + var/rcon_setting = 2 + var/rcon_time = 0 + var/locked = 1 + var/wiresexposed = 0 // If it's been screwdrivered open. + var/aidisabled = 0 + var/AAlarmwires = 31 + var/shorted = 0 -/obj/machinery/alarm/initialize() - set_frequency(frequency) - if (!master_is_operating()) - elect_master() + var/mode = AALARM_MODE_SCRUBBING + var/screen = AALARM_SCREEN_MAIN + var/area_uid + var/area/alarm_area + var/danger_level = 0 -/obj/machinery/alarm/proc/master_is_operating() - return alarm_area.master_air_alarm && !(alarm_area.master_air_alarm.stat & (NOPOWER|BROKEN)) + var/datum/radio_frequency/radio_connection -/obj/machinery/alarm/proc/elect_master() - for (var/area/A in alarm_area.related) - for (var/obj/machinery/alarm/AA in A) - if (!(AA.stat & (NOPOWER|BROKEN))) - alarm_area.master_air_alarm = AA - if (!alarm_area.air_vent_names) - alarm_area.air_vent_names = new - alarm_area.air_scrub_names = new - alarm_area.air_vent_info = new - alarm_area.air_scrub_info = new - return 1 - return 0 + var/list/TLV = list() -/obj/machinery/alarm/attack_hand(mob/user) - . = ..() - if (.) - return - user.set_machine(src) + server/New() + ..() + req_access = list(access_rd, access_atmospherics, access_engine_equip) + TLV["oxygen"] = list(-1.0, -1.0,-1.0,-1.0) // Partial pressure, kpa + TLV["carbon dioxide"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa + TLV["plasma"] = list(-1.0, -1.0, 0.2, 0.5) // Partial pressure, kpa + TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa + TLV["pressure"] = list(ONE_ATMOSPHERE*0.50,ONE_ATMOSPHERE*0.70,ONE_ATMOSPHERE*1.40,ONE_ATMOSPHERE*1.60) /* kpa */ + TLV["temperature"] = list(40, 60, 100, 120) // K - if ( (get_dist(src, user) > 1 )) - if (!istype(user, /mob/living/silicon)) - user.unset_machine() - user << browse(null, "window=air_alarm") - user << browse(null, "window=AAlarmwires") + New() + ..() + alarm_area = get_area(src) + if (alarm_area.master) + alarm_area = alarm_area.master + area_uid = alarm_area.uid + if (name == "alarm") + name = "[alarm_area.name] Air Alarm" + + // breathable air according to human/Life() + TLV["oxygen"] = list(16, 19, 135, 140) // Partial pressure, kpa + TLV["carbon dioxide"] = list(-1.0, -1.0, 5, 10) // Partial pressure, kpa + TLV["plasma"] = list(-1.0, -1.0, 0.2, 0.5) // Partial pressure, kpa + TLV["other"] = list(-1.0, -1.0, 0.5, 1.0) // Partial pressure, kpa + TLV["pressure"] = list(ONE_ATMOSPHERE*0.80,ONE_ATMOSPHERE*0.90,ONE_ATMOSPHERE*1.10,ONE_ATMOSPHERE*1.20) /* kpa */ + TLV["temperature"] = list(T0C, T0C+10, T0C+40, T0C+66) // K + + initialize() + set_frequency(frequency) + if (!master_is_operating()) + elect_master() + + + process() + if((stat & (NOPOWER|BROKEN)) || shorted) return + var/turf/simulated/location = loc + ASSERT(istype(location)) - else if (istype(user, /mob/living/silicon) && src.aidisabled) - user << "AI control for this Air Alarm interface has been disabled." - user << browse(null, "window=air_alarm") - return + var/datum/gas_mixture/environment = location.return_air() + var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume - if(wiresexposed && (!istype(user, /mob/living/silicon))) - var/t1 = text("[alarm_area.name] Air Alarm WiresAccess Panel
\n") - var/list/AAlarmwires = list( - "Orange" = 1, - "Dark red" = 2, - "White" = 3, - "Yellow" = 4, - "Black" = 5, - ) - for(var/wiredesc in AAlarmwires) - var/is_uncut = src.AAlarmwires & AAlarmWireColorToFlag[AAlarmwires[wiredesc]] - t1 += "[wiredesc] wire: " - if(!is_uncut) - t1 += "Mend" + var/list/current_settings = TLV["pressure"] + var/environment_pressure = environment.return_pressure() + var/pressure_dangerlevel = get_danger_level(environment_pressure, current_settings) - else - t1 += "Cut " - t1 += "Pulse " + current_settings = TLV["oxygen"] + var/oxygen_dangerlevel = get_danger_level(environment.oxygen*partial_pressure, current_settings) - t1 += "
" - t1 += text("
\n[(src.locked ? "The Air Alarm is locked." : "The Air Alarm is unlocked.")]
\n[((src.shorted || (stat & (NOPOWER|BROKEN))) ? "The Air Alarm is offline." : "The Air Alarm is working properly!")]
\n[(src.aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]") - t1 += text("

Close

") - user << browse(t1, "window=AAlarmwires") - onclose(user, "AAlarmwires") + current_settings = TLV["carbon dioxide"] + var/co2_dangerlevel = get_danger_level(environment.carbon_dioxide*partial_pressure, current_settings) - if(!shorted) - user << browse(return_text(),"window=air_alarm") - onclose(user, "air_alarm") - refresh_all() + current_settings = TLV["plasma"] + var/plasma_dangerlevel = get_danger_level(environment.toxins*partial_pressure, current_settings) - return + current_settings = TLV["other"] + var/other_moles = 0.0 + for(var/datum/gas/G in environment.trace_gases) + other_moles+=G.moles + var/other_dangerlevel = get_danger_level(other_moles*partial_pressure, current_settings) + current_settings = TLV["temperature"] + var/temperature_dangerlevel = get_danger_level(environment.temperature, current_settings) -/obj/machinery/alarm/proc/isWireColorCut(var/wireColor) - var/wireFlag = AAlarmWireColorToFlag[wireColor] - return ((src.AAlarmwires & wireFlag) == 0) + var/old_danger_level = danger_level + danger_level = max(pressure_dangerlevel, + oxygen_dangerlevel, + co2_dangerlevel, + plasma_dangerlevel, + other_dangerlevel, + temperature_dangerlevel) -/obj/machinery/alarm/proc/isWireCut(var/wireIndex) - var/wireFlag = AAlarmIndexToFlag[wireIndex] - return ((src.AAlarmwires & wireFlag) == 0) + if (old_danger_level != danger_level) + apply_danger_level(danger_level) -/obj/machinery/alarm/proc/cut(var/wireColor) - var/wireFlag = AAlarmWireColorToFlag[wireColor] - var/wireIndex = AAlarmWireColorToIndex[wireColor] - AAlarmwires &= ~wireFlag - switch(wireIndex) - if(AALARM_WIRE_IDSCAN) - src.locked = 1 - //world << "Idscan wire cut" - - if(AALARM_WIRE_POWER) - src.shock(usr, 50) - src.shorted = 1 - update_icon() - //world << "Power wire cut" - - if (AALARM_WIRE_AI_CONTROL) - if (src.aidisabled == 0) - src.aidisabled = 1 - //world << "AI Control Wire Cut" - - if(AALARM_WIRE_SYPHON) - mode = AALARM_MODE_PANIC + if (mode==AALARM_MODE_CYCLE && environment_pressure= danger_levels[4] || current_value <= danger_levels[1]) + return 2 + if(current_value >= danger_levels[3] || current_value <= danger_levels[2]) + return 1 + return 0 + + update_icon() + if(wiresexposed) + icon_state = "alarmx" + return + if((stat & (NOPOWER|BROKEN)) || shorted) + icon_state = "alarmp" + return + switch(max(danger_level, alarm_area.atmosalm)) + if (0) + icon_state = "alarm0" + if (1) + icon_state = "alarm2" //yes, alarm2 is yellow alarm + if (2) + icon_state = "alarm1" + + receive_signal(datum/signal/signal) + if(stat & (NOPOWER|BROKEN)) + return + if (alarm_area.master_air_alarm != src) + if (master_is_operating()) + return + elect_master() + if (alarm_area.master_air_alarm != src) + return + if(!signal || signal.encryption) + return + var/id_tag = signal.data["tag"] + if (!id_tag) + return + if (signal.data["area"] != area_uid) + return + if (signal.data["sigtype"] != "status") + return + + var/dev_type = signal.data["device"] + if(!(id_tag in alarm_area.air_scrub_names) && !(id_tag in alarm_area.air_vent_names)) + register_env_machine(id_tag, dev_type) + if(dev_type == "AScr") + alarm_area.air_scrub_info[id_tag] = signal.data + else if(dev_type == "AVP") + alarm_area.air_vent_info[id_tag] = signal.data + + proc/register_env_machine(var/m_id, var/device_type) + var/new_name + if (device_type=="AVP") + new_name = "[alarm_area.name] Vent Pump #[alarm_area.air_vent_names.len+1]" + alarm_area.air_vent_names[m_id] = new_name + else if (device_type=="AScr") + new_name = "[alarm_area.name] Air Scrubber #[alarm_area.air_scrub_names.len+1]" + alarm_area.air_scrub_names[m_id] = new_name + else + return + spawn (10) + send_signal(m_id, list("init" = new_name) ) + + proc/refresh_all() + for(var/id_tag in alarm_area.air_vent_names) + var/list/I = alarm_area.air_vent_info[id_tag] + if (I && I["timestamp"]+AALARM_REPORT_TIMEOUT/2 > world.time) + continue + send_signal(id_tag, list("status") ) + for(var/id_tag in alarm_area.air_scrub_names) + var/list/I = alarm_area.air_scrub_info[id_tag] + if (I && I["timestamp"]+AALARM_REPORT_TIMEOUT/2 > world.time) + continue + send_signal(id_tag, list("status") ) + + proc/set_frequency(new_frequency) + radio_controller.remove_object(src, frequency) + frequency = new_frequency + radio_connection = radio_controller.add_object(src, frequency, RADIO_TO_AIRALARM) + + proc/send_signal(var/target, var/list/command)//sends signal 'command' to 'target'. Returns 0 if no radio connection, 1 otherwise + if(!radio_connection) + return 0 + + var/datum/signal/signal = new + signal.transmission_method = 1 //radio signal + signal.source = src + + signal.data = command + signal.data["tag"] = target + signal.data["sigtype"] = "command" + + radio_connection.post_signal(src, signal, RADIO_FROM_AIRALARM) + // world << text("Signal [] Broadcasted to []", command, target) + + return 1 + + proc/apply_mode() + var/current_pressures = TLV["pressure"] + var/target_pressure = (current_pressures[2] + current_pressures[3])/2 + switch(mode) + if(AALARM_MODE_SCRUBBING) + for(var/device_id in alarm_area.air_scrub_names) + send_signal(device_id, list("power"= 1, "co2_scrub"= 1, "setting"= 1, "scrubbing"= 1, "panic_siphon"= 0) ) + for(var/device_id in alarm_area.air_vent_names) + send_signal(device_id, list("power"= 1, "checks"= 1, "setting"= 1, "set_external_pressure"= target_pressure) ) + + if(AALARM_MODE_PANIC, AALARM_MODE_CYCLE) + for(var/device_id in alarm_area.air_scrub_names) + send_signal(device_id, list("power"= 1, "panic_siphon"= 1) ) + for(var/device_id in alarm_area.air_vent_names) + send_signal(device_id, list("power"= 0) ) + + if(AALARM_MODE_REPLACEMENT) + for(var/device_id in alarm_area.air_scrub_names) + send_signal(device_id, list("power"= 1, "co2_scrub"= 1, "setting"= 3, "scrubbing"= 1, "panic_siphon"= 0) ) + for(var/device_id in alarm_area.air_vent_names) + send_signal(device_id, list("power"= 1, "checks"= 1, "setting"= 3, "set_external_pressure"= target_pressure) ) + + if(AALARM_MODE_FILL) + for(var/device_id in alarm_area.air_scrub_names) + send_signal(device_id, list("power"= 0) ) + for(var/device_id in alarm_area.air_vent_names) + send_signal(device_id, list("power"= 1, "checks"= 1, "setting"= 3, "set_external_pressure"= target_pressure) ) + + proc/apply_danger_level(var/new_danger_level) + alarm_area.atmosalm = new_danger_level + + for (var/area/A in alarm_area.related) + for (var/obj/machinery/alarm/AA in A) + if ( !(AA.stat & (NOPOWER|BROKEN)) && !AA.shorted && AA.danger_level != new_danger_level) + AA.update_icon() + + if(danger_level > 1) + air_doors_close(0) + else + air_doors_open(0) + + update_icon() + + proc/air_doors_close(manual) + var/area/A = get_area(src) + if(!A.master.air_doors_activated) + A.master.air_doors_activated = 1 + for(var/obj/machinery/door/E in A.master.all_doors) + if(istype(E,/obj/machinery/door/firedoor)) + if(!E:blocked) + if(E.operating) + E:nextstate = CLOSED + else if(!E.density) + spawn(0) + E.close() + continue + +/* if(istype(E, /obj/machinery/door/airlock)) + if((!E:arePowerSystemsOn()) || (E.stat & NOPOWER) || E:air_locked) continue + if(!E.density) + spawn(0) + E.close() + spawn(10) + if(E.density) + E:air_locked = E.req_access + E:req_access = list(ACCESS_ENGINE, ACCESS_ATMOSPHERICS) + E.update_icon() + else if(E.operating) + spawn(10) + E.close() + if(E.density) + E:air_locked = E.req_access + E:req_access = list(ACCESS_ENGINE, ACCESS_ATMOSPHERICS) + E.update_icon() + else if(!E:locked) //Don't lock already bolted doors. + E:air_locked = E.req_access + E:req_access = list(ACCESS_ENGINE, ACCESS_ATMOSPHERICS) + E.update_icon()*/ + + proc/air_doors_open(manual) + var/area/A = get_area(loc) + if(A.master.air_doors_activated) + A.master.air_doors_activated = 0 + for(var/obj/machinery/door/E in A.master.all_doors) + if(istype(E, /obj/machinery/door/firedoor)) + if(!E:blocked) + if(E.operating) + E:nextstate = OPEN + else if(E.density) + spawn(0) + E.open() + continue + +/* if(istype(E, /obj/machinery/door/airlock)) + if((!E:arePowerSystemsOn()) || (E.stat & NOPOWER)) continue + if(!isnull(E:air_locked)) //Don't mess with doors locked for other reasons. + E:req_access = E:air_locked + E:air_locked = null + E.update_icon()*/ + +/////////// +//HACKING// +/////////// + proc/isWireColorCut(var/wireColor) + var/wireFlag = AAlarmWireColorToFlag[wireColor] + return ((AAlarmwires & wireFlag) == 0) + + proc/isWireCut(var/wireIndex) + var/wireFlag = AAlarmIndexToFlag[wireIndex] + return ((AAlarmwires & wireFlag) == 0) + + proc/cut(var/wireColor) + var/wireFlag = AAlarmWireColorToFlag[wireColor] + var/wireIndex = AAlarmWireColorToIndex[wireColor] + AAlarmwires &= ~wireFlag + switch(wireIndex) + if(AALARM_WIRE_IDSCAN) + locked = 1 + + if(AALARM_WIRE_POWER) + shock(usr, 50) shorted = 1 update_icon() - spawn(1200) - if(shorted == 1) - shorted = 0 + if (AALARM_WIRE_AI_CONTROL) + if (aidisabled == 0) + aidisabled = 1 + + if(AALARM_WIRE_SYPHON) + mode = AALARM_MODE_PANIC + apply_mode() + + if(AALARM_WIRE_AALARM) + + if (alarm_area.atmosalert(2)) + apply_danger_level(2) + spawn(1) + updateUsrDialog() + update_icon() + + updateDialog() + + return + + proc/mend(var/wireColor) + var/wireFlag = AAlarmWireColorToFlag[wireColor] + var/wireIndex = AAlarmWireColorToIndex[wireColor] //not used in this function + AAlarmwires |= wireFlag + switch(wireIndex) + if(AALARM_WIRE_IDSCAN) + + if(AALARM_WIRE_POWER) + shorted = 0 + shock(usr, 50) + update_icon() + + if(AALARM_WIRE_AI_CONTROL) + if (aidisabled == 1) + aidisabled = 0 + + updateDialog() + return + + proc/pulse(var/wireColor) + //var/wireFlag = AAlarmWireColorToFlag[wireColor] //not used in this function + var/wireIndex = AAlarmWireColorToIndex[wireColor] + switch(wireIndex) + if(AALARM_WIRE_IDSCAN) //unlocks for 30 seconds, if you have a better way to hack I'm all ears + locked = 0 + spawn(300) + locked = 1 + + if (AALARM_WIRE_POWER) + if(shorted == 0) + shorted = 1 update_icon() + spawn(1200) + if(shorted == 1) + shorted = 0 + update_icon() - if (AALARM_WIRE_AI_CONTROL) - // world << "AI Control wire pulsed" - if (src.aidisabled == 0) - src.aidisabled = 1 - src.updateDialog() - spawn(10) - if (src.aidisabled == 1) - src.aidisabled = 0 - src.updateDialog() - if(AALARM_WIRE_SYPHON) - // world << "Syphon wire pulsed" - mode = AALARM_MODE_REPLACEMENT - apply_mode() + if (AALARM_WIRE_AI_CONTROL) + if (aidisabled == 0) + aidisabled = 1 + updateDialog() + spawn(10) + if (aidisabled == 1) + aidisabled = 0 + updateDialog() - if(AALARM_WIRE_AALARM) - // world << "Aalarm wire pulsed" - if (alarm_area.atmosalert(0)) - post_alert(0) - spawn(1) - src.updateUsrDialog() - update_icon() + if(AALARM_WIRE_SYPHON) + mode = AALARM_MODE_REPLACEMENT + apply_mode() - src.updateDialog() - return + if(AALARM_WIRE_AALARM) + if (alarm_area.atmosalert(0)) + apply_danger_level(0) + spawn(1) + updateUsrDialog() + update_icon() -/obj/machinery/alarm/proc/shock(mob/user, prb) - if((stat & (NOPOWER))) // unpowered, no shock - return 0 - if(!prob(prb)) - return 0 //you lucked out, no shock for you - var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread - s.set_up(5, 1, src) - s.start() //sparks always. - if (electrocute_mob(user, get_area(src), src)) - return 1 - else - return 0 - -/obj/machinery/alarm/receive_signal(datum/signal/signal) - if(stat & (NOPOWER|BROKEN)) + updateDialog() return - if (alarm_area.master_air_alarm != src) - if (master_is_operating()) + + proc/shock(mob/user, prb) + if((stat & (NOPOWER))) // unpowered, no shock + return 0 + if(!prob(prb)) + return 0 //you lucked out, no shock for you + var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread + s.set_up(5, 1, src) + s.start() //sparks always. + if (electrocute_mob(user, get_area(src), src)) + return 1 + else + return 0 +/////////////// +//END HACKING// +/////////////// + + + attack_hand(mob/user) + . = ..() + if (.) return - elect_master() - if (alarm_area.master_air_alarm != src) - return - if(!signal || signal.encryption) - return - var/id_tag = signal.data["tag"] - if (!id_tag) - return - if (signal.data["area"] != area_uid) - return - if (signal.data["sigtype"] != "status") + user.machine = src + + if ( (get_dist(src, user) > 1 )) + if (!istype(user, /mob/living/silicon)) + user.machine = null + user << browse(null, "window=air_alarm") + user << browse(null, "window=AAlarmwires") + return + + + else if (istype(user, /mob/living/silicon) && aidisabled) + user << "AI control for this Air Alarm interface has been disabled." + user << browse(null, "window=air_alarm") + return + + if(wiresexposed && (!istype(user, /mob/living/silicon))) + var/t1 = text("[alarm_area.name] Air Alarm WiresAccess Panel
\n") + var/list/AAlarmwires = list( + "Orange" = 1, + "Dark red" = 2, + "White" = 3, + "Yellow" = 4, + "Black" = 5, + ) + for(var/wiredesc in AAlarmwires) + var/is_uncut = AAlarmwires & AAlarmWireColorToFlag[AAlarmwires[wiredesc]] + t1 += "[wiredesc] wire: " + if(!is_uncut) + t1 += "Mend" + + else + t1 += "Cut " + t1 += "Pulse " + + t1 += "
" + t1 += text("
\n[(locked ? "The Air Alarm is locked." : "The Air Alarm is unlocked.")]
\n[((shorted || (stat & (NOPOWER|BROKEN))) ? "The Air Alarm is offline." : "The Air Alarm is working properly!")]
\n[(aidisabled ? "The 'AI control allowed' light is off." : "The 'AI control allowed' light is on.")]") + t1 += text("

Close

") + user << browse(t1, "window=AAlarmwires") + onclose(user, "AAlarmwires") + + if(!shorted) + user << browse(return_text(user),"window=air_alarm") + onclose(user, "air_alarm") + return - var/dev_type = signal.data["device"] - if(!(id_tag in alarm_area.air_scrub_names) && !(id_tag in alarm_area.air_vent_names)) - register_env_machine(id_tag, dev_type) - if(dev_type == "AScr") - alarm_area.air_scrub_info[id_tag] = signal.data - else if(dev_type == "AVP") - alarm_area.air_vent_info[id_tag] = signal.data + proc/return_text(mob/user) + if(!(istype(user, /mob/living/silicon)) && locked) + return "\The [src][return_status()]
[rcon_text()]
(Swipe ID card to unlock interface)" + else + return "\The [src][return_status()]
[rcon_text()]
[return_controls()]" -/obj/machinery/alarm/proc/register_env_machine(var/m_id, var/device_type) - var/new_name - if (device_type=="AVP") - new_name = "[alarm_area.name] Vent Pump #[alarm_area.air_vent_names.len+1]" - alarm_area.air_vent_names[m_id] = new_name - else if (device_type=="AScr") - new_name = "[alarm_area.name] Air Scrubber #[alarm_area.air_scrub_names.len+1]" - alarm_area.air_scrub_names[m_id] = new_name - else - return - spawn (10) - send_signal(m_id, list("init" = new_name) ) + proc/return_status() + var/turf/location = get_turf(src) + var/datum/gas_mixture/environment = location.return_air() + var/total = environment.oxygen + environment.carbon_dioxide + environment.toxins + environment.nitrogen + var/output = "Air Status:
" -/obj/machinery/alarm/proc/refresh_all() - for(var/id_tag in alarm_area.air_vent_names) - var/list/I = alarm_area.air_vent_info[id_tag] - if (I && I["timestamp"]+AALARM_REPORT_TIMEOUT/2 > world.time) - continue - send_signal(id_tag, list("status") ) - for(var/id_tag in alarm_area.air_scrub_names) - var/list/I = alarm_area.air_scrub_info[id_tag] - if (I && I["timestamp"]+AALARM_REPORT_TIMEOUT/2 > world.time) - continue - send_signal(id_tag, list("status") ) + if(total == 0) + output += "Warning: Cannot obtain air sample for analysis." + return output -/obj/machinery/alarm/proc/set_frequency(new_frequency) - radio_controller.remove_object(src, frequency) - frequency = new_frequency - radio_connection = radio_controller.add_object(src, frequency, RADIO_TO_AIRALARM) - -/obj/machinery/alarm/proc/send_signal(var/target, var/list/command)//sends signal 'command' to 'target'. Returns 0 if no radio connection, 1 otherwise - if(!radio_connection) - return 0 - - var/datum/signal/signal = new - signal.transmission_method = 1 //radio signal - signal.source = src - - signal.data = command - signal.data["tag"] = target - signal.data["sigtype"] = "command" - - radio_connection.post_signal(src, signal, RADIO_FROM_AIRALARM) -// world << text("Signal [] Broadcasted to []", command, target) - - return 1 - -/obj/machinery/alarm/proc/return_text() - if(!(istype(usr, /mob/living/silicon)) && locked) - return "[src][return_status()]
(Swipe ID card to unlock interface)" - else - return "[src][return_status()]
[return_controls()]" - -/obj/machinery/alarm/proc/return_status() - var/turf/location = src.loc - var/datum/gas_mixture/environment = location.return_air() - var/total = environment.oxygen + environment.carbon_dioxide + environment.toxins + environment.nitrogen - var/output = "Air Status:
" - - if(total == 0) - output +={"Warning: Cannot obtain air sample for analysis."} - return output - - output += {" + output += {" "} - var/datum/tlv/cur_tlv - var/GET_PP = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume - cur_tlv = TLV["pressure"] - var/environment_pressure = environment.return_pressure() - var/pressure_dangerlevel = cur_tlv.get_danger_level(environment_pressure) + var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume - cur_tlv = TLV["oxygen"] - var/oxygen_dangerlevel = cur_tlv.get_danger_level(environment.oxygen*GET_PP) - var/oxygen_percent = round(environment.oxygen / total * 100, 2) + var/list/current_settings = TLV["pressure"] + var/environment_pressure = environment.return_pressure() + var/pressure_dangerlevel = get_danger_level(environment_pressure, current_settings) - cur_tlv = TLV["carbon dioxide"] - var/co2_dangerlevel = cur_tlv.get_danger_level(environment.carbon_dioxide*GET_PP) - var/co2_percent = round(environment.carbon_dioxide / total * 100, 2) + current_settings = TLV["oxygen"] + var/oxygen_dangerlevel = get_danger_level(environment.oxygen*partial_pressure, current_settings) + var/oxygen_percent = round(environment.oxygen / total * 100, 2) - cur_tlv = TLV["plasma"] - var/plasma_dangerlevel = cur_tlv.get_danger_level(environment.toxins*GET_PP) - var/plasma_percent = round(environment.toxins / total * 100, 2) + current_settings = TLV["carbon dioxide"] + var/co2_dangerlevel = get_danger_level(environment.carbon_dioxide*partial_pressure, current_settings) + var/co2_percent = round(environment.carbon_dioxide / total * 100, 2) - cur_tlv = TLV["other"] - var/other_moles = 0.0 - for(var/datum/gas/G in environment.trace_gases) - other_moles+=G.moles - var/other_dangerlevel = cur_tlv.get_danger_level(other_moles*GET_PP) + current_settings = TLV["plasma"] + var/plasma_dangerlevel = get_danger_level(environment.toxins*partial_pressure, current_settings) + var/plasma_percent = round(environment.toxins / total * 100, 2) - cur_tlv = TLV["temperature"] - var/temperature_dangerlevel = cur_tlv.get_danger_level(environment.temperature) + current_settings = TLV["other"] + var/other_moles = 0.0 + for(var/datum/gas/G in environment.trace_gases) + other_moles+=G.moles + var/other_dangerlevel = get_danger_level(other_moles*partial_pressure, current_settings) - output += {" + current_settings = TLV["temperature"] + var/temperature_dangerlevel = get_danger_level(environment.temperature, current_settings) + + output += {" Pressure: [environment_pressure]kPa
Oxygen: [oxygen_percent]%
Carbon dioxide: [co2_percent]%
Toxins: [plasma_percent]%
"} - if (other_dangerlevel==2) - output += {"Notice: High Concentration of Unknown Particles Detected
"} - else if (other_dangerlevel==1) - output += {"Notice: Low Concentration of Unknown Particles Detected
"} + if (other_dangerlevel==2) + output += "Notice: High Concentration of Unknown Particles Detected
" + else if (other_dangerlevel==1) + output += "Notice: Low Concentration of Unknown Particles Detected
" - output += {" -Temperature: [environment.temperature]K
-"} + output += "Temperature: [environment.temperature]K
" - var/display_danger_level = max( - pressure_dangerlevel, - oxygen_dangerlevel, - co2_dangerlevel, - plasma_dangerlevel, - other_dangerlevel, - temperature_dangerlevel - ) + //Overall status + output += "Local Status: " + switch(max(pressure_dangerlevel,oxygen_dangerlevel,co2_dangerlevel,plasma_dangerlevel,other_dangerlevel,temperature_dangerlevel)) + if(2) + output += "DANGER: Internals Required" + if(1) + output += "Caution" + if(0) + if(alarm_area.atmosalm) + output += {"Caution: Atmos alert in area"} + else + output += {"Optimal"} - //Overall status - output += {"Local Status: "} - if(display_danger_level == 2) - output += {"DANGER: Internals Required"} - else if(display_danger_level == 1) - output += {"Caution"} - else if (alarm_area.atmosalm) - output += {"Caution: Atmos alert in area"} - else - output += {"Optimal"} + output += "

Atmospheric Lockdown: [alarm_area.air_doors_activated ? "ENABLED" : "Disabled"]" - return output + return output -/obj/machinery/alarm/proc/return_controls() - var/output = ""//"[alarm_zone] Air [name]
" + proc/rcon_text() + var/dat = "Remote Control:
" + if(rcon_setting == RCON_NO) + dat += "Off" + else + dat += "Off" + dat += " | " + if(rcon_setting == RCON_AUTO) + dat += "Auto" + else + dat += "Auto" + dat += " | " + if(rcon_setting == RCON_YES) + dat += "On" + else + dat += "On" + return dat - switch(screen) - if (AALARM_SCREEN_MAIN) - if(alarm_area.atmosalm) - output += {"Reset - Atmospheric Alarm
"} - else - output += {"Activate - Atmospheric Alarm
"} + proc/return_controls() + var/output = ""//"[alarm_zone] Air [name]
" - output += {" + switch(screen) + if (AALARM_SCREEN_MAIN) + if(alarm_area.atmosalm) + output += "Reset - Atmospheric Alarm
" + else + output += "Activate - Atmospheric Alarm
" + + output += {" Scrubbers Control
Vents Control
Set environmentals mode
Sensor Settings

"} - if (mode==AALARM_MODE_PANIC) - output += "PANIC SYPHON ACTIVE
Turn syphoning off" - else - output += "ACTIVATE PANIC SYPHON IN AREA" - if (AALARM_SCREEN_VENT) - var/sensor_data = "" - if(alarm_area.air_vent_names.len) - for(var/id_tag in alarm_area.air_vent_names) - var/long_name = alarm_area.air_vent_names[id_tag] - var/list/data = alarm_area.air_vent_info[id_tag] - if(!data) - continue; - var/state = "" - - sensor_data += {" -[long_name][state]
-Operating: -[data["power"]?"on":"off"] -
-Pressure checks: -external -internal -
-External pressure bound: -- -- -- -- -[data["external"]] -+ -+ -+ -+ - (reset) -
-"} - if (data["direction"] == "siphon") - sensor_data += {" -Direction: -siphoning -
-"} - sensor_data += {"
"} - else - sensor_data = "No vents connected.
" - output = {"Main menu
[sensor_data]"} - if (AALARM_SCREEN_SCRUB) - var/sensor_data = "" - if(alarm_area.air_scrub_names.len) - for(var/id_tag in alarm_area.air_scrub_names) - var/long_name = alarm_area.air_scrub_names[id_tag] - var/list/data = alarm_area.air_scrub_info[id_tag] - if(!data) - continue; - var/state = "" - - sensor_data += {" -[long_name][state]
-Operating: -[data["power"]?"on":"off"]
-Type: -[data["scrubbing"]?"scrubbing":"syphoning"]
-"} - - if(data["scrubbing"]) - sensor_data += {" -Filtering: -Carbon Dioxide -[data["filter_co2"]?"on":"off"]; -Toxins -[data["filter_toxins"]?"on":"off"]; -Nitrous Oxide -[data["filter_n2o"]?"on":"off"] -
-"} - sensor_data += {" -Panic syphon: [data["panic"]?"PANIC SYPHON ACTIVATED":""] -Dea":"red'>A")]ctivate
-
-"} - else - sensor_data = "No scrubbers connected.
" - output = {"Main menu
[sensor_data]"} - - if (AALARM_SCREEN_MODE) - output += {" -Main menu
-Air machinery mode for the area:" - if (AALARM_SCREEN_SENSORS) - output += {" + output += "ACTIVATE PANIC SYPHON IN AREA" + + + if (AALARM_SCREEN_VENT) + var/sensor_data = "" + if(alarm_area.air_vent_names.len) + for(var/id_tag in alarm_area.air_vent_names) + var/long_name = alarm_area.air_vent_names[id_tag] + var/list/data = alarm_area.air_vent_info[id_tag] + if(!data) + continue; + var/state = "" + + sensor_data += {" + [long_name][state]
+ Operating: + [data["power"]?"on":"off"] +
+ Pressure checks: + external + internal +
+ External pressure bound: + - + - + - + - + [data["external"]] + + + + + + + + + (reset) +
+ "} + if (data["direction"] == "siphon") + sensor_data += {" + Direction: + siphoning +
+ "} + sensor_data += {"
"} + else + sensor_data = "No vents connected.
" + output = {"Main menu
[sensor_data]"} + if (AALARM_SCREEN_SCRUB) + var/sensor_data = "" + if(alarm_area.air_scrub_names.len) + for(var/id_tag in alarm_area.air_scrub_names) + var/long_name = alarm_area.air_scrub_names[id_tag] + var/list/data = alarm_area.air_scrub_info[id_tag] + if(!data) + continue; + var/state = "" + + sensor_data += {" + [long_name][state]
+ Operating: + [data["power"]?"on":"off"]
+ Type: + [data["scrubbing"]?"scrubbing":"syphoning"]
+ "} + + if(data["scrubbing"]) + sensor_data += {" + Filtering: + Carbon Dioxide + [data["filter_co2"]?"on":"off"]; + Toxins + [data["filter_toxins"]?"on":"off"]; + Nitrous Oxide + [data["filter_n2o"]?"on":"off"] +
+ "} + sensor_data += {" + Panic syphon: [data["panic"]?"PANIC SYPHON ACTIVATED":""] + Dea":"red'>A")]ctivate
+
+ "} + else + sensor_data = "No scrubbers connected.
" + output = {"Main menu
[sensor_data]"} + + if (AALARM_SCREEN_MODE) + output += "Main menu
Air machinery mode for the area:" + + if (AALARM_SCREEN_SENSORS) + output += {" Main menu
Alarm thresholds:
Partial pressure for gases @@ -660,318 +803,165 @@ table tr:first-child th:first-child { border: none;} "} - var/list/gases = list( - "oxygen" = "O2", - "carbon dioxide" = "CO2", - "plasma" = "Toxin", - "other" = "Other", - ) - var/list/thresholds = list("min2", "min1", "max1", "max2") - var/datum/tlv/tlv - for (var/g in gases) - output += {" - -"} - tlv = TLV[g] - for (var/v in thresholds) - output += {" - -"} - output += {" - -"} - tlv = TLV["pressure"] - output += {" - -"} - for (var/v in thresholds) - output += {" - -"} - output += {" - -"} - tlv = TLV["temperature"] - output += {" - -"} - for (var/v in thresholds) - output += {" - -"} - output += {" - -"} - output += {"
min2min1max1max2
[gases[g]] -[tlv.vars[v]>=0?tlv.vars[v]:"OFF"] -
Pressure -[tlv.vars[v]>=0?tlv.vars[v]:"OFF"] -
Temperature -[tlv.vars[v]>=0?tlv.vars[v]:"OFF"] -
"} + var/list/gases = list( + "oxygen" = "O2", + "carbon dioxide" = "CO2", + "plasma" = "Toxin", + "other" = "Other",) - return output + var/list/selected + for (var/g in gases) + output += "[gases[g]]" + selected = TLV[g] + for(var/i = 1, i <= 4, i++) + output += "[selected[i] >= 0 ? selected[i] :"OFF"]" + output += "" -/obj/machinery/alarm/Topic(href, href_list) - if(..()) - return - src.add_fingerprint(usr) - usr.set_machine(src) + selected = TLV["pressure"] + output += " Pressure" + for(var/i = 1, i <= 4, i++) + output += "[selected[i] >= 0 ? selected[i] :"OFF"]" + output += "" - if ( (get_dist(src, usr) > 1 )) - if (!istype(usr, /mob/living/silicon)) - usr.unset_machine() - usr << browse(null, "window=air_alarm") - usr << browse(null, "window=AAlarmwires") - return + selected = TLV["temperature"] + output += "Temperature" + for(var/i = 1, i <= 4, i++) + output += "[selected[i] >= 0 ? selected[i] :"OFF"]" + output += "" - if (href_list["AAlarmwires"]) - var/t1 = text2num(href_list["AAlarmwires"]) - if (!( istype(usr.get_active_hand(), /obj/item/weapon/wirecutters) )) - usr << "You need wirecutters!" - return - if (src.isWireColorCut(t1)) - src.mend(t1) - else - src.cut(t1) - else if (href_list["pulse"]) - var/t1 = text2num(href_list["pulse"]) - if (!istype(usr.get_active_hand(), /obj/item/device/multitool)) - usr << "You need a multitool!" - return - if (src.isWireColorCut(t1)) - usr << "You can't pulse a cut wire." - return - else - src.pulse(t1) + return output + Topic(href, href_list) + if(href_list["rcon"]) + rcon_setting = text2num(href_list["rcon"]) - if(href_list["command"]) - var/device_id = href_list["id_tag"] - switch(href_list["command"]) - if( - "power", - "adjust_external_pressure", - "set_external_pressure", - "checks", - "co2_scrub", - "tox_scrub", - "n2o_scrub", - "panic_siphon", - "scrubbing" - ) - send_signal(device_id, list (href_list["command"] = text2num(href_list["val"]))) - spawn(3) - src.updateUsrDialog() + if ( (get_dist(src, usr) > 1 )) + if (!istype(usr, /mob/living/silicon)) + usr.machine = null + usr << browse(null, "window=air_alarm") + usr << browse(null, "window=AAlarmwires") + return - //if("adjust_threshold") //was a good idea but required very wide window - if("set_threshold") - var/env = href_list["env"] - var/varname = href_list["var"] - var/datum/tlv/tlv = TLV[env] - var/newval = input("Enter [varname] for env", "Alarm triggers", tlv.vars[varname]) as num|null + add_fingerprint(usr) + usr.machine = src - if (isnull(newval) || ..() || (locked && !issilicon(usr))) - return - if (newval<0) - tlv.vars[varname] = -1.0 - else if (env=="temperature" && newval>5000) - tlv.vars[varname] = 5000 - else if (env=="pressure" && newval>50*ONE_ATMOSPHERE) - tlv.vars[varname] = 50*ONE_ATMOSPHERE - else if (env!="temperature" && env!="pressure" && newval>200) - tlv.vars[varname] = 200 - else - newval = round(newval,0.01) - tlv.vars[varname] = newval - spawn(1) - src.updateUsrDialog() + if(href_list["command"]) + var/device_id = href_list["id_tag"] + switch(href_list["command"]) + if( "power", + "adjust_external_pressure", + "set_external_pressure", + "checks", + "co2_scrub", + "tox_scrub", + "n2o_scrub", + "panic_siphon", + "scrubbing") - if(href_list["screen"]) - screen = text2num(href_list["screen"]) - spawn(1) - src.updateUsrDialog() + send_signal(device_id, list(href_list["command"] = text2num(href_list["val"]) ) ) + if("set_threshold") + var/env = href_list["env"] + var/threshold = text2num(href_list["var"]) + var/list/selected = TLV[env] + var/list/thresholds = list("lower bound", "low warning", "high warning", "upper bound") + var/newval = input("Enter [thresholds[threshold]] for [env]", "Alarm triggers", selected[threshold]) as null|num + if (isnull(newval) || ..() || (locked && issilicon(usr))) + return + if (newval<0) + selected[threshold] = -1.0 + else if (env=="temperature" && newval>5000) + selected[threshold] = 5000 + else if (env=="pressure" && newval>50*ONE_ATMOSPHERE) + selected[threshold] = 50*ONE_ATMOSPHERE + else if (env!="temperature" && env!="pressure" && newval>200) + selected[threshold] = 200 + else + newval = round(newval,0.01) + selected[threshold] = newval + if(threshold == 1) + if(selected[1] > selected[2]) + selected[2] = selected[1] + if(selected[1] > selected[3]) + selected[3] = selected[1] + if(selected[1] > selected[4]) + selected[4] = selected[1] + if(threshold == 2) + if(selected[1] > selected[2]) + selected[1] = selected[2] + if(selected[2] > selected[3]) + selected[3] = selected[2] + if(selected[2] > selected[4]) + selected[4] = selected[2] + if(threshold == 3) + if(selected[1] > selected[3]) + selected[1] = selected[3] + if(selected[2] > selected[3]) + selected[2] = selected[3] + if(selected[3] > selected[4]) + selected[4] = selected[3] + if(threshold == 4) + if(selected[1] > selected[4]) + selected[1] = selected[4] + if(selected[2] > selected[4]) + selected[2] = selected[4] + if(selected[3] > selected[4]) + selected[3] = selected[4] + apply_mode() - if(href_list["atmos_alarm"]) - if (alarm_area.atmosalert(2)) - post_alert(2) - spawn(1) - src.updateUsrDialog() - update_icon() - if(href_list["atmos_reset"]) - if (alarm_area.atmosalert(0)) - post_alert(0) - spawn(1) - src.updateUsrDialog() - update_icon() + if(href_list["screen"]) + screen = text2num(href_list["screen"]) - if(href_list["mode"]) - mode = text2num(href_list["mode"]) - apply_mode() - spawn(5) - src.updateUsrDialog() + if(href_list["atmos_unlock"]) + switch(href_list["atmos_unlock"]) + if("0") + air_doors_close(1) + if("1") + air_doors_open(1) - return + if(href_list["atmos_alarm"]) + if (alarm_area.atmosalert(2)) + apply_danger_level(2) + update_icon() -/obj/machinery/alarm/proc/apply_mode() - switch(mode) - if(AALARM_MODE_SCRUBBING) - for(var/device_id in alarm_area.air_scrub_names) - send_signal(device_id, list( - "power"= 1, - "co2_scrub"= 1, - "scrubbing"= 1, - "panic_siphon"= 0, - )) - for(var/device_id in alarm_area.air_vent_names) - send_signal(device_id, list( - "power"= 1, - "checks"= 1, - "set_external_pressure"= ONE_ATMOSPHERE - )) + if(href_list["atmos_reset"]) + if (alarm_area.atmosalert(0)) + apply_danger_level(0) + update_icon() - if(AALARM_MODE_VENTING) - for(var/device_id in alarm_area.air_scrub_names) - send_signal(device_id, list( - "power"= 1, - "panic_siphon"= 0, - "scrubbing"= 0 - )) - for(var/device_id in alarm_area.air_vent_names) - send_signal(device_id, list( - "power"= 1, - "checks"= 1, - "set_external_pressure"= ONE_ATMOSPHERE - )) - if( - AALARM_MODE_PANIC, - AALARM_MODE_REPLACEMENT - ) - for(var/device_id in alarm_area.air_scrub_names) - send_signal(device_id, list( - "power"= 1, - "panic_siphon"= 1 - )) - for(var/device_id in alarm_area.air_vent_names) - send_signal(device_id, list( - "power"= 0 - )) - /*if(AALARM_MODE_OFF) Commented out cause the "turn off panic" uses scrubbing mode now instead. - for(var/device_id in alarm_area.air_scrub_names) - send_signal(device_id, list( - "panic_siphon" = 0 - )) - for(var/device_id in alarm_area.air_vent_names) - send_signal(device_id, list( - "power"= 1 - ))*/ + if(href_list["mode"]) + mode = text2num(href_list["mode"]) + apply_mode() -/obj/machinery/alarm/update_icon() - if(wiresexposed) - icon_state = "alarmx" - return - if((stat & (NOPOWER|BROKEN)) || shorted) - icon_state = "alarmp" - return - switch(max(danger_level, alarm_area.atmosalm)) - if (0) - src.icon_state = "alarm0" - if (1) - src.icon_state = "alarm2" //yes, alarm2 is yellow alarm - if (2) - src.icon_state = "alarm1" + if (href_list["AAlarmwires"]) + var/t1 = text2num(href_list["AAlarmwires"]) + if (!( istype(usr.equipped(), /obj/item/weapon/wirecutters) )) + usr << "You need wirecutters!" + return + if (isWireColorCut(t1)) + mend(t1) + else + cut(t1) -/obj/machinery/alarm/process() - if((stat & (NOPOWER|BROKEN)) || shorted) - return + else if (href_list["pulse"]) + var/t1 = text2num(href_list["pulse"]) + if (!istype(usr.equipped(), /obj/item/device/multitool)) + usr << "You need a multitool!" + return + if (isWireColorCut(t1)) + usr << "You can't pulse a cut wire." + return + else + pulse(t1) - var/turf/simulated/location = src.loc - if (!istype(location)) - return 0 + updateUsrDialog() - var/datum/gas_mixture/environment = location.return_air() - - var/datum/tlv/cur_tlv - var/GET_PP = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume - - cur_tlv = TLV["pressure"] - var/environment_pressure = environment.return_pressure() - var/pressure_dangerlevel = cur_tlv.get_danger_level(environment_pressure) - - cur_tlv = TLV["oxygen"] - var/oxygen_dangerlevel = cur_tlv.get_danger_level(environment.oxygen*GET_PP) - - cur_tlv = TLV["carbon dioxide"] - var/co2_dangerlevel = cur_tlv.get_danger_level(environment.carbon_dioxide*GET_PP) - - cur_tlv = TLV["plasma"] - var/plasma_dangerlevel = cur_tlv.get_danger_level(environment.toxins*GET_PP) - - cur_tlv = TLV["other"] - var/other_moles = 0.0 - for(var/datum/gas/G in environment.trace_gases) - other_moles+=G.moles - var/other_dangerlevel = cur_tlv.get_danger_level(other_moles*GET_PP) - - cur_tlv = TLV["temperature"] - var/temperature_dangerlevel = cur_tlv.get_danger_level(environment.temperature) - - var/old_danger_level = danger_level - danger_level = max( - pressure_dangerlevel, - oxygen_dangerlevel, - co2_dangerlevel, - plasma_dangerlevel, - other_dangerlevel, - temperature_dangerlevel - ) - if (old_danger_level!=danger_level) - apply_danger_level() - - if (mode==AALARM_MODE_REPLACEMENT && environment_pressure T0C+200) - src.alarm() // added check of detector status here + alarm() // added check of detector status here return /obj/machinery/firealarm/attack_ai(mob/user as mob) - return src.attack_hand(user) + return attack_hand(user) /obj/machinery/firealarm/bullet_act(BLAH) - return src.alarm() + return alarm() /obj/machinery/firealarm/attack_paw(mob/user as mob) - return src.attack_hand(user) + return attack_hand(user) /obj/machinery/firealarm/emp_act(severity) if(prob(50/severity)) alarm() @@ -1033,38 +1020,36 @@ table tr:first-child th:first-child { border: none;} /obj/machinery/firealarm/attackby(obj/item/weapon/W as obj, mob/user as mob) if (istype(W, /obj/item/weapon/wirecutters)) - src.detecting = !( src.detecting ) - if (src.detecting) - user.visible_message("\red [user] has reconnected [src]'s detecting unit!", "You have reconnected [src]'s detecting unit.") - else - user.visible_message("\red [user] has disconnected [src]'s detecting unit!", "You have disconnected [src]'s detecting unit.") + detecting = !detecting + user.visible_message("\red \The [user] has [detecting ? "re" : "dis" ]connected \the [src]'s detecting unit!",\ + "You have [detecting ? "re" : "dis" ]connected \the [src]'s detecting unit.") else - src.alarm() - src.add_fingerprint(user) + alarm() + add_fingerprint(user) return -/obj/machinery/firealarm/process()//Note: this processing was mostly phased out due to other code, and only runs when needed +/obj/machinery/firealarm/process() if(stat & (NOPOWER|BROKEN)) return -// var/area/A = src.loc -// A = A.loc + var/area/A = get_area(src) + ASSERT(isarea(A)) + if(A.master) + A = A.master -// if(A.fire) -// src.icon_state = "fire1" -// else -// src.icon_state = "fire0" + if(A.fire) + icon_state = "fire1" + else + icon_state = "fire0" - if(src.timing) - if(src.time > 0) - src.time = src.time - ((world.timeofday - last_process)/10) + if (timing) + if (time > 0) + time = round(time) - 1 else - src.alarm() - src.time = 0 - src.timing = 0 - processing_objects.Remove(src) - src.updateDialog() - last_process = world.timeofday + alarm() + time = 0 + timing = 0 + updateDialog() return /obj/machinery/firealarm/power_change() @@ -1080,38 +1065,39 @@ table tr:first-child th:first-child { border: none;} if(user.stat || stat & (NOPOWER|BROKEN)) return - user.set_machine(src) - var/area/A = src.loc + user.machine = src + var/area/A = get_area(src) + ASSERT(isarea(A)) + if(A.master) + A = A.master var/d1 var/d2 if (istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon)) - A = A.loc if (A.fire) d1 = text("Reset - Lockdown", src) else d1 = text("Alarm - Lockdown", src) - if (src.timing) + if (timing) d2 = text("Stop Time Lock", src) else d2 = text("Initiate Time Lock", src) - var/second = round(src.time) % 60 - var/minute = (round(src.time) - second) / 60 + var/second = time % 60 + var/minute = (time - second) / 60 var/dat = "Fire alarm [d1]\n
The current alert level is: [get_security_level()]

\nTimer System: [d2]
\nTime Left: [(minute ? "[minute]:" : null)][second] - - + +\n
" user << browse(dat, "window=firealarm") onclose(user, "firealarm") else - A = A.loc if (A.fire) d1 = text("[]", src, stars("Reset - Lockdown")) else d1 = text("[]", src, stars("Alarm - Lockdown")) - if (src.timing) + if (timing) d2 = text("[]", src, stars("Stop Time Lock")) else d2 = text("[]", src, stars("Initiate Time Lock")) - var/second = round(src.time) % 60 - var/minute = (round(src.time) - second) / 60 + var/second = time % 60 + var/minute = (time - second) / 60 var/dat = "[stars("Fire alarm")] [d1]\n
The current alert level is: [stars(get_security_level())]

\nTimer System: [d2]
\nTime Left: [(minute ? text("[]:", minute) : null)][second] - - + +\n
" user << browse(dat, "window=firealarm") onclose(user, "firealarm") @@ -1121,114 +1107,114 @@ table tr:first-child th:first-child { border: none;} ..() if (usr.stat || stat & (BROKEN|NOPOWER)) return - if ((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon))) - usr.set_machine(src) + if ((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(loc, /turf))) || (istype(usr, /mob/living/silicon))) + usr.machine = src if (href_list["reset"]) - src.reset() + reset() else if (href_list["alarm"]) - src.alarm() + alarm() else if (href_list["time"]) - src.timing = text2num(href_list["time"]) - last_process = world.timeofday - processing_objects.Add(src) + timing = text2num(href_list["time"]) else if (href_list["tp"]) var/tp = text2num(href_list["tp"]) - src.time += tp - src.time = min(max(round(src.time), 0), 120) - src.updateUsrDialog() + time += tp + time = min(max(round(time), 0), 120) + updateUsrDialog() - src.add_fingerprint(usr) + add_fingerprint(usr) else usr << browse(null, "window=firealarm") return return /obj/machinery/firealarm/proc/reset() - if (!( src.working )) - return - var/area/A = src.loc - A = A.loc - if (!( istype(A, /area) )) + if (!working) return + var/area/A = get_area(src) + ASSERT(isarea(A)) + if(A.master) + A = A.master for(var/area/RA in A.related) RA.firereset() return /obj/machinery/firealarm/proc/alarm() - if (!( src.working )) - return - var/area/A = src.loc - A = A.loc - if (!( istype(A, /area) )) + if (!( working )) return + var/area/A = get_area(src) + ASSERT(isarea(A)) + if(A.master) + A = A.master for(var/area/RA in A.related) RA.firealert() - //playsound(src.loc, 'sound/ambience/signal.ogg', 75, 0) + //playsound(loc, 'signal.ogg', 75, 0) return /obj/machinery/partyalarm/attack_paw(mob/user as mob) - return src.attack_hand(user) + return attack_hand(user) + /obj/machinery/partyalarm/attack_hand(mob/user as mob) if(user.stat || stat & (NOPOWER|BROKEN)) return - user.set_machine(src) - var/area/A = src.loc + user.machine = src + var/area/A = get_area(src) + ASSERT(isarea(A)) + if(A.master) + A = A.master var/d1 var/d2 if (istype(user, /mob/living/carbon/human) || istype(user, /mob/living/silicon/ai)) - A = A.loc if (A.party) d1 = text("No Party :(", src) else d1 = text("PARTY!!!", src) - if (src.timing) + if (timing) d2 = text("Stop Time Lock", src) else d2 = text("Initiate Time Lock", src) - var/second = src.time % 60 - var/minute = (src.time - second) / 60 + var/second = time % 60 + var/minute = (time - second) / 60 var/dat = text("Party Button []\n
\nTimer System: []
\nTime Left: [][] - - + +\n
", d1, d2, (minute ? text("[]:", minute) : null), second, src, src, src, src) user << browse(dat, "window=partyalarm") onclose(user, "partyalarm") else - A = A.loc if (A.fire) d1 = text("[]", src, stars("No Party :(")) else d1 = text("[]", src, stars("PARTY!!!")) - if (src.timing) + if (timing) d2 = text("[]", src, stars("Stop Time Lock")) else d2 = text("[]", src, stars("Initiate Time Lock")) - var/second = src.time % 60 - var/minute = (src.time - second) / 60 + var/second = time % 60 + var/minute = (time - second) / 60 var/dat = text("[] []\n
\nTimer System: []
\nTime Left: [][] - - + +\n
", stars("Party Button"), d1, d2, (minute ? text("[]:", minute) : null), second, src, src, src, src) user << browse(dat, "window=partyalarm") onclose(user, "partyalarm") return /obj/machinery/partyalarm/proc/reset() - if (!( src.working )) - return - var/area/A = src.loc - A = A.loc - if (!( istype(A, /area) )) + if (!( working )) return + var/area/A = get_area(src) + ASSERT(isarea(A)) + if(A.master) + A = A.master A.partyreset() return /obj/machinery/partyalarm/proc/alarm() - if (!( src.working )) - return - var/area/A = src.loc - A = A.loc - if (!( istype(A, /area) )) + if (!( working )) return + var/area/A = get_area(src) + ASSERT(isarea(A)) + if(A.master) + A = A.master A.partyalert() return @@ -1236,25 +1222,25 @@ table tr:first-child th:first-child { border: none;} ..() if (usr.stat || stat & (BROKEN|NOPOWER)) return - if ((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon/ai))) - usr.set_machine(src) + if ((usr.contents.Find(src) || ((get_dist(src, usr) <= 1) && istype(loc, /turf))) || (istype(usr, /mob/living/silicon/ai))) + usr.machine = src if (href_list["reset"]) - src.reset() + reset() else if (href_list["alarm"]) - src.alarm() + alarm() else if (href_list["time"]) - src.timing = text2num(href_list["time"]) + timing = text2num(href_list["time"]) else if (href_list["tp"]) var/tp = text2num(href_list["tp"]) - src.time += tp - src.time = min(max(round(src.time), 0), 120) - src.updateUsrDialog() + time += tp + time = min(max(round(time), 0), 120) + updateUsrDialog() - src.add_fingerprint(usr) + add_fingerprint(usr) else usr << browse(null, "window=partyalarm") return - return + return \ No newline at end of file diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 14e544dcb05..a374abd6fd9 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -1,26 +1,62 @@ /var/const/OPEN = 1 /var/const/CLOSED = 2 - /obj/machinery/door/firedoor - name = "Firelock" - desc = "Apply crowbar" - icon = 'icons/obj/doors/Doorfire.dmi' + name = "\improper Emergency Shutter" + desc = "Emergency air-tight shutter, capable of sealing off breached areas." + icon = 'DoorHazard.dmi' icon_state = "door_open" + req_access = list(access_atmospherics, access_engine_equip) opacity = 0 density = 0 - power_channel = ENVIRON + var/blocked = 0 var/nextstate = null + var/net_id + var/list/areas_added + var/list/users_to_open + + New() + . = ..() + var/area/A = get_area(src) + ASSERT(istype(A)) + + A.all_doors.Add(src) + areas_added = list(A) + + for(var/direction in cardinal) + A = get_area(get_step(src,direction)) + if(istype(A) && !(A in areas_added)) + A.all_doors.Add(src) + areas_added += A + + + Del() + for(var/area/A in areas_added) + A.all_doors.Remove(src) + . = ..() + + + examine() + set src in view() + . = ..() + if( islist(users_to_open) && users_to_open.len) + var/users_to_open_string = users_to_open[1] + if(users_to_open.len >= 2) + for(var/i = 2 to users_to_open.len) + users_to_open_string += ", [users_to_open[i]]" + usr << "These people have opened \the [src] during an alert: [users_to_open_string]." Bumped(atom/AM) - if(p_open || operating) return - if(!density) return ..() + if(p_open || operating) + return + if(!density) + return ..() return 0 power_change() - if(powered(power_channel)) + if(powered(ENVIRON)) stat &= ~NOPOWER else stat |= NOPOWER @@ -29,24 +65,95 @@ attackby(obj/item/weapon/C as obj, mob/user as mob) add_fingerprint(user) - if(operating) return//Already doing something. + if(operating) + return//Already doing something. if(istype(C, /obj/item/weapon/weldingtool)) var/obj/item/weapon/weldingtool/W = C if(W.remove_fuel(0, user)) blocked = !blocked - user << text("\red You [blocked?"welded":"unwelded"] the [src]") + user.visible_message("\red \The [user] [blocked ? "welds" : "unwelds"] \the [src] with \a [W].",\ + "You [blocked ? "weld" : "unweld"] \the [src] with \the [W].",\ + "You hear something being welded.") update_icon() return - if(istype(C, /obj/item/weapon/crowbar) || (istype(C,/obj/item/weapon/twohanded/fireaxe) && C:wielded == 1)) - if(blocked || operating) return + var/area/A = get_area(src) + ASSERT(istype(A)) + if(A.master) + A = A.master + var/alarmed = A.air_doors_activated || A.fire + + if( istype(C, /obj/item/weapon/crowbar) || ( istype(C,/obj/item/weapon/twohanded/fireaxe) && C:wielded == 1 ) ) + if(operating) + return + if( blocked && istype(C, /obj/item/weapon/crowbar) ) + user.visible_message("\red \The [user] pries at \the [src] with \a [C], but \the [src] is welded in place!",\ + "You try to pry \the [src] [density ? "open" : "closed"], but it is welded in place!",\ + "You hear someone struggle and metal straining.") + return + if( istype(C, /obj/item/weapon/crowbar) ) + if( stat & (BROKEN|NOPOWER) || !density || !alarmed ) + user.visible_message("\red \The [user] forces \the [src] [density ? "open" : "closed"] with \a [C]!",\ + "You force \the [src] [density ? "open" : "closed"] with \the [C]!",\ + "You hear metal strain, and a door [density ? "open" : "close"].") + else if( allowed(user) ) + user.visible_message("\blue \The [user] lifts \the [src] with \a [C].",\ + "\The [src] scans your ID, and obediently opens as you apply your [C].",\ + "You hear metal move, and a door [density ? "open" : "close"].") + else + user.visible_message("\blue \The [user] pries at \the [src] with \a [C], but \the [src] resists being opened.",\ + "\red You pry at \the [src], but it actively resists your efforts. Maybe use your ID, perhaps?",\ + "You hear someone struggling and metal straining") + return + else + user.visible_message("\red \The [user] forces \the [ blocked ? "welded" : "" ] [src] [density ? "open" : "closed"] with \a [C]!",\ + "You force \the [ blocked ? "welded" : "" ] [src] [density ? "open" : "closed"] with \the [C]!",\ + "You hear metal strain and groan, and a door [density ? "open" : "close"].") + if(density) + spawn(0) + open() + else + spawn(0) + close() + + if( !stat && ( istype(C, /obj/item/weapon/card/id) || istype(C, /obj/item/device/pda) ) ) + var/obj/item/weapon/card/id/ID = C + + if( istype(C, /obj/item/device/pda) ) + var/obj/item/device/pda/pda = C + ID = pda.id + if(!istype(ID)) + ID = null + + var/answer = alert(user, "Would you like to [density ? "open" : "close"] this [src.name]?[ alarmed && density && !check_access(ID) ? "\nNote that by doing this, you acknowledge any damages from opening this [src.name]\nas being your own fault, and you will be held accountable under the law." : ""]",\ + "\The [src]", "Yes, [density ? "open" : "close"]", "No") + if(answer == "No") + return + if(user.stat || !user.canmove || user.stunned || user.weakened || user.paralysis || get_dist(src, user) > 1) + user << "Sorry, you must remain able bodied and close to \the [src] in order to use it." + return + + if(alarmed && density && !check_access(ID) && ( ID && !( ID.registered_name in users_to_open ) ) ) + user.visible_message("\red \The [src] opens for \the [user], but only after they acknowledged responsibility for the consequences.",\ + "\The [src] opens after you acknowledge the consequences.",\ + "You hear a beep, and a door opening.") + if(ID && ID.registered_name) + if(!users_to_open) + users_to_open = list() + users_to_open += ID.registered_name + else + user.visible_message("\blue \The [src] [density ? "open" : "close"]s for \the [user].",\ + "\The [src] [density ? "open" : "close"]s.",\ + "You hear a beep, and a door opening.") + if(density) open() - return - else //close it up again //fucking 10/10 commenting here einstein + else close() - return - return + + if(alarmed && !density) + spawn(100) + nextstate = CLOSED process() @@ -54,9 +161,11 @@ return switch(nextstate) if(OPEN) - open() + spawn() + open() if(CLOSED) - close() + spawn() + close() nextstate = null return @@ -83,6 +192,4 @@ return - -//border_only fire doors are special when it comes to air groups /obj/machinery/door/firedoor/border_only \ No newline at end of file diff --git a/code/game/machinery/doors/unpowered.dm b/code/game/machinery/doors/unpowered.dm index b4992059f6f..dce2ab37bda 100644 --- a/code/game/machinery/doors/unpowered.dm +++ b/code/game/machinery/doors/unpowered.dm @@ -4,7 +4,8 @@ Bumped(atom/AM) - if(src.locked) return + if(src.locked) + return ..() return