// Added support for single tank bombs and fingerprints (Convair880).
var/global/datum/bomb_monitor/bomb_monitor = new
/datum/bomb_monitor
var/lists_built = 0
var/list/obj/item/device/transfer_valve/TVs = list()
var/list/obj/item/assembly/detonator/dets = list()
var/list/obj/item/assembly/proximity_bomb/ST_prox = list()
var/list/obj/item/assembly/time_bomb/ST_time = list()
var/list/obj/item/assembly/radio_bomb/ST_radio = list()
var/filter_active_only = 1
disposing()
lists_built = 0
TVs.Cut()
dets.Cut()
ST_prox.Cut()
ST_time.Cut()
ST_radio.Cut()
filter_active_only = 1
..()
proc/build_lists(var/force=0)
if(lists_built && !force) return
TVs.Cut()
dets.Cut()
ST_prox.Cut()
ST_time.Cut()
ST_radio.Cut()
for(var/obj/item/I in world)
if(istype(I, /obj/item/device/transfer_valve))
TVs += I
else if (istype(I, /obj/item/assembly/detonator))
dets += I
else if (istype(I, /obj/item/assembly/proximity_bomb/))
ST_prox += I
else if (istype(I, /obj/item/assembly/time_bomb/))
ST_time += I
else if (istype(I, /obj/item/assembly/radio_bomb/))
ST_radio += I
LAGCHECK(LAG_LOW)
lists_built = 1
proc/display_ui(var/mob/user, var/force_update = 0)
if(!user || !user.client || !user.client.holder) return
build_lists(force_update)
var/temp = ""
for(var/obj/item/device/transfer_valve/TV in TVs)
if(!filter_active_only || (TV.tank_one || TV.tank_two))
var/turf/T = get_turf(TV)
if (!T || !isturf(T)) continue
var/ref_a = "[TV.tank_one]"
var/ref_b = "[TV.tank_two]"
temp += {"
|
[TV.name]
|
[get_area(T)]
|
[showCoords(T.x, T.y, T.z, 0, user.client.holder)]
|
[TV.tank_one ? ref_a : "Nothing"]
|
[TV.tank_two ? ref_b : "Nothing"]
|
[TV.attached_device ? TV.attached_device : "Nothing"]
|
[TV.fingerprintslast ? TV.fingerprintslast : "N/A"]
|
[TV.force_dud ? "YES" : "No"]
|
[TV.tank_one && TV.tank_two ? "Trigger" : ""]
|
"}
var/TTVtable = {"Tank Transfer Valves
| Name | Area name | Coords | Tank 1 | Tank 2 | Detonator | Fingerprints | Force Dud |
[temp]
"}
temp = ""
for (var/obj/item/assembly/proximity_bomb/PB in ST_prox)
var/turf/T = get_turf(PB)
if (!T || !isturf(T)) continue
var/ref_PB = "[PB.part3]"
temp += {"
|
[PB.name]
|
[get_area(T)]
|
[showCoords(T.x, T.y, T.z, 0, user.client.holder)]
|
[PB.part3 ? ref_PB : "Nothing"]
|
[PB.part1 ? PB.part1 : "Nothing"]
|
[PB.fingerprintslast ? PB.fingerprintslast : "N/A"]
|
[PB.force_dud ? "YES" : "No"]
|
[PB.part3 ? "Trigger" : ""]
|
"}
for (var/obj/item/assembly/time_bomb/TB in ST_time)
var/turf/T = get_turf(TB)
if (!T || !isturf(T)) continue
var/ref_TB = "[TB.part3]"
temp += {"
|
[TB.name]
|
[get_area(T)]
|
[showCoords(T.x, T.y, T.z, 0, user.client.holder)]
|
[TB.part3 ? ref_TB : "Nothing"]
|
[TB.part1 ? TB.part1 : "Nothing"]
|
[TB.fingerprintslast ? TB.fingerprintslast : "N/A"]
|
[TB.force_dud ? "YES" : "No"]
|
[TB.part3 ? "Trigger" : ""]
|
"}
for (var/obj/item/assembly/radio_bomb/RB in ST_radio)
var/turf/T = get_turf(RB)
if (!T || !isturf(T)) continue
var/ref_RB = "[RB.part3]"
temp += {"
|
[RB.name]
|
[get_area(T)]
|
[showCoords(T.x, T.y, T.z, 0, user.client.holder)]
|
[RB.part3 ? ref_RB : "Nothing"]
|
[RB.part1 ? RB.part1 : "Nothing"]
|
[RB.fingerprintslast ? RB.fingerprintslast : "N/A"]
|
[RB.force_dud ? "YES" : "No"]
|
[RB.part3 ? "Trigger" : ""]
|
"}
var/STtable = {"Single Tank Bombs
| Name | Area name | Coords | Tank | Detonator | Fingerprints | Force Dud |
[temp]
"}
temp = ""
for(var/obj/item/assembly/detonator/det in dets)
if(!filter_active_only || det.attachedTo)
var/turf/T = get_turf(det)
if (!T || !isturf(T)) continue
var/ref = "[det.attachedTo]"
temp += {"
|
[det.name]
|
[get_area(T)]
|
[showCoords(T.x, T.y, T.z, 0, user.client.holder)]
|
[det.attachedTo ? ref : "Nothing"]
|
[det.fingerprintslast ? det.fingerprintslast : "N/A"]
|
[det.attachedTo && det.attachedTo.fingerprintslast ? det.attachedTo.fingerprintslast : "N/A"]
|
[det.force_dud ? "YES" : "No"]
|
[det.attachedTo ? "Trigger" : ""]
|
"}
var/cantable = {"Canister Bombs
| Name | Area name | Coords | Canister | Fingerprints (Detonator) | Fingerprints (Canister) | Force Dud |
[temp]
"}
temp = {"
Bomb Monitor
Rebuild Lists Refresh Filtering: [filter_active_only ? "Only Complete" : "All"]
[TTVtable]
[STtable]
[cantable]
"}
user.Browse(temp, "window=bomb_monitor;size=750x500")
onclose(user, "bomb_monitor", src)
Topic(href, href_list[])
if(!usr || !usr.client || !usr.client.holder) return
if(href_list["refresh"])
if(href_list["refresh"] == "rebuild")
lists_built = 0
build_lists()
display_ui(usr)
else if(href_list["airmon"])
var/obj/O = locate(href_list["airmon"])
if(O)
boutput(usr, scan_atmospheric(O)) // We've got a global proc for that now (Convair880).
else
boutput(usr, "Unable to locate the object (it's been deleted, somehow. Explosion, probably).")
else if(href_list["toggle_dud"])
var/obj/item/I = locate(href_list["toggle_dud"])
if (!I)
boutput(usr, "Unable to locate the object (it's been deleted, somehow. Explosion, probably).")
return
if (istype(I, /obj/item/assembly/detonator) || istype(I, /obj/item/device/transfer_valve) || istype(I, /obj/item/assembly/proximity_bomb) || istype(I, /obj/item/assembly/time_bomb/) || istype(I, /obj/item/assembly/radio_bomb/))
I:force_dud = !I:force_dud
display_ui(usr)
message_admins("[key_name(usr)] made \the [I] [I:force_dud ? "into a dud" : "able to explode again"] at [log_loc(I)].")
logTheThing("admin", usr, null, "made \the [I] [I:force_dud ? "into a dud" : "able to explode again"] at [log_loc(I)].")
logTheThing("diary", usr, null, "made \the [I] [I:force_dud ? "into a dud" : "able to explode again"] at [log_loc(I)].", "admin")
else if(href_list["filter"])
filter_active_only = !filter_active_only
lists_built=0
display_ui(usr)
else if(href_list["trigger"])
var/obj/item/I = locate(href_list["trigger"])
var/turf/T = get_turf(I)
if (!I || !T || !isturf(T)) // Cannot read null.x
boutput(usr, "Unable to locate the object (it's been deleted, somehow. Explosion, probably).")
return
if (alert("Are you sure you want to detonate \the [I] at [T.x], [T.y], [T.z] ([get_area(I)])?", "Blow shit up.", "Yes", "No") != "Yes") return
if (!I) // Alerts wait for user input. Bomb might not exist anymore.
boutput(usr, "Unable to locate the object (it's been deleted, somehow. Explosion, probably).")
return
message_admins("[key_name(usr)] made \the [I] at [log_loc(I)] detonate!")
logTheThing("admin", usr, null, "made \the [I] at [log_loc(I)] detonate!")
logTheThing("diary", usr, null, "made \the [I] at [log_loc(I)] detonate!", "admin")
if (istype(I, /obj/item/assembly/detonator))
var/obj/item/assembly/detonator/D = I
D.detonate()
else if (istype(I, /obj/item/device/transfer_valve))
var/obj/item/device/transfer_valve/TV = I
TV.toggle_valve()
else if (istype(I, /obj/item/assembly/proximity_bomb/))
var/obj/item/assembly/proximity_bomb/PB = I
PB.part3.ignite()
else if (istype(I, /obj/item/assembly/time_bomb/))
var/obj/item/assembly/time_bomb/TB = I
TB.part3.ignite()
else if (istype(I, /obj/item/assembly/radio_bomb/))
var/obj/item/assembly/radio_bomb/RB = I
RB.part3.ignite()
display_ui(usr, 1)
if(href_list["close"])
usr.Browse(null, "window=bomb_monitor")