////////////////////////////////////
///// Rendering stats window ///////
////////////////////////////////////
/obj/mecha/proc/get_stats_html()
. = {"
[src.name] data
[src.get_stats_part()]
[src.get_equipment_list()]
[src.get_commands()]
"}
/obj/mecha/proc/report_internal_damage()
. = ""
var/list/dam_reports = list(
"[MECHA_INT_FIRE]" = "INTERNAL FIRE",
"[MECHA_INT_TEMP_CONTROL]" = "LIFE SUPPORT SYSTEM MALFUNCTION",
"[MECHA_INT_TANK_BREACH]" = "GAS TANK BREACH",
"[MECHA_INT_CONTROL_LOST]" = "COORDINATION SYSTEM CALIBRATION FAILURE - Recalibrate",
"[MECHA_INT_SHORT_CIRCUIT]" = "SHORT CIRCUIT"
)
for(var/tflag in dam_reports)
var/intdamflag = text2num(tflag)
if(internal_damage & intdamflag)
. += dam_reports[tflag]
. += "
"
if(return_pressure() > WARNING_HIGH_PRESSURE)
. += "DANGEROUSLY HIGH CABIN PRESSURE
"
/obj/mecha/proc/get_stats_part()
var/integrity = obj_integrity/max_integrity*100
var/cell_charge = get_charge()
var/datum/gas_mixture/int_tank_air = internal_tank.return_air()
var/tank_pressure = internal_tank ? round(int_tank_air.return_pressure(),0.01) : "None"
var/tank_temperature = internal_tank ? int_tank_air.temperature : "Unknown"
var/cabin_pressure = round(return_pressure(),0.01)
. = {"[report_internal_damage()]
[integrity<30?"DAMAGE LEVEL CRITICAL
":null]
Integrity: [integrity]%
Powercell charge: [isnull(cell_charge)?"No powercell installed":"[cell.percent()]%"]
Air source: [use_internal_tank?"Internal Airtank":"Environment"]
Airtank pressure: [tank_pressure]kPa
Airtank temperature: [tank_temperature]°K|[tank_temperature - T0C]°C
Cabin pressure: [cabin_pressure>WARNING_HIGH_PRESSURE ? "[cabin_pressure]": cabin_pressure]kPa
Cabin temperature: [return_temperature()]°K|[return_temperature() - T0C]°C
[dna_lock?"DNA-locked:
[dna_lock] \[Reset\]
":""]
[thrusters_action.owner ? "Thrusters: [thrusters_active ? "Enabled" : "Disabled"]
" : ""]
[defense_action.owner ? "Defence Mode: [defence_mode ? "Enabled" : "Disabled"]
" : ""]
[overload_action.owner ? "Leg Actuators Overload: [leg_overload_mode ? "Enabled" : "Disabled"]
" : ""]
[smoke_action.owner ? "Smoke: [smoke]
" : ""]
[zoom_action.owner ? "Zoom: [zoom_mode ? "Enabled" : "Disabled"]
" : ""]
[switch_damtype_action.owner ? "Damtype: [damtype]
" : ""]
[phasing_action.owner ? "Phase Modulator: [phasing ? "Enabled" : "Disabled"]
" : ""]
"}
/obj/mecha/proc/get_commands()
. = {"
"}
/obj/mecha/proc/get_equipment_menu() //outputs mecha html equipment menu
. = ""
if(equipment.len)
. += {"
"}
for(var/X in equipment)
var/obj/item/mecha_parts/mecha_equipment/W = X
. += "[W.name]
Detach"
. += "
Available equipment slots: [max_equip-equipment.len]"
. += "
"
/obj/mecha/proc/get_equipment_list() //outputs mecha equipment list in html
if(!equipment.len)
return
. = "Equipment:"
for(var/obj/item/mecha_parts/mecha_equipment/MT in equipment)
. += "
[MT.get_equip_info()]
"
. += "
"
/obj/mecha/proc/get_log_html()
. = "[src.name] Log"
for(var/list/entry in log)
. += {"[entry["time"]] [time2text(entry["date"],"MMM DD")] [entry["year"]]
[entry["message"]]
"}
. += ""
/obj/mecha/proc/output_access_dialog(obj/item/weapon/card/id/id_card, mob/user)
if(!id_card || !user) return
. = {"
Following keycodes are present in this system:
"}
for(var/a in operation_req_access)
. += "[get_access_desc(a)] - Delete
"
. += "
Following keycodes were detected on portable device:
"
for(var/a in id_card.access)
if(a in operation_req_access) continue
var/a_name = get_access_desc(a)
if(!a_name) continue //there's some strange access without a name
. += "[a_name] - Add
"
. += "
Finish "
. += "(Warning! The ID upload panel will be locked. It can be unlocked only through Exosuit Interface.)"
. += ""
user << browse(., "window=exosuit_add_access")
onclose(user, "exosuit_add_access")
/obj/mecha/proc/output_maintenance_dialog(obj/item/weapon/card/id/id_card,mob/user)
if(!id_card || !user) return
. = {"
[add_req_access?"Edit operation keycodes":null]
[maint_access?"Initiate maintenance protocol":null]
[(state>0) ?"Set Cabin Air Pressure":null]
"}
user << browse(., "window=exosuit_maint_console")
onclose(user, "exosuit_maint_console")
/////////////////
///// Topic /////
/////////////////
/obj/mecha/Topic(href, href_list)
..()
if(href_list["close"])
return
if(usr.incapacitated())
return
var/datum/topic_input/filter = new /datum/topic_input(href,href_list)
if(in_range(src, usr))
if(href_list["req_access"] && add_req_access)
output_access_dialog(filter.getObj("id_card"),filter.getMob("user"))
if(href_list["maint_access"] && maint_access)
var/mob/user = filter.getMob("user")
if(user)
if(state==0)
state = 1
to_chat(user, "The securing bolts are now exposed.")
else if(state==1)
state = 0
to_chat(user, "The securing bolts are now hidden.")
output_maintenance_dialog(filter.getObj("id_card"),user)
if(href_list["set_internal_tank_valve"] && state >=1)
var/mob/user = filter.getMob("user")
if(user)
var/new_pressure = input(user,"Input new output pressure","Pressure setting",internal_tank_valve) as num
if(new_pressure)
internal_tank_valve = new_pressure
to_chat(user, "The internal pressure valve has been set to [internal_tank_valve]kPa.")
if(href_list["add_req_access"] && add_req_access && filter.getObj("id_card"))
operation_req_access += filter.getNum("add_req_access")
output_access_dialog(filter.getObj("id_card"),filter.getMob("user"))
if(href_list["del_req_access"] && add_req_access && filter.getObj("id_card"))
operation_req_access -= filter.getNum("del_req_access")
output_access_dialog(filter.getObj("id_card"),filter.getMob("user"))
if(href_list["finish_req_access"])
add_req_access = 0
var/mob/user = filter.getMob("user")
user << browse(null,"window=exosuit_add_access")
if(usr != occupant)
return
if(href_list["update_content"])
send_byjax(src.occupant,"exosuit.browser","content",src.get_stats_part())
if(href_list["select_equip"])
var/obj/item/mecha_parts/mecha_equipment/equip = filter.getObj("select_equip")
if(equip && equip.selectable)
src.selected = equip
src.occupant_message("You switch to [equip]")
src.visible_message("[src] raises [equip]")
send_byjax(src.occupant,"exosuit.browser","eq_list",src.get_equipment_list())
if(href_list["rmictoggle"])
radio.broadcasting = !radio.broadcasting
send_byjax(src.occupant,"exosuit.browser","rmicstate",(radio.broadcasting?"Engaged":"Disengaged"))
if(href_list["rspktoggle"])
radio.listening = !radio.listening
send_byjax(src.occupant,"exosuit.browser","rspkstate",(radio.listening?"Engaged":"Disengaged"))
if(href_list["rfreq"])
var/new_frequency = (radio.frequency + filter.getNum("rfreq"))
if (!radio.freerange || (radio.frequency < 1200 || radio.frequency > 1600))
new_frequency = sanitize_frequency(new_frequency)
radio.set_frequency(new_frequency)
send_byjax(src.occupant,"exosuit.browser","rfreq","[format_frequency(radio.frequency)]")
if (href_list["view_log"])
src.occupant << browse(src.get_log_html(), "window=exosuit_log")
onclose(occupant, "exosuit_log")
if (href_list["change_name"])
var/newname = stripped_input(occupant,"Choose new exosuit name","Rename exosuit","", MAX_NAME_LEN)
if(newname && trim(newname))
name = newname
else
alert(occupant, "nope.avi")
if (href_list["toggle_id_upload"])
add_req_access = !add_req_access
send_byjax(src.occupant,"exosuit.browser","t_id_upload","[add_req_access?"L":"Unl"]ock ID upload panel")
if(href_list["toggle_maint_access"])
if(state)
occupant_message("Maintenance protocols in effect")
return
maint_access = !maint_access
send_byjax(src.occupant,"exosuit.browser","t_maint_access","[maint_access?"Forbid":"Permit"] maintenance protocols")
if(href_list["dna_lock"])
if(occupant && !iscarbon(occupant))
to_chat(occupant, " You do not have any DNA!")
return
dna_lock = occupant.dna.unique_enzymes
occupant_message("You feel a prick as the needle takes your DNA sample.")
if(href_list["reset_dna"])
dna_lock = null
if(href_list["repair_int_control_lost"])
occupant_message("Recalibrating coordination system...")
log_message("Recalibration of coordination system started.")
var/T = loc
spawn(100)
if(T == loc)
clearInternalDamage(MECHA_INT_CONTROL_LOST)
occupant_message("Recalibration successful.")
log_message("Recalibration of coordination system finished with 0 errors.")
else
occupant_message("Recalibration failed!")
log_message("Recalibration of coordination system failed with 1 error.",1)