Merge pull request #4988 from Miauw62/420

Fixes a bunch of saycode things.
This commit is contained in:
Remie Richards
2014-09-30 10:23:23 +01:00
6 changed files with 32 additions and 52 deletions
+7 -22
View File
@@ -136,13 +136,13 @@
/proc/recursive_hear_check(var/atom/O)
var/list/processing_list = list(O)
var/list/processed_list = list()
var/list/found_mobs = list()
var/list/found_atoms = list()
while(processing_list.len)
var/atom/A = processing_list[1]
if(A.flags & HEAR)
found_mobs |= A
found_atoms |= A
for(var/atom/B in A)
if(!processed_list[B])
@@ -151,7 +151,8 @@
processing_list.Cut(1, 2)
processed_list[A] = A
return found_mobs
return found_atoms
// Better recursive loop, technically sort of not actually recursive cause that shit is retarded, enjoy.
//No need for a recursive limit either
/proc/recursive_mob_check(var/atom/O,var/client_check=1,var/sight_check=1,var/include_radio=1)
@@ -195,7 +196,7 @@
/proc/get_hearers_in_view(var/R, var/atom/source)
// Returns a list of hearers in range of R from source. Used in saycode.
// Returns a list of hearers in view(R) from source (ignoring luminosity). Used in saycode.
var/turf/T = get_turf(source)
var/list/hear = list()
@@ -215,25 +216,9 @@
. = list()
// Returns a list of mobs who can hear any of the radios given in @radios
var/list/speaker_coverage = list()
for(var/i = 1; i <= radios.len; i++)
var/obj/item/device/radio/R = radios[i]
for(var/obj/item/device/radio/R in radios)
if(R)
var/turf/speaker = get_turf(R)
if(speaker)
for(var/turf/T in get_hear(R.canhear_range,speaker))
speaker_coverage[T] = T
// Try to find all the players who can hear the message
for(var/i = 1; i <= player_list.len; i++)
var/mob/M = player_list[i]
if(M)
var/turf/ear = get_turf(M)
if(ear)
if(speaker_coverage[ear])
. |= M
return .
. |= get_hearers_in_view(R.canhear_range, R)
#define SIGN(X) ((X<0)?-1:1)
+13
View File
@@ -363,3 +363,16 @@ var/list/binary = list("0","1")
temp = findtextEx(haystack, ascii2text(text2ascii(needles,i)), start, end) //Note: ascii2text(text2ascii) is faster than copytext()
if(temp) end = temp
return end
//this proc strips html properly, but it's not lazy like the other procs.
//this means that it doesn't just remove < and > and call it a day. seriously, who the fuck thought that would be useful.
/proc/strip_html_properly(var/input)
var/opentag = 1 //These store the position of < and > respectively.
var/closetag = 1
while(1)
opentag = findtext(input, "<")
closetag = findtext(input, ">")
if(!closetag || !opentag)
break
input = copytext(input, 1, opentag) + copytext(input, (closetag + 1))
return input
@@ -94,8 +94,7 @@
/obj/item/device/taperecorder/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq)
if(mytape && recording)
mytape.timestamp += mytape.used_capacity
mytape.storedinfo += "\[[time2text(mytape.used_capacity * 10,"mm:ss")]\] [message]"
mytape.storedinfo += "\[[time2text(mytape.used_capacity * 10,"mm:ss")]\] [strip_html_properly(message)]"
/obj/item/device/taperecorder/verb/record()
set name = "Start Recording"
-13
View File
@@ -16,19 +16,6 @@ var/list/freqtospan = list(
"1441" = "dsquadradio"
)
var/list/freqtoname = list(
"1351" = "Science",
"1353" = "Command",
"1355" = "Medical",
"1357" = "Engineering",
"1359" = "Security",
"1441" = "Deathsquad",
"1213" = "Syndicate",
"1347" = "Supply",
"1349" = "Service",
"1447" = "AI Private"
)
/atom/movable/proc/say(message)
if(!can_speak())
return
+11 -12
View File
@@ -452,18 +452,17 @@ var/list/admin_verbs_hideable = list(
/client/proc/object_say(var/obj/O in world)
set category = "Special Verbs"
set name = "Object Say"
set desc = "Makes an object say something."
if(istype(O))
var/message = input("What do you want the message to be?", "Object Say") as text | null
if(!message)
return
var/templanguages = O.languages
O.languages |= ALL
O.say(message)
O.languages = templanguages
log_admin("[key_name(usr)] made [O] at [O.x], [O.y], [O.z] say [message]")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] made [O] at [O.x], [O.y], [O.z]. say [message]</span>", 1)
feedback_add_details("admin_verb","MS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
set desc = "Makes an object say something."
var/message = input(usr, "What do you want the message to be?", "Make Sound") as text | null
if(!message)
return
var/templanguages = O.languages
O.languages |= ALL
O.say(message)
O.languages = templanguages
log_admin("[key_name(usr)] made [O] at [O.x], [O.y], [O.z] say \"[message]\"")
message_admins("<span class='adminnotice'>[key_name_admin(usr)] made [O] at [O.x], [O.y], [O.z]. say \"[message]\"</span>", 1)
feedback_add_details("admin_verb","OS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/togglebuildmodeself()
set name = "Toggle Build Mode Self"
@@ -1,6 +1,3 @@
/mob/living/carbon/human/say(var/message)
..(message)
/mob/living/carbon/human/say_quote(text)
if(!text)
return "says, \"...\""; //not the best solution, but it will stop a large number of runtimes. The cause is somewhere in the Tcomms code