mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 08:08:49 +01:00
Merge pull request #1394 from Iamgoofball/aicrewtaketwo
- Added a "Show Crew Monitoring Console" Verb to the AI Commands section of the AI's Verbs.
This commit is contained in:
@@ -6,24 +6,18 @@
|
||||
idle_power_usage = 250
|
||||
active_power_usage = 500
|
||||
circuit = "/obj/item/weapon/circuitboard/crew"
|
||||
var/list/tracked = list( )
|
||||
|
||||
|
||||
/obj/machinery/computer/crew/New()
|
||||
tracked = list()
|
||||
..()
|
||||
|
||||
|
||||
/obj/machinery/computer/crew/attack_ai(mob/user)
|
||||
attack_hand(user)
|
||||
interact(user)
|
||||
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
crewmonitor(user)
|
||||
|
||||
/obj/machinery/computer/crew/attack_hand(mob/user)
|
||||
user.set_machine(src)
|
||||
add_fingerprint(user)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
interact(user)
|
||||
crewmonitor(user)
|
||||
|
||||
|
||||
/obj/machinery/computer/crew/update_icon()
|
||||
@@ -53,46 +47,37 @@
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/computer/crew/interact(mob/user)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
if(!istype(user, /mob/living/silicon) && get_dist(src, user) > 1)
|
||||
user.unset_machine()
|
||||
user << browse(null, "window=powcomp")
|
||||
return
|
||||
user.set_machine(src)
|
||||
src.scan()
|
||||
var/t = ""
|
||||
t += "<BR><A href='?src=\ref[src];update=1'>Refresh</A> "
|
||||
t += "<A href='?src=\ref[src];close=1'>Close</A><BR>"
|
||||
t += "<table width='100%'><tr><td width='40%'><h3>Name</h3></td><td width='30%'><h3>Vitals</h3></td><td width='30%'><h3>Position</h3></td></tr>"
|
||||
proc/crewmonitor(mob/user)
|
||||
var/t = "<table width='100%'><tr><td width='40%'><h3>Name</h3></td><td width='30%'><h3>Vitals</h3></td><td width='30%'><h3>Position</h3></td></tr>"
|
||||
var/list/logs = list()
|
||||
for(var/obj/item/clothing/under/C in src.tracked)
|
||||
var/list/tracked = crewscan()
|
||||
for(var/mob/living/carbon/human/H in tracked)
|
||||
var/log = ""
|
||||
var/turf/pos = get_turf(C)
|
||||
if((C) && (C.has_sensor) && (pos) && (pos.z == src.z) && C.sensor_mode)
|
||||
if(istype(C.loc, /mob/living/carbon/human))
|
||||
|
||||
var/mob/living/carbon/human/H = C.loc
|
||||
var/turf/pos = get_turf(H)
|
||||
if(istype(H.w_uniform, /obj/item/clothing/under))
|
||||
var/obj/item/clothing/under/U = H.w_uniform
|
||||
if(pos && pos.z == 1 && U.sensor_mode)
|
||||
var/obj/item/ID = null
|
||||
|
||||
if(H.wear_id)
|
||||
ID = H.wear_id.GetID()
|
||||
|
||||
var/dam1 = round(H.getOxyLoss(),1)
|
||||
var/dam2 = round(H.getToxLoss(),1)
|
||||
var/dam3 = round(H.getFireLoss(),1)
|
||||
var/dam4 = round(H.getBruteLoss(),1)
|
||||
|
||||
var/life_status = "[H.stat > 1 ? "<span class='bad'>Deceased</span>" : "<span class='good'>Living</span>"]"
|
||||
var/damage_report = "(<font color='blue'>[dam1]</font>/<font color='green'>[dam2]</font>/<font color='orange'>[dam3]</font>/<font color='red'>[dam4]</font>)"
|
||||
|
||||
if(ID)
|
||||
log += "<tr><td width='40%'>[ID.name]</td>"
|
||||
else
|
||||
log += "<tr><td width='40%'>Unknown</td>"
|
||||
|
||||
switch(C.sensor_mode)
|
||||
var/damage_report
|
||||
if(U.sensor_mode > 1)
|
||||
var/dam1 = round(H.getOxyLoss(),1)
|
||||
var/dam2 = round(H.getToxLoss(),1)
|
||||
var/dam3 = round(H.getFireLoss(),1)
|
||||
var/dam4 = round(H.getBruteLoss(),1)
|
||||
damage_report = "(<font color='blue'>[dam1]</font>/<font color='green'>[dam2]</font>/<font color='orange'>[dam3]</font>/<font color='red'>[dam4]</font>)"
|
||||
|
||||
switch(U.sensor_mode)
|
||||
if(1)
|
||||
log += "<td width='30%'>[life_status]</td><td width='30%'>Not Available</td></tr>"
|
||||
if(2)
|
||||
@@ -105,22 +90,16 @@
|
||||
for(var/log in logs)
|
||||
t += log
|
||||
t += "</table>"
|
||||
//user << browse(t, "window=crewcomp;size=900x600")
|
||||
//onclose(user, "crewcomp")
|
||||
var/datum/browser/popup = new(user, "crewcomp", name, 900, 600)
|
||||
var/datum/browser/popup = new(user, "crewcomp", "Crew Monitoring", 900, 600)
|
||||
popup.set_content(t)
|
||||
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.open()
|
||||
|
||||
|
||||
/obj/machinery/computer/crew/proc/scan()
|
||||
for(var/obj/item/clothing/under/C in world)
|
||||
if((C.has_sensor) && (istype(C.loc, /mob/living/carbon/human)))
|
||||
var/check = 0
|
||||
for(var/O in src.tracked)
|
||||
if(O == C)
|
||||
check = 1
|
||||
break
|
||||
if(!check)
|
||||
src.tracked.Add(C)
|
||||
return 1
|
||||
proc/crewscan()
|
||||
var/list/tracked = list()
|
||||
for(var/mob/living/carbon/human/H in living_mob_list)
|
||||
if(istype(H.w_uniform, /obj/item/clothing/under))
|
||||
var/obj/item/clothing/under/U = H.w_uniform
|
||||
if(U.has_sensor && U.sensor_mode)
|
||||
tracked.Add(H)
|
||||
return tracked
|
||||
@@ -223,6 +223,10 @@ var/list/ai_list = list()
|
||||
src << browse(dat, "window=airoster")
|
||||
onclose(src, "airoster")
|
||||
|
||||
/mob/living/silicon/ai/verb/ai_crew()
|
||||
set category = "AI Commands"
|
||||
set name = "Crew Monitoring Console"
|
||||
crewmonitor(src)
|
||||
/mob/living/silicon/ai/proc/ai_call_shuttle()
|
||||
set category = "AI Commands"
|
||||
set name = "Call Emergency Shuttle"
|
||||
@@ -331,7 +335,6 @@ var/list/ai_list = list()
|
||||
H.attack_ai(src) //may as well recycle
|
||||
else
|
||||
src << "<span class='notice'>Unable to locate the holopad.</span>"
|
||||
|
||||
if (href_list["track"])
|
||||
var/mob/target = locate(href_list["track"]) in mob_list
|
||||
var/mob/living/silicon/ai/A = locate(href_list["track2"]) in mob_list
|
||||
@@ -681,4 +684,3 @@ var/list/ai_list = list()
|
||||
set name = "State Laws"
|
||||
|
||||
checklaws()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user