mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
refactoring the Stat function for silicon lifeforms
adding messenger functions to cyborgs and refactoring the AI's IM system
This commit is contained in:
@@ -174,28 +174,17 @@ var/list/ai_list = list()
|
||||
//usr <<"You can only change your display once!"
|
||||
//return
|
||||
|
||||
/mob/living/silicon/ai/Stat()
|
||||
..()
|
||||
statpanel("Status")
|
||||
if (client.statpanel == "Status")
|
||||
stat(null, "Station Time: [worldtime2text()]")
|
||||
if(emergency_shuttle.online && emergency_shuttle.location < 2)
|
||||
var/timeleft = emergency_shuttle.timeleft()
|
||||
if (timeleft)
|
||||
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
|
||||
|
||||
if(ticker.mode.name == "AI malfunction")
|
||||
var/datum/game_mode/malfunction/malf = ticker.mode
|
||||
for (var/datum/mind/malfai in malf.malf_ai)
|
||||
if (mind == malfai)
|
||||
if (malf.apcs >= 3)
|
||||
stat(null, "Time until station control secured: [max(malf.AI_win_timeleft/(malf.apcs/3), 0)] seconds")
|
||||
|
||||
if(!stat)
|
||||
stat(null, text("System integrity: [(health+100)/2]%"))
|
||||
else
|
||||
stat(null, text("Systems nonfunctional"))
|
||||
// displays the malf_ai information if the AI is the malf
|
||||
/mob/living/silicon/ai/show_malf_ai()
|
||||
if(ticker.mode.name == "AI malfunction")
|
||||
var/datum/game_mode/malfunction/malf = ticker.mode
|
||||
for (var/datum/mind/malfai in malf.malf_ai)
|
||||
if (mind == malfai) // are we the evil one?
|
||||
if (malf.apcs >= 3)
|
||||
stat(null, "Time until station control secured: [max(malf.AI_win_timeleft/(malf.apcs/3), 0)] seconds")
|
||||
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_alerts()
|
||||
set category = "AI Commands"
|
||||
set name = "Show Alerts"
|
||||
@@ -232,17 +221,11 @@ var/list/ai_list = list()
|
||||
viewalerts = 1
|
||||
src << browse(dat, "window=aialerts&can_close=0")
|
||||
|
||||
// this verb lets the ai see the stations manifest
|
||||
/mob/living/silicon/ai/proc/ai_roster()
|
||||
set category = "AI Commands"
|
||||
set name = "Show Crew Manifest"
|
||||
var/dat
|
||||
|
||||
dat += "<h4>Crew Manifest</h4>"
|
||||
if(data_core)
|
||||
dat += data_core.get_manifest(0) // make it monochrome
|
||||
dat += "<br>"
|
||||
src << browse(dat, "window=airoster")
|
||||
onclose(src, "airoster")
|
||||
show_station_manifest()
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_call_shuttle()
|
||||
set category = "AI Commands"
|
||||
|
||||
@@ -75,23 +75,20 @@
|
||||
..()
|
||||
usr << browse_rsc('html/paigrid.png') // Go ahead and cache the interface resources as early as possible
|
||||
|
||||
|
||||
|
||||
// this function shows the information about being silenced as a pAI in the Status panel
|
||||
/mob/living/silicon/pai/proc/show_silenced()
|
||||
if(src.silence_time)
|
||||
var/timeleft = round((silence_time - world.timeofday)/10 ,1)
|
||||
stat(null, "Communications system reboot in -[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
|
||||
|
||||
|
||||
/mob/living/silicon/pai/Stat()
|
||||
..()
|
||||
statpanel("Status")
|
||||
if (src.client.statpanel == "Status")
|
||||
if(emergency_shuttle.online && emergency_shuttle.location < 2)
|
||||
var/timeleft = emergency_shuttle.timeleft()
|
||||
if (timeleft)
|
||||
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
|
||||
if(src.silence_time)
|
||||
var/timeleft = round((silence_time - world.timeofday)/10 ,1)
|
||||
stat(null, "Communications system reboot in -[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
|
||||
if(!src.stat)
|
||||
stat(null, text("System integrity: [(src.health+100)/2]%"))
|
||||
else
|
||||
stat(null, text("Systems nonfunctional"))
|
||||
|
||||
show_silenced()
|
||||
|
||||
if (proc_holder_list.len)//Generic list for proc_holder objects.
|
||||
for(var/obj/effect/proc_holder/P in proc_holder_list)
|
||||
statpanel("[P.panel]","",P)
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
|
||||
var/obj/item/device/mmi/mmi = null
|
||||
|
||||
var/obj/item/device/pda/ai/rbPDA = null
|
||||
|
||||
var/opened = 0
|
||||
var/emagged = 0
|
||||
var/wiresexposed = 0
|
||||
@@ -101,6 +103,12 @@
|
||||
|
||||
playsound(loc, 'sound/voice/liveagain.ogg', 75, 1)
|
||||
|
||||
// setup the PDA and its name
|
||||
/mob/living/silicon/robot/proc/setup_PDA()
|
||||
if (!rbPDA)
|
||||
rbPDA = new/obj/item/device/pda/ai(src)
|
||||
rbPDA.set_name_and_job(custom_name,braintype)
|
||||
|
||||
//If there's an MMI in the robot, have it ejected when the mob goes away. --NEO
|
||||
//Improved /N
|
||||
/mob/living/silicon/robot/Del()
|
||||
@@ -217,6 +225,8 @@
|
||||
radio.config(channels)
|
||||
updateicon()
|
||||
|
||||
/
|
||||
|
||||
/mob/living/silicon/robot/proc/updatename(var/prefix as text)
|
||||
|
||||
if(istype(mmi, /obj/item/device/mmi/posibrain))
|
||||
@@ -231,6 +241,9 @@
|
||||
changed_name = "[(prefix ? "[prefix] " : "")][braintype]-[num2text(ident)]"
|
||||
real_name = changed_name
|
||||
name = real_name
|
||||
|
||||
// if we've changed our name, we also need to update the display name for our PDA
|
||||
setup_PDA()
|
||||
|
||||
/mob/living/silicon/robot/verb/Namepick()
|
||||
if(custom_name)
|
||||
@@ -250,6 +263,13 @@
|
||||
set name = "Show Alerts"
|
||||
robot_alerts()
|
||||
|
||||
// this verb lets cyborgs see the stations manifest
|
||||
/mob/living/silicon/robot/verb/cmd_station_manifest()
|
||||
set category = "Robot Commands"
|
||||
set name = "Show Station Manifest"
|
||||
show_station_manifest()
|
||||
|
||||
|
||||
/mob/living/silicon/robot/proc/robot_alerts()
|
||||
var/dat = "<HEAD><TITLE>Current Station Alerts</TITLE><META HTTP-EQUIV='Refresh' CONTENT='10'></HEAD><BODY>\n"
|
||||
dat += "<A HREF='?src=\ref[src];mach_close=robotalerts'>Close</A><BR><BR>"
|
||||
@@ -280,35 +300,52 @@
|
||||
return 1
|
||||
return 0
|
||||
|
||||
// this function shows information about the malf_ai gameplay type in the status screen
|
||||
/mob/living/silicon/robot/show_malf_ai()
|
||||
..()
|
||||
if(ticker.mode.name == "AI malfunction")
|
||||
var/datum/game_mode/malfunction/malf = ticker.mode
|
||||
for (var/datum/mind/malfai in malf.malf_ai)
|
||||
if(connected_ai)
|
||||
if(connected_ai.mind == malfai)
|
||||
if(malf.apcs >= 3)
|
||||
stat(null, "Time until station control secured: [max(malf.AI_win_timeleft/(malf.apcs/3), 0)] seconds")
|
||||
else if(ticker.mode:malf_mode_declared)
|
||||
stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]")
|
||||
return 0
|
||||
|
||||
|
||||
// this function displays jetpack pressure in the stat panel
|
||||
/mob/living/silicon/robot/proc/show_jetpack_pressure()
|
||||
// if you have a jetpack, show the internal tank pressure
|
||||
var/obj/item/weapon/tank/jetpack/current_jetpack = installed_jetpack()
|
||||
if (current_jetpack)
|
||||
stat("Internal Atmosphere Info", current_jetpack.name)
|
||||
stat("Tank Pressure", current_jetpack.air_contents.return_pressure())
|
||||
|
||||
|
||||
// this function returns the robots jetpack, if one is installed
|
||||
/mob/living/silicon/robot/proc/installed_jetpack()
|
||||
if(module)
|
||||
return (locate(/obj/item/weapon/tank/jetpack) in module.modules)
|
||||
return 0
|
||||
|
||||
|
||||
// this function displays the cyborgs current cell charge in the stat panel
|
||||
/mob/living/silicon/robot/proc/show_cell_power()
|
||||
if(cell)
|
||||
stat(null, text("Charge Left: [cell.charge]/[cell.maxcharge]"))
|
||||
else
|
||||
stat(null, text("No Cell Inserted!"))
|
||||
|
||||
|
||||
// update the status screen display
|
||||
/mob/living/silicon/robot/Stat()
|
||||
..()
|
||||
statpanel("Status")
|
||||
if (client.statpanel == "Status")
|
||||
if(emergency_shuttle.online && emergency_shuttle.location < 2)
|
||||
var/timeleft = emergency_shuttle.timeleft()
|
||||
if (timeleft)
|
||||
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
|
||||
|
||||
if(ticker.mode.name == "AI malfunction")
|
||||
var/datum/game_mode/malfunction/malf = ticker.mode
|
||||
for (var/datum/mind/malfai in malf.malf_ai)
|
||||
if(connected_ai)
|
||||
if(connected_ai.mind == malfai)
|
||||
if(malf.apcs >= 3)
|
||||
stat(null, "Time until station control secured: [max(malf.AI_win_timeleft/(malf.apcs/3), 0)] seconds")
|
||||
else if(ticker.mode:malf_mode_declared)
|
||||
stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]")
|
||||
|
||||
if(cell)
|
||||
stat(null, text("Charge Left: [cell.charge]/[cell.maxcharge]"))
|
||||
else
|
||||
stat(null, text("No Cell Inserted!"))
|
||||
|
||||
if(module)
|
||||
internal = locate(/obj/item/weapon/tank/jetpack) in module.modules
|
||||
if(internal)
|
||||
stat("Internal Atmosphere Info", internal.name)
|
||||
stat("Tank Pressure", internal.air_contents.return_pressure())
|
||||
show_cell_power()
|
||||
show_jetpack_pressure()
|
||||
|
||||
/mob/living/silicon/robot/restrained()
|
||||
return 0
|
||||
|
||||
@@ -144,4 +144,51 @@
|
||||
return 0
|
||||
if (bot.connected_ai == ai)
|
||||
return 1
|
||||
return 0
|
||||
return 0
|
||||
|
||||
|
||||
// this function shows the health of the pAI in the Status panel
|
||||
/mob/living/silicon/proc/show_system_integrity()
|
||||
if(!src.stat)
|
||||
stat(null, text("System integrity: [(src.health+100)/2]%"))
|
||||
else
|
||||
stat(null, text("Systems nonfunctional"))
|
||||
|
||||
|
||||
// This is a pure virtual function, it should be overwritten by all subclasses
|
||||
/mob/living/silicon/proc/show_malf_ai()
|
||||
return 0
|
||||
|
||||
|
||||
// this function displays the station time in the status panel
|
||||
/mob/living/silicon/proc/show_station_time()
|
||||
stat(null, "Station Time: [worldtime2text()]")
|
||||
|
||||
|
||||
// this function displays the shuttles ETA in the status panel if the shuttle has been called
|
||||
/mob/living/silicon/proc/show_emergency_shuttle_eta()
|
||||
if(emergency_shuttle.online && emergency_shuttle.location < 2)
|
||||
var/timeleft = emergency_shuttle.timeleft()
|
||||
if (timeleft)
|
||||
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
|
||||
|
||||
|
||||
// This adds the basic clock, shuttle recall timer, and malf_ai info to all silicon lifeforms
|
||||
/mob/living/silicon/Stat()
|
||||
..()
|
||||
statpanel("Status")
|
||||
if (src.client.statpanel == "Status")
|
||||
show_station_time()
|
||||
show_emergency_shuttle_eta()
|
||||
show_system_integrity()
|
||||
show_malf_ai()
|
||||
|
||||
// this function displays the stations manifest in a separate window
|
||||
/mob/living/silicon/proc/show_station_manifest()
|
||||
var/dat
|
||||
dat += "<h4>Crew Manifest</h4>"
|
||||
if(data_core)
|
||||
dat += data_core.get_manifest(0) // make it monochrome
|
||||
dat += "<br>"
|
||||
src << browse(dat, "window=airoster")
|
||||
onclose(src, "airoster")
|
||||
Reference in New Issue
Block a user