diff --git a/code/WorkInProgress/Cael_Aislinn/Economy/Accounts.dm b/code/WorkInProgress/Cael_Aislinn/Economy/Accounts.dm
index 6fef666acad..7fcd57eefd3 100644
--- a/code/WorkInProgress/Cael_Aislinn/Economy/Accounts.dm
+++ b/code/WorkInProgress/Cael_Aislinn/Economy/Accounts.dm
@@ -5,6 +5,7 @@ var/global/list/datum/money_account/department_accounts = list()
var/global/next_account_number = 0
var/global/obj/machinery/account_database/centcomm_account_db
var/global/datum/money_account/vendor_account
+var/global/list/all_money_accounts = list()
/proc/create_station_account()
if(!station_account)
@@ -27,8 +28,7 @@ var/global/datum/money_account/vendor_account
//add the account
station_account.transaction_log.Add(T)
- for(var/obj/machinery/account_database/A in machines)
- A.accounts.Add(station_account)
+ all_money_accounts.Add(station_account)
/proc/create_department_account(department)
next_account_number = rand(111111, 999999)
@@ -50,14 +50,71 @@ var/global/datum/money_account/vendor_account
//add the account
department_account.transaction_log.Add(T)
- for(var/obj/machinery/account_database/A in machines)
- A.accounts.Add(department_account)
+ all_money_accounts.Add(department_account)
department_accounts[department] = department_account
//the current ingame time (hh:mm) can be obtained by calling:
//worldtime2text()
+/proc/create_account(var/new_owner_name = "Default user", var/starting_funds = 0, var/obj/machinery/account_database/source_db)
+
+ //create a new account
+ var/datum/money_account/M = new()
+ M.owner_name = new_owner_name
+ M.remote_access_pin = rand(1111, 111111)
+ M.money = starting_funds
+
+ //create an entry in the account transaction log for when it was created
+ var/datum/transaction/T = new()
+ T.target_name = new_owner_name
+ T.purpose = "Account creation"
+ T.amount = starting_funds
+ if(!source_db)
+ //set a random date, time and location some time over the past few decades
+ T.date = "[num2text(rand(1,31))] [pick("January","February","March","April","May","June","July","August","September","October","November","December")], 25[rand(10,56)]"
+ T.time = "[rand(0,24)]:[rand(11,59)]"
+ T.source_terminal = "NTGalaxyNet Terminal #[rand(111,1111)]"
+
+ M.account_number = rand(111111, 999999)
+ else
+ T.date = current_date_string
+ T.time = worldtime2text()
+ T.source_terminal = source_db.machine_id
+
+ M.account_number = next_account_number
+ next_account_number += rand(1,25)
+
+ //create a sealed package containing the account details
+ var/obj/item/smallDelivery/P = new /obj/item/smallDelivery(source_db.loc)
+
+ var/obj/item/weapon/paper/R = new /obj/item/weapon/paper(P)
+ P.wrapped = R
+ R.name = "Account information: [M.owner_name]"
+ R.info = "Account details (confidential)
"
+ R.info += "Account holder: [M.owner_name]
"
+ R.info += "Account number: [M.account_number]
"
+ R.info += "Account pin: [M.remote_access_pin]
"
+ R.info += "Starting balance: $[M.money]
"
+ R.info += "Date and time: [worldtime2text()], [current_date_string]
"
+ R.info += "Creation terminal ID: [source_db.machine_id]
"
+ R.info += "Authorised NT officer overseeing creation: [source_db.held_card.registered_name]
"
+
+ //stamp the paper
+ var/image/stampoverlay = image('icons/obj/bureaucracy.dmi')
+ stampoverlay.icon_state = "paper_stamp-cent"
+ if(!R.stamped)
+ R.stamped = new
+ R.stamped += /obj/item/weapon/stamp
+ R.overlays += stampoverlay
+ R.stamps += "
This paper has been stamped by the Accounts Database."
+
+ //add the account
+ M.transaction_log.Add(T)
+ all_money_accounts.Add(M)
+
+ return M
+
/datum/money_account
var/owner_name = ""
var/account_number = 0
@@ -82,7 +139,6 @@ var/global/datum/money_account/vendor_account
icon = 'virology.dmi'
icon_state = "analyser"
density = 1
- var/list/accounts = list()
req_one_access = list(access_hop, access_captain)
var/receipt_num
var/machine_id = ""
@@ -156,10 +212,10 @@ var/global/datum/money_account/vendor_account
dat += ""
dat += ""
else
- dat += "Create new account Sync accounts across databases
"
+ dat += "Create new account
"
dat += ""
- for(var/i=1, i<=accounts.len, i++)
- var/datum/money_account/D = accounts[i]
+ for(var/i=1, i<=all_money_accounts.len, i++)
+ var/datum/money_account/D = all_money_accounts[i]
dat += ""
dat += "| #[D.account_number] | "
dat += "[D.owner_name] | "
@@ -193,22 +249,12 @@ var/global/datum/money_account/vendor_account
if(href_list["choice"])
switch(href_list["choice"])
- if("sync_accounts")
- for(var/obj/machinery/account_database/A in machines)
- for(var/datum/money_account/M in src.accounts)
- if(!A.accounts.Find(M))
- A.accounts.Add(M)
- for(var/datum/money_account/M in A.accounts)
- if(!src.accounts.Find(M))
- src.accounts.Add(M)
- usr << "\icon[src] Accounts synched across all NanoTrasen financial databases."
-
if("create_account")
creating_new_account = 1
if("finalise_create_account")
var/account_name = href_list["holder_name"]
var/starting_funds = max(text2num(href_list["starting_funds"]), 0)
- add_account(account_name, starting_funds)
+ create_account(account_name, starting_funds, src)
if(starting_funds > 0)
//subtract the money
station_account.money -= starting_funds
@@ -247,85 +293,18 @@ var/global/datum/money_account/vendor_account
access_level = 1
if("view_account_detail")
var/index = text2num(href_list["account_index"])
- if(index && index <= accounts.len)
- detailed_account_view = accounts[index]
+ if(index && index <= all_money_accounts.len)
+ detailed_account_view = all_money_accounts[index]
if("view_accounts_list")
detailed_account_view = null
creating_new_account = 0
src.attack_hand(usr)
-/obj/machinery/account_database/proc/add_account_across_all(var/new_owner_name = "Default user", var/starting_funds = 0, var/pre_existing = 0)
- var/datum/money_account/M = add_account(new_owner_name, starting_funds, pre_existing)
- for(var/obj/machinery/account_database/D in machines)
- if(D == src)
- continue
- D.accounts.Add(M)
-
- return M
-
-/obj/machinery/account_database/proc/add_account(var/new_owner_name = "Default user", var/starting_funds = 0, var/pre_existing = 0)
-
- //create a new account
- var/datum/money_account/M = new()
- M.owner_name = new_owner_name
- M.remote_access_pin = rand(1111, 111111)
- M.money = starting_funds
-
- //create an entry in the account transaction log for when it was created
- var/datum/transaction/T = new()
- T.target_name = new_owner_name
- T.purpose = "Account creation"
- T.amount = starting_funds
- if(pre_existing)
- //set a random date, time and location some time over the past few decades
- T.date = "[num2text(rand(1,31))] [pick("January","February","March","April","May","June","July","August","September","October","November","December")], 25[rand(10,56)]"
- T.time = "[rand(0,24)]:[rand(11,59)]"
- T.source_terminal = "NTGalaxyNet Terminal #[rand(111,1111)]"
-
- M.account_number = rand(111111, 999999)
- else
- T.date = current_date_string
- T.time = worldtime2text()
- T.source_terminal = machine_id
-
- M.account_number = next_account_number
- next_account_number += rand(1,25)
-
- //create a sealed package containing the account details
- var/obj/item/smallDelivery/P = new(src.loc)
-
- var/obj/item/weapon/paper/R = new(P)
- P.wrapped = R
- R.name = "Account information: [M.owner_name]"
- R.info = "Account details (confidential)
"
- R.info += "Account holder: [M.owner_name]
"
- R.info += "Account number: [M.account_number]
"
- R.info += "Account pin: [M.remote_access_pin]
"
- R.info += "Starting balance: $[M.money]
"
- R.info += "Date and time: [worldtime2text()], [current_date_string]
"
- R.info += "Creation terminal ID: [machine_id]
"
- R.info += "Authorised NT officer overseeing creation: [held_card.registered_name]
"
-
- //stamp the paper
- var/image/stampoverlay = image('icons/obj/bureaucracy.dmi')
- stampoverlay.icon_state = "paper_stamp-cent"
- if(!R.stamped)
- R.stamped = new
- R.stamped += /obj/item/weapon/stamp
- R.overlays += stampoverlay
- R.stamps += "
This paper has been stamped by the Accounts Database."
-
- //add the account
- M.transaction_log.Add(T)
- accounts.Add(M)
-
- return M
-
/obj/machinery/account_database/proc/charge_to_account(var/attempt_account_number, var/source_name, var/purpose, var/terminal_id, var/amount)
if(!activated)
return 0
- for(var/datum/money_account/D in accounts)
+ for(var/datum/money_account/D in all_money_accounts)
if(D.account_number == attempt_account_number)
D.money += amount
@@ -350,7 +329,12 @@ var/global/datum/money_account/vendor_account
/obj/machinery/account_database/proc/attempt_account_access(var/attempt_account_number, var/attempt_pin_number, var/security_level_passed = 0)
if(!activated)
return 0
- for(var/datum/money_account/D in accounts)
+ for(var/datum/money_account/D in all_money_accounts)
if(D.account_number == attempt_account_number)
if( D.security_level <= security_level_passed && (!D.security_level || D.remote_access_pin == attempt_pin_number) )
return D
+
+/obj/machinery/account_database/proc/get_account(var/account_number)
+ for(var/datum/money_account/D in all_money_accounts)
+ if(D.account_number == account_number)
+ return D
diff --git a/code/WorkInProgress/Cael_Aislinn/Economy/EFTPOS.dm b/code/WorkInProgress/Cael_Aislinn/Economy/EFTPOS.dm
index 7df719a2e09..f3160a3f8a5 100644
--- a/code/WorkInProgress/Cael_Aislinn/Economy/EFTPOS.dm
+++ b/code/WorkInProgress/Cael_Aislinn/Economy/EFTPOS.dm
@@ -21,6 +21,30 @@
spawn(0)
print_reference()
+ //create a short manual as well
+ var/obj/item/weapon/paper/R = new(src.loc)
+ R.name = "Steps to success: Correct EFTPOS Usage"
+ R.info += "When first setting up your EFTPOS device:"
+ R.info += "1. Memorise your EFTPOS command code (provided with all EFTPOS devices).
"
+ R.info += "2. Confirm that your EFTPOS device is connected to your local accounts database. For additional assistance with this step, contact NanoTrasen IT Support
"
+ R.info += "3. Confirm that your EFTPOS device has been linked to the account that you wish to recieve funds for all transactions processed on this device.
"
+ R.info += "When starting a new transaction with your EFTPOS device:"
+ R.info += "1. Ensure the device is UNLOCKED so that new data may be entered.
"
+ R.info += "2. Enter a sum of money and reference message for the new transaction.
"
+ R.info += "3. Lock the transaction, it is now ready for your customer.
"
+ R.info += "4. If at this stage you wish to modify or cancel your transaction, you may simply reset (unlock) your EFTPOS device.
"
+ R.info += "5. Give your EFTPOS device to the customer, they must authenticate the transaction by swiping their ID card and entering their PIN number.
"
+ R.info += "6. If done correctly, the transaction will be logged to both accounts with the reference you have entered, the terminal ID of your EFTPOS device and the money transferred across accounts.
"
+
+ //stamp the paper
+ var/image/stampoverlay = image('icons/obj/bureaucracy.dmi')
+ stampoverlay.icon_state = "paper_stamp-cent"
+ if(!R.stamped)
+ R.stamped = new
+ R.stamped += /obj/item/weapon/stamp
+ R.overlays += stampoverlay
+ R.stamps += "
This paper has been stamped by the EFTPOS device."
+
//by default, connect to the station account
//the user of the EFTPOS device can change the target account though, and no-one will be the wiser (except whoever's being charged)
linked_account = station_account
diff --git a/code/WorkInProgress/Mini/ATM.dm b/code/WorkInProgress/Mini/ATM.dm
index 544c439033a..a7c0544591b 100644
--- a/code/WorkInProgress/Mini/ATM.dm
+++ b/code/WorkInProgress/Mini/ATM.dm
@@ -36,9 +36,12 @@ log transactions
/obj/machinery/atm/New()
..()
- reconnect_database()
machine_id = "[station_name()] RT #[num_financial_terminals++]"
+/obj/machinery/atm/initialize()
+ ..()
+ reconnect_database()
+
/obj/machinery/atm/process()
if(stat & NOPOWER)
return
@@ -253,13 +256,15 @@ log transactions
playsound(src, 'buzz-two.ogg', 50, 1)
//create an entry in the account transaction log
- var/datum/transaction/T = new()
- T.target_name = authenticated_account.owner_name
- T.purpose = "Unauthorised login attempt"
- T.source_terminal = machine_id
- T.date = current_date_string
- T.time = worldtime2text()
- authenticated_account.transaction_log.Add(T)
+ var/datum/money_account/failed_account = linked_db.get_account(tried_account_num)
+ if(failed_account)
+ var/datum/transaction/T = new()
+ T.target_name = failed_account.owner_name
+ T.purpose = "Unauthorised login attempt"
+ T.source_terminal = machine_id
+ T.date = current_date_string
+ T.time = worldtime2text()
+ failed_account.transaction_log.Add(T)
else
usr << "\red \icon[src] Incorrect pin/account combination entered, [max_pin_attempts - number_incorrect_tries] attempts remaining."
previous_account_number = tried_account_num
diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm
index 708f710ab39..85fdca943e9 100644
--- a/code/game/gamemodes/game_mode.dm
+++ b/code/game/gamemodes/game_mode.dm
@@ -213,6 +213,8 @@ Implants;
for(var/mob/living/carbon/human/man in player_list) if(man.client && man.mind)
// NT relation option
var/special_role = man.mind.special_role
+ if (special_role == "Wizard" || special_role == "Ninja" || special_role == "Syndicate")
+ continue //NT intelligence ruled out possiblity that those are too classy to pretend to be a crew.
if(man.client.prefs.nanotrasen_relation == "Opposed" && prob(50) || \
man.client.prefs.nanotrasen_relation == "Skeptical" && prob(20))
suspects += man
@@ -473,4 +475,4 @@ proc/get_nt_opposed()
else if(man.client.prefs.nanotrasen_relation == "Skeptical" && prob(50))
dudes += man
if(dudes.len == 0) return null
- return pick(dudes)
\ No newline at end of file
+ return pick(dudes)
diff --git a/code/game/jobs/job_controller.dm b/code/game/jobs/job_controller.dm
index 5456b8e598b..84e96be0f3e 100644
--- a/code/game/jobs/job_controller.dm
+++ b/code/game/jobs/job_controller.dm
@@ -369,7 +369,7 @@ var/global/datum/controller/occupations/job_master
//give them an account in the station database
if(centcomm_account_db)
- var/datum/money_account/M = centcomm_account_db.add_account_across_all(H.real_name, starting_funds = rand(50,500)*10, pre_existing = 1)
+ var/datum/money_account/M = create_account(H.real_name, rand(50,500)*10, null)
if(H.mind)
var/remembered_info = ""
remembered_info += "Your account number is: #[M.account_number]
"
diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm
index 3c39813f5f1..71906ffb3b6 100644
--- a/code/game/machinery/alarm.dm
+++ b/code/game/machinery/alarm.dm
@@ -97,609 +97,613 @@
var/list/TLV = list()
- 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(0,ONE_ATMOSPHERE*0.10,ONE_ATMOSPHERE*1.40,ONE_ATMOSPHERE*1.60) /* kpa */
- TLV["temperature"] = list(20, 40, 140, 160) // K
- target_temperature = 90
- New(var/loc, var/dir, var/building = 0)
- ..()
-
- if(building)
- if(loc)
- src.loc = loc
-
- if(dir)
- src.dir = dir
-
- buildstage = 0
- wiresexposed = 1
- pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24)
- pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0
- update_icon()
- return
-
- first_run()
-
- proc/first_run()
- 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-26, T0C, T0C+40, T0C+66) // K
-
- initialize()
- set_frequency(frequency)
- if (!master_is_operating())
- elect_master()
+/obj/machinery/alarm/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(0,ONE_ATMOSPHERE*0.10,ONE_ATMOSPHERE*1.40,ONE_ATMOSPHERE*1.60) /* kpa */
+ TLV["temperature"] = list(20, 40, 140, 160) // K
+ target_temperature = 90
- process()
- if((stat & (NOPOWER|BROKEN)) || shorted || buildstage != 2)
- return
+/obj/machinery/alarm/New(var/loc, var/dir, var/building = 0)
+ ..()
- var/turf/simulated/location = loc
- if(!istype(location)) return//returns if loc is not simulated
+ if(building)
+ if(loc)
+ src.loc = loc
- var/datum/gas_mixture/environment = location.return_air()
+ if(dir)
+ src.dir = dir
- //Handle temperature adjustment here.
- if(environment.temperature < target_temperature - 2 || environment.temperature > target_temperature + 2 || regulating_temperature)
- //If it goes too far, we should adjust ourselves back before stopping.
- if(get_danger_level(target_temperature, TLV["temperature"]))
- return
-
- if(!regulating_temperature)
- regulating_temperature = 1
- visible_message("\The [src] clicks as it starts [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\
- "You hear a click and a faint electronic hum.")
-
- if(target_temperature > T0C + MAX_TEMPERATURE)
- target_temperature = T0C + MAX_TEMPERATURE
-
- if(target_temperature < T0C + MIN_TEMPERATURE)
- target_temperature = T0C + MIN_TEMPERATURE
-
- var/datum/gas_mixture/gas = location.remove_air(0.25*environment.total_moles)
- var/heat_capacity = gas.heat_capacity()
- var/energy_used = max( abs( heat_capacity*(gas.temperature - target_temperature) ), MAX_ENERGY_CHANGE)
-
- //Use power. Assuming that each power unit represents 1000 watts....
- use_power(energy_used/1000, ENVIRON)
-
- //We need to cool ourselves.
- if(environment.temperature > target_temperature)
- gas.temperature -= energy_used/heat_capacity
- else
- gas.temperature += energy_used/heat_capacity
-
- environment.merge(gas)
-
- if(abs(environment.temperature - target_temperature) <= 0.5)
- regulating_temperature = 0
- visible_message("\The [src] clicks quietly as it stops [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\
- "You hear a click as a faint electronic humming stops.")
-
- var/old_level = danger_level
- danger_level = overall_danger_level()
-
- if (old_level != danger_level)
- refresh_danger_level()
- update_icon()
-
- if (mode==AALARM_MODE_CYCLE && environment.return_pressure()= danger_levels[4] && danger_levels[4] > 0) || current_value <= danger_levels[1])
- return 2
- if((current_value >= danger_levels[3] && danger_levels[3] > 0) || current_value <= danger_levels[2])
- return 1
- return 0
+ // 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-26, T0C, T0C+40, T0C+66) // K
- 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")
+/obj/machinery/alarm/initialize()
+ set_frequency(frequency)
+ if (!master_is_operating())
+ elect_master()
+
+
+/obj/machinery/alarm/process()
+ if((stat & (NOPOWER|BROKEN)) || shorted || buildstage != 2)
+ return
+
+ var/turf/simulated/location = loc
+ if(!istype(location)) return//returns if loc is not simulated
+
+ var/datum/gas_mixture/environment = location.return_air()
+
+ //Handle temperature adjustment here.
+ if(environment.temperature < target_temperature - 2 || environment.temperature > target_temperature + 2 || regulating_temperature)
+ //If it goes too far, we should adjust ourselves back before stopping.
+ if(get_danger_level(target_temperature, TLV["temperature"]))
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
+ if(!regulating_temperature)
+ regulating_temperature = 1
+ visible_message("\The [src] clicks as it starts [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\
+ "You hear a click and a faint electronic hum.")
- 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
+ if(target_temperature > T0C + MAX_TEMPERATURE)
+ target_temperature = T0C + MAX_TEMPERATURE
+
+ if(target_temperature < T0C + MIN_TEMPERATURE)
+ target_temperature = T0C + MIN_TEMPERATURE
+
+ var/datum/gas_mixture/gas = location.remove_air(0.25*environment.total_moles)
+ var/heat_capacity = gas.heat_capacity()
+ var/energy_used = max( abs( heat_capacity*(gas.temperature - target_temperature) ), MAX_ENERGY_CHANGE)
+
+ //Use power. Assuming that each power unit represents 1000 watts....
+ use_power(energy_used/1000, ENVIRON)
+
+ //We need to cool ourselves.
+ if(environment.temperature > target_temperature)
+ gas.temperature -= energy_used/heat_capacity
else
- return
- spawn (10)
- send_signal(m_id, list("init" = new_name) )
+ gas.temperature += energy_used/heat_capacity
- 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") )
+ environment.merge(gas)
- 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)
+ if(abs(environment.temperature - target_temperature) <= 0.5)
+ regulating_temperature = 0
+ visible_message("\The [src] clicks quietly as it stops [environment.temperature > target_temperature ? "cooling" : "heating"] the room.",\
+ "You hear a click as a faint electronic humming stops.")
- 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, "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"= 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, "panic_siphon"= 1) )
- for(var/device_id in alarm_area.air_vent_names)
- send_signal(device_id, list("power"= 1, "checks"= 1, "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, "set_external_pressure"= target_pressure) )
-
- if(AALARM_MODE_OFF)
- 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"= 0) )
-
- proc/apply_danger_level(var/new_danger_level)
- if (alarm_area.atmosalert(new_danger_level))
- post_alert(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)
+ var/old_level = danger_level
+ danger_level = overall_danger_level()
+ if (old_level != danger_level)
+ refresh_danger_level()
update_icon()
- proc/post_alert(alert_level)
- var/datum/radio_frequency/frequency = radio_controller.return_frequency(alarm_frequency)
- if(!frequency)
+ if (mode==AALARM_MODE_CYCLE && environment.return_pressure()= danger_levels[4] && danger_levels[4] > 0) || current_value <= danger_levels[1])
+ return 2
+ if((current_value >= danger_levels[3] && danger_levels[3] > 0) || current_value <= danger_levels[2])
+ return 1
+ return 0
+
+/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)
+ icon_state = "alarm0"
+ if (1)
+ icon_state = "alarm2" //yes, alarm2 is yellow alarm
+ if (2)
+ icon_state = "alarm1"
+
+/obj/machinery/alarm/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/datum/signal/alert_signal = new
- alert_signal.source = src
- alert_signal.transmission_method = 1
- alert_signal.data["zone"] = alarm_area.name
- alert_signal.data["type"] = "Atmospheric"
+ 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
- if(alert_level==2)
- alert_signal.data["alert"] = "severe"
- else if (alert_level==1)
- alert_signal.data["alert"] = "minor"
- else if (alert_level==0)
- alert_signal.data["alert"] = "clear"
+/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) )
- frequency.post_signal(src, alert_signal)
+/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") )
- proc/refresh_danger_level()
- var/level = 0
- for (var/area/A in alarm_area.related)
- for (var/obj/machinery/alarm/AA in A)
- if ( !(AA.stat & (NOPOWER|BROKEN)) && !AA.shorted)
- if (AA.danger_level > level)
- level = AA.danger_level
- apply_danger_level(level)
+/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)
- 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
+/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
-/* if(istype(E, /obj/machinery/door/airlock))
- if((!E:arePowerSystemsOn()) || (E.stat & NOPOWER) || E:air_locked) continue
- if(!E.density)
+ 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/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, "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"= 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, "panic_siphon"= 1) )
+ for(var/device_id in alarm_area.air_vent_names)
+ send_signal(device_id, list("power"= 1, "checks"= 1, "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, "set_external_pressure"= target_pressure) )
+
+ if(AALARM_MODE_OFF)
+ 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"= 0) )
+
+/obj/machinery/alarm/proc/apply_danger_level(var/new_danger_level)
+ if (alarm_area.atmosalert(new_danger_level))
+ post_alert(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()
+
+/obj/machinery/alarm/proc/post_alert(alert_level)
+ var/datum/radio_frequency/frequency = radio_controller.return_frequency(alarm_frequency)
+ if(!frequency)
+ return
+
+ var/datum/signal/alert_signal = new
+ alert_signal.source = src
+ alert_signal.transmission_method = 1
+ alert_signal.data["zone"] = alarm_area.name
+ alert_signal.data["type"] = "Atmospheric"
+
+ if(alert_level==2)
+ alert_signal.data["alert"] = "severe"
+ else if (alert_level==1)
+ alert_signal.data["alert"] = "minor"
+ else if (alert_level==0)
+ alert_signal.data["alert"] = "clear"
+
+ frequency.post_signal(src, alert_signal)
+
+/obj/machinery/alarm/proc/refresh_danger_level()
+ var/level = 0
+ for (var/area/A in alarm_area.related)
+ for (var/obj/machinery/alarm/AA in A)
+ if ( !(AA.stat & (NOPOWER|BROKEN)) && !AA.shorted)
+ if (AA.danger_level > level)
+ level = AA.danger_level
+ apply_danger_level(level)
+
+/obj/machinery/alarm/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()
- 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)
+ 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)
- 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()*/
+ 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
+/obj/machinery/alarm/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()*/
+ 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)
+/obj/machinery/alarm/proc/isWireColorCut(var/wireColor)
+ var/wireFlag = AAlarmWireColorToFlag[wireColor]
+ return ((AAlarmwires & wireFlag) == 0)
- proc/isWireCut(var/wireIndex)
- var/wireFlag = AAlarmIndexToFlag[wireIndex]
- return ((AAlarmwires & wireFlag) == 0)
+/obj/machinery/alarm/proc/isWireCut(var/wireIndex)
+ var/wireFlag = AAlarmIndexToFlag[wireIndex]
+ return ((AAlarmwires & wireFlag) == 0)
- proc/allWiresCut()
- var/i = 1
- while(i<=5)
- if(AAlarmwires & AAlarmIndexToFlag[i])
- return 0
- i++
- return 1
+/obj/machinery/alarm/proc/allWiresCut()
+ var/i = 1
+ while(i<=5)
+ if(AAlarmwires & AAlarmIndexToFlag[i])
+ return 0
+ i++
+ return 1
- proc/cut(var/wireColor)
- var/wireFlag = AAlarmWireColorToFlag[wireColor]
- var/wireIndex = AAlarmWireColorToIndex[wireColor]
- AAlarmwires &= ~wireFlag
- switch(wireIndex)
- if(AALARM_WIRE_IDSCAN)
+/obj/machinery/alarm/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()
+
+ 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
+
+/obj/machinery/alarm/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
+
+/obj/machinery/alarm/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)
- shock(usr, 50)
+ if (AALARM_WIRE_POWER)
+ if(shorted == 0)
shorted = 1
update_icon()
- 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
+ spawn(1200)
+ if(shorted == 1)
+ shorted = 0
update_icon()
- spawn(1200)
- if(shorted == 1)
- shorted = 0
- update_icon()
-
- if (AALARM_WIRE_AI_CONTROL)
- if (aidisabled == 0)
- aidisabled = 1
+ if (AALARM_WIRE_AI_CONTROL)
+ if (aidisabled == 0)
+ aidisabled = 1
+ updateDialog()
+ spawn(10)
+ if (aidisabled == 1)
+ aidisabled = 0
updateDialog()
- spawn(10)
- if (aidisabled == 1)
- aidisabled = 0
- updateDialog()
- if(AALARM_WIRE_SYPHON)
- mode = AALARM_MODE_REPLACEMENT
- apply_mode()
+ if(AALARM_WIRE_SYPHON)
+ mode = AALARM_MODE_REPLACEMENT
+ apply_mode()
- if(AALARM_WIRE_AALARM)
- if (alarm_area.atmosalert(0))
- apply_danger_level(0)
- spawn(1)
- updateUsrDialog()
- update_icon()
+ if(AALARM_WIRE_AALARM)
+ if (alarm_area.atmosalert(0))
+ apply_danger_level(0)
+ spawn(1)
+ updateUsrDialog()
+ update_icon()
- updateDialog()
- return
+ updateDialog()
+ return
- 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/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_ai(mob/user)
- return interact(user)
+/obj/machinery/alarm/attack_ai(mob/user)
+ return interact(user)
- attack_hand(mob/user)
- . = ..()
- if (.)
- return
- return interact(user)
+/obj/machinery/alarm/attack_hand(mob/user)
+ . = ..()
+ if (.)
+ return
+ return interact(user)
- interact(mob/user)
- user.set_machine(src)
-
- if(buildstage!=2)
- return
-
- 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")
+/obj/machinery/alarm/interact(mob/user)
+ user.set_machine(src)
+ if(buildstage!=2)
return
- 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()]"
+ 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
- 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:
"
- if(total == 0)
- output += "Warning: Cannot obtain air sample for analysis."
- return output
+ 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
- output += {"
+ if(wiresexposed && (!istype(user, /mob/living/silicon)))
+ var/t1 = text("[alarm_area.name] Air Alarm WiresAccess Panel
\n")
+ var/list/wirecolors = list(
+ "Orange" = 1,
+ "Dark red" = 2,
+ "White" = 3,
+ "Yellow" = 4,
+ "Black" = 5,
+ )
+ for(var/wiredesc in wirecolors)
+ var/is_uncut = AAlarmwires & AAlarmWireColorToFlag[wirecolors[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
+
+/obj/machinery/alarm/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/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:
"
+
+ if(total == 0)
+ output += "Warning: Cannot obtain air sample for analysis."
+ return output
+
+ output += {"
"}
- var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
+ var/partial_pressure = R_IDEAL_GAS_EQUATION*environment.temperature/environment.volume
- var/list/current_settings = TLV["pressure"]
- var/environment_pressure = environment.return_pressure()
- var/pressure_dangerlevel = get_danger_level(environment_pressure, current_settings)
+ var/list/current_settings = TLV["pressure"]
+ var/environment_pressure = environment.return_pressure()
+ var/pressure_dangerlevel = get_danger_level(environment_pressure, current_settings)
- 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)
+ 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)
- 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)
+ 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)
- 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)
+ 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)
- 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["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)
+ current_settings = TLV["temperature"]
+ var/temperature_dangerlevel = get_danger_level(environment.temperature, current_settings)
- output += {"
+ 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 ([round(environment.temperature - T0C, 0.1)]C)
"
+ output += "Temperature: [environment.temperature]K ([round(environment.temperature - T0C, 0.1)]C)
"
- //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: "
+ 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"}
- return output
+ return output
- 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 | "
+/obj/machinery/alarm/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 | "
- //Hackish, I know. I didn't feel like bothering to rework all of this.
- dat += "Thermostat: [target_temperature - T0C]C |
"
+ //Hackish, I know. I didn't feel like bothering to rework all of this.
+ dat += "Thermostat: [target_temperature - T0C]C |
"
- return dat
+ return dat
- proc/return_controls()
- var/output = ""//"[alarm_zone] Air [name]
"
+/obj/machinery/alarm/proc/return_controls()
+ var/output = ""//"[alarm_zone] Air [name]
"
- switch(screen)
- if (AALARM_SCREEN_MAIN)
- if(alarm_area.atmosalm)
- output += "Reset - Atmospheric Alarm
"
- else
- output += "Activate - Atmospheric Alarm
"
+ switch(screen)
+ if (AALARM_SCREEN_MAIN)
+ if(alarm_area.atmosalm)
+ output += "Reset - Atmospheric Alarm
"
+ else
+ output += "Activate - Atmospheric Alarm
"
- output += {"
+ 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 (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 = ""
+ 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 += {"
- [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 = ""
+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 += {"
- [long_name][state]
- Operating:
- [data["power"]?"on":"off"]
- Type:
- [data["scrubbing"]?"scrubbing":"syphoning"]
- "}
+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(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
-
- "}
+ if (AALARM_SCREEN_MODE)
+ output += "Main menu
Air machinery mode for the area:"
+ var/list/modes = list(AALARM_MODE_SCRUBBING = "Filtering - Scrubs out contaminants",\
+ AALARM_MODE_REPLACEMENT = "Replace Air - Siphons out air while replacing",\
+ AALARM_MODE_PANIC = "Panic - Siphons air out of the room",\
+ AALARM_MODE_CYCLE = "Cycle - Siphons air before replacing",\
+ AALARM_MODE_FILL = "Fill - Shuts off scrubbers and opens vents",\
+ AALARM_MODE_OFF = "Off - Shuts off vents and scrubbers",)
+ for (var/m=1,m<=modes.len,m++)
+ if (mode==m)
+ output += "- [modes[m]] (selected)
"
else
- sensor_data = "No scrubbers connected.
"
- output = {"Main menu
[sensor_data]"}
+ output += "- [modes[m]]
"
+ output += "
"
- if (AALARM_SCREEN_MODE)
- output += "Main menu
Air machinery mode for the area:"
- var/list/modes = list(AALARM_MODE_SCRUBBING = "Filtering - Scrubs out contaminants",\
- AALARM_MODE_REPLACEMENT = "Replace Air - Siphons out air while replacing",\
- AALARM_MODE_PANIC = "Panic - Siphons air out of the room",\
- AALARM_MODE_CYCLE = "Cycle - Siphons air before replacing",\
- AALARM_MODE_FILL = "Fill - Shuts off scrubbers and opens vents",\
- AALARM_MODE_OFF = "Off - Shuts off vents and scrubbers",)
- for (var/m=1,m<=modes.len,m++)
- if (mode==m)
- output += "- [modes[m]] (selected)
"
- else
- output += "- [modes[m]]
"
- output += "
"
-
- if (AALARM_SCREEN_SENSORS)
- output += {"
+ if (AALARM_SCREEN_SENSORS)
+ output += {"
Main menu
Alarm thresholds:
Partial pressure for gases
@@ -919,170 +923,175 @@ table tr:first-child th:first-child { border: none;}
| min2 | min1 | max1 | max2 |
"}
- var/list/gases = list(
- "oxygen" = "O2",
- "carbon dioxide" = "CO2",
- "plasma" = "Toxin",
- "other" = "Other",)
+ var/list/gases = list(
+ "oxygen" = "O2",
+ "carbon dioxide" = "CO2",
+ "plasma" = "Toxin",
+ "other" = "Other",)
- 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 += "
"
-
- selected = TLV["pressure"]
- output += " | Pressure | "
+ 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 += "[selected[i] >= 0 ? selected[i] :"OFF"] | "
output += "
"
- selected = TLV["temperature"]
- output += "| Temperature | "
- for(var/i = 1, i <= 4, i++)
- output += "[selected[i] >= 0 ? selected[i] :"OFF"] | "
- output += "
|---|
"
+ selected = TLV["pressure"]
+ output += " | Pressure | "
+ for(var/i = 1, i <= 4, i++)
+ output += "[selected[i] >= 0 ? selected[i] :"OFF"] | "
+ output += "
"
- return output
+ selected = TLV["temperature"]
+ output += "| Temperature | "
+ for(var/i = 1, i <= 4, i++)
+ output += "[selected[i] >= 0 ? selected[i] :"OFF"] | "
+ output += "
|---|
"
- Topic(href, href_list)
+ return output
- if(href_list["rcon"])
- rcon_setting = text2num(href_list["rcon"])
+/obj/machinery/alarm/Topic(href, href_list)
- 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(href_list["rcon"])
+ rcon_setting = text2num(href_list["rcon"])
- add_fingerprint(usr)
- usr.machine = src
+ 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(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")
+ add_fingerprint(usr)
+ usr.machine = src
- send_signal(device_id, list(href_list["command"] = text2num(href_list["val"]) ) )
+ 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("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]
+ send_signal(device_id, list(href_list["command"] = text2num(href_list["val"]) ) )
- apply_mode()
+ 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]
- if(href_list["screen"])
- screen = text2num(href_list["screen"])
+ apply_mode()
- if(href_list["atmos_unlock"])
- switch(href_list["atmos_unlock"])
- if("0")
- air_doors_close(1)
- if("1")
- air_doors_open(1)
+ if(href_list["screen"])
+ screen = text2num(href_list["screen"])
- if(href_list["atmos_alarm"])
- if (alarm_area.atmosalert(2))
- apply_danger_level(2)
- update_icon()
+ if(href_list["atmos_unlock"])
+ switch(href_list["atmos_unlock"])
+ if("0")
+ air_doors_close(1)
+ if("1")
+ air_doors_open(1)
- if(href_list["atmos_reset"])
- if (alarm_area.atmosalert(0))
- apply_danger_level(0)
- update_icon()
+ if(href_list["atmos_alarm"])
+ if (alarm_area.atmosalert(2))
+ apply_danger_level(2)
+ update_icon()
- if(href_list["mode"])
- mode = text2num(href_list["mode"])
- apply_mode()
+ if(href_list["atmos_reset"])
+ if (alarm_area.atmosalert(0))
+ apply_danger_level(0)
+ update_icon()
- if(href_list["temperature"])
- var/list/selected = TLV["temperature"]
- var/max_temperature = min(selected[3] - T0C, MAX_TEMPERATURE)
- var/min_temperature = max(selected[2] - T0C, MIN_TEMPERATURE)
- var/input_temperature = input("What temperature would you like the system to mantain? (Capped between [min_temperature]C and [max_temperature]C)", "Thermostat Controls") as num|null
- if(!input_temperature || input_temperature > max_temperature || input_temperature < min_temperature)
- usr << "Temperature must be between [min_temperature]C and [max_temperature]C"
- else
- target_temperature = input_temperature + T0C
+ if(href_list["mode"])
+ mode = text2num(href_list["mode"])
+ apply_mode()
- 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)
+ if(href_list["temperature"])
+ var/list/selected = TLV["temperature"]
+ var/max_temperature = min(selected[3] - T0C, MAX_TEMPERATURE)
+ var/min_temperature = max(selected[2] - T0C, MIN_TEMPERATURE)
+ var/input_temperature = input("What temperature would you like the system to mantain? (Capped between [min_temperature]C and [max_temperature]C)", "Thermostat Controls") as num|null
+ if(!input_temperature || input_temperature > max_temperature || input_temperature < min_temperature)
+ usr << "Temperature must be between [min_temperature]C and [max_temperature]C"
+ else
+ target_temperature = input_temperature + T0C
- 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)
+ 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)
+ if (AAlarmwires == 0)
+ usr << "You cut last of wires inside [src]"
+ update_icon()
+ buildstage = 1
+ return
- updateUsrDialog()
+ 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)
+
+ updateUsrDialog()
/obj/machinery/alarm/attackby(obj/item/W as obj, mob/user as mob)
@@ -1136,31 +1145,32 @@ table tr:first-child th:first-child { border: none;}
buildstage = 2
update_icon()
first_run()
+ return
else if(istype(W, /obj/item/weapon/crowbar))
- user << "You pry out the circuit!"
+ user << "You start prying out the circuit."
playsound(src.loc, 'sound/items/Crowbar.ogg', 50, 1)
- spawn(20)
+ if(do_after(user,20))
+ user << "You pry out the circuit!"
var/obj/item/weapon/airalarm_electronics/circuit = new /obj/item/weapon/airalarm_electronics()
circuit.loc = user.loc
buildstage = 0
update_icon()
- return
+ return
if(0)
if(istype(W, /obj/item/weapon/airalarm_electronics))
user << "You insert the circuit!"
del(W)
buildstage = 1
update_icon()
+ return
- /* Commented out due to RUNTIMES, RUNTIMES EVERYWHERE.
- else if(istype(W, /obj/item/weapon/wrench))
- user << "You remove the fire alarm assembly from the wall!"
- var/obj/item/firealarm_frame/frame = new /obj/item/firealarm_frame()
- frame.loc = user.loc
- playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
- del(src) */
- return
+ else if(istype(W, /obj/item/weapon/wrench))
+ user << "You remove the fire alarm assembly from the wall!"
+ var/obj/item/alarm_frame/frame = new /obj/item/alarm_frame()
+ frame.loc = user.loc
+ playsound(src.loc, 'sound/items/Ratchet.ogg', 50, 1)
+ del(src)
return ..()
@@ -1172,6 +1182,12 @@ table tr:first-child th:first-child { border: none;}
spawn(rand(0,15))
update_icon()
+/obj/machinery/alarm/examine()
+ ..()
+ if (buildstage < 2)
+ usr << "It is not wired."
+ if (buildstage < 1)
+ usr << "The circuit is missing."
/*
AIR ALARM CIRCUIT
Just a object used in constructing air alarms
@@ -1227,7 +1243,6 @@ Code shamelessly copied from apc_frame
return
new /obj/machinery/alarm(loc, ndir, 1)
-
del(src)
/*
diff --git a/code/game/verbs/ooc.dm b/code/game/verbs/ooc.dm
index 7a76a2c9685..ccfbd30e1ba 100644
--- a/code/game/verbs/ooc.dm
+++ b/code/game/verbs/ooc.dm
@@ -103,8 +103,8 @@ var/global/normal_ooc_colour = "#002eb8"
msg = copytext(sanitize(msg), 1, MAX_MESSAGE_LEN)
if(!msg) return
- if(!(prefs.toggles & CHAT_OOC))
- src << "\red You have OOC muted."
+ if(!(prefs.toggles & CHAT_LOOC))
+ src << "\red You have LOOC muted."
return
if(!holder)
@@ -127,14 +127,15 @@ var/global/normal_ooc_colour = "#002eb8"
log_ooc("(LOCAL) [mob.name]/[key] : [msg]")
- for(var/mob/M in hearers())
+ var/list/heard = get_mobs_in_view(7, src.mob)
+ for(var/mob/M in heard)
if(!M.client)
continue
var/client/C = M.client
if (C in admins)
continue //they are handled after that
- if(C.prefs.toggles & CHAT_OOC)
+ if(C.prefs.toggles & CHAT_LOOC)
var/display_name = src.key
if(holder)
if(holder.fakekey)
@@ -144,5 +145,8 @@ var/global/normal_ooc_colour = "#002eb8"
display_name = holder.fakekey
C << "LOOC: [display_name]: [msg]"
for(var/client/C in admins)
- if(C.prefs.toggles & CHAT_OOC)
- C << "LOOC: [src.key]: [msg]"
\ No newline at end of file
+ if(C.prefs.toggles & CHAT_LOOC)
+ var/prefix = "(R)LOOC"
+ if (C.mob in heard)
+ prefix = "LOOC"
+ C << "[prefix]: [src.key]: [msg]"
\ No newline at end of file
diff --git a/code/modules/client/preferences_toggles.dm b/code/modules/client/preferences_toggles.dm
index 19df39e3371..e3773f77857 100644
--- a/code/modules/client/preferences_toggles.dm
+++ b/code/modules/client/preferences_toggles.dm
@@ -95,6 +95,17 @@
src << "You will [(prefs.toggles & CHAT_OOC) ? "now" : "no longer"] see messages on the OOC channel."
feedback_add_details("admin_verb","TOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
+
+/client/verb/listen_looc()
+ set name = "Show/Hide LOOC"
+ set category = "Preferences"
+ set desc = "Toggles seeing Local OutOfCharacter chat"
+ prefs.toggles ^= CHAT_LOOC
+ prefs.save_preferences()
+ src << "You will [(prefs.toggles & CHAT_LOOC) ? "now" : "no longer"] see messages on the LOOC channel."
+ feedback_add_details("admin_verb","TLOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
+
+
/client/verb/Toggle_Soundscape() //All new ambience should be added here so it works with this verb until someone better at things comes up with a fix that isn't awful
set name = "Hear/Silence Ambience"
set category = "Preferences"
diff --git a/code/modules/events/money_hacker.dm b/code/modules/events/money_hacker.dm
index 28541cda071..d3473ce0807 100644
--- a/code/modules/events/money_hacker.dm
+++ b/code/modules/events/money_hacker.dm
@@ -8,12 +8,13 @@
var/obj/machinery/account_database/affected_db
/datum/event/money_hacker/setup()
- for(var/obj/machinery/account_database/DB in world)
- if( DB.z == 1 && !(DB.stat&NOPOWER) && DB.activated && DB.accounts.len)
- affected_db = DB
- break
+ if(all_money_accounts.len)
+ for(var/obj/machinery/account_database/DB in world)
+ if( DB.z == 1 && !(DB.stat&NOPOWER) && DB.activated )
+ affected_db = DB
+ break
if(affected_db)
- affected_account = pick(affected_db.accounts)
+ affected_account = pick(all_money_accounts.len)
else
kill()
return
diff --git a/code/modules/events/money_lotto.dm b/code/modules/events/money_lotto.dm
index a03d6f29690..3ac17a7f4c6 100644
--- a/code/modules/events/money_lotto.dm
+++ b/code/modules/events/money_lotto.dm
@@ -7,8 +7,8 @@
/datum/event/money_lotto/start()
winner_sum = pick(5000, 10000, 50000, 100000, 500000, 1000000, 1500000)
- if(centcomm_account_db.accounts.len)
- var/datum/money_account/D = pick(centcomm_account_db.accounts)
+ if(all_money_accounts.len)
+ var/datum/money_account/D = pick(all_money_accounts)
D.money += winner_sum
var/datum/transaction/T = new()
diff --git a/code/setup.dm b/code/setup.dm
index f4b8d35e2ff..db51f9993e1 100644
--- a/code/setup.dm
+++ b/code/setup.dm
@@ -624,6 +624,7 @@ var/list/TAGGERLOCATIONS = list("Disposals",
#define CHAT_RADIO 512
#define CHAT_ATTACKLOGS 1024
#define CHAT_DEBUGLOGS 2048
+#define CHAT_LOOC 4096
#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_ATTACKLOGS)