Replace most (if not all) output << operators with to_chat(user, message)

Currently, to_chat is literally just a proc that does user << message.
But it'll let us do output modification in the future, especially for
something like Goon's HTML chat.

Big thanks to PJB for his to_chat script, see
https://github.com/d3athrow/vgstation13/pull/6625 for more details.
This commit is contained in:
Tigercat2000
2016-04-05 08:15:05 -07:00
parent 8556d5ed91
commit 9d430844c3
1054 changed files with 17612 additions and 8898 deletions
+64 -32
View File
@@ -72,7 +72,8 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
if(!procname) return
if(targetselected && !hascall(target,procname))
usr << "<font color='red'>Error: callproc(): target has no such call [procname].</font>"
to_chat(usr, "<font color='red'>Error: callproc(): target has no such call [procname].</font>")
return
var/list/lst = get_callproc_args()
@@ -81,7 +82,8 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
if(targetselected)
if(!target)
usr << "<font color='red'>Error: callproc(): owner of proc no longer exists.</font>"
to_chat(usr, "<font color='red'>Error: callproc(): owner of proc no longer exists.</font>")
return
message_admins("[key_name_admin(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].")
log_admin("[key_name(src)] called [target]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].")
@@ -92,7 +94,8 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
log_admin("[key_name(src)] called [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]")
returnval = call(procname)(arglist(lst)) // Pass the lst as an argument list to the proc
usr << "<font color='blue'>[procname] returned: [returnval ? returnval : "null"]</font>"
to_chat(usr, "<font color='blue'>[procname] returned: [returnval ? returnval : "null"]</font>")
feedback_add_details("admin_verb","APC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/callproc_datum(var/A as null|area|mob|obj|turf)
@@ -107,7 +110,8 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
return
if(!hascall(A,procname))
usr << "<span class='warning'>Error: callproc_datum(): target has no such call [procname].</span>"
to_chat(usr, "<span class='warning'>Error: callproc_datum(): target has no such call [procname].</span>")
return
var/list/lst = get_callproc_args()
@@ -115,14 +119,16 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
return
if(!A || !IsValidSrc(A))
usr << "<span class='warning'>Error: callproc_datum(): owner of proc no longer exists.</span>"
to_chat(usr, "<span class='warning'>Error: callproc_datum(): owner of proc no longer exists.</span>")
return
message_admins("[key_name_admin(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]")
log_admin("[key_name(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"]")
spawn()
var/returnval = call(A,procname)(arglist(lst)) // Pass the lst as an argument list to the proc
usr << "<span class='notice'>[procname] returned: [returnval ? returnval : "null"]</span>"
to_chat(usr, "<span class='notice'>[procname] returned: [returnval ? returnval : "null"]</span>")
feedback_add_details("admin_verb","DPC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
@@ -506,41 +512,59 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
var/list/areas_without_intercom = areas_all - areas_with_intercom
var/list/areas_without_camera = areas_all - areas_with_camera
world << "<b>AREAS WITHOUT AN APC:</b>"
to_chat(world, "<b>AREAS WITHOUT AN APC:</b>")
for(var/areatype in areas_without_APC)
world << "* [areatype]"
to_chat(world, "* [areatype]")
to_chat(world, "<b>AREAS WITHOUT AN AIR ALARM:</b>")
world << "<b>AREAS WITHOUT AN AIR ALARM:</b>"
for(var/areatype in areas_without_air_alarm)
world << "* [areatype]"
to_chat(world, "* [areatype]")
to_chat(world, "<b>AREAS WITH TOO MANY APCS:</b>")
world << "<b>AREAS WITH TOO MANY APCS:</b>"
for(var/areatype in areas_with_multiple_APCs)
world << "* [areatype]"
to_chat(world, "* [areatype]")
to_chat(world, "<b>AREAS WITH TOO MANY AIR ALARMS:</b>")
world << "<b>AREAS WITH TOO MANY AIR ALARMS:</b>"
for(var/areatype in areas_with_multiple_air_alarms)
world << "* [areatype]"
to_chat(world, "* [areatype]")
to_chat(world, "<b>AREAS WITHOUT A REQUEST CONSOLE:</b>")
world << "<b>AREAS WITHOUT A REQUEST CONSOLE:</b>"
for(var/areatype in areas_without_RC)
world << "* [areatype]"
to_chat(world, "* [areatype]")
to_chat(world, "<b>AREAS WITHOUT ANY LIGHTS:</b>")
world << "<b>AREAS WITHOUT ANY LIGHTS:</b>"
for(var/areatype in areas_without_light)
world << "* [areatype]"
to_chat(world, "* [areatype]")
to_chat(world, "<b>AREAS WITHOUT A LIGHT SWITCH:</b>")
world << "<b>AREAS WITHOUT A LIGHT SWITCH:</b>"
for(var/areatype in areas_without_LS)
world << "* [areatype]"
to_chat(world, "* [areatype]")
to_chat(world, "<b>AREAS WITHOUT ANY INTERCOMS:</b>")
world << "<b>AREAS WITHOUT ANY INTERCOMS:</b>"
for(var/areatype in areas_without_intercom)
world << "* [areatype]"
to_chat(world, "* [areatype]")
to_chat(world, "<b>AREAS WITHOUT ANY CAMERAS:</b>")
world << "<b>AREAS WITHOUT ANY CAMERAS:</b>"
for(var/areatype in areas_without_camera)
world << "* [areatype]"
to_chat(world, "* [areatype]")
/client/proc/cmd_admin_dress(var/mob/living/carbon/human/M in mob_list)
set category = "Event"
@@ -1166,21 +1190,29 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
switch(input("Which list?") in list("Players","Admins","Mobs","Living Mobs","Dead Mobs","Silicons","Clients","Respawnable Mobs"))
if("Players")
usr << jointext(player_list,",")
to_chat(usr, jointext(player_list,","))
if("Admins")
usr << jointext(admins,",")
to_chat(usr, jointext(admins,","))
if("Mobs")
usr << jointext(mob_list,",")
to_chat(usr, jointext(mob_list,","))
if("Living Mobs")
usr << jointext(living_mob_list,",")
to_chat(usr, jointext(living_mob_list,","))
if("Dead Mobs")
usr << jointext(dead_mob_list,",")
to_chat(usr, jointext(dead_mob_list,","))
if("Silicons")
usr << jointext(silicon_mob_list,",")
to_chat(usr, jointext(silicon_mob_list,","))
if("Clients")
usr << jointext(clients,",")
to_chat(usr, jointext(clients,","))
if("Respawnable Mobs")
usr << jointext(respawnable_list,",")
to_chat(usr, jointext(respawnable_list,","))
/client/proc/cmd_admin_toggle_block(var/mob/M,var/block)