-Fixed Issue 849

-Fixed some other occurrences of this happening. If you find any, please post it here: http://nanotrasen.com/phpBB3/viewtopic.php?f=7&t=9955 
or let me know in #coderbus.

-Split up the Core() verb a bit.
-When sending messages to Centcom or the Syndicate, with the communications console, it would never reset itself since it resets the wrong variable. I've given it the correct variable and I made the cooldown 10 minutes instead of a minute.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4629 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
giacomand@gmail.com
2012-09-05 23:42:04 +00:00
parent 0c620b02ae
commit 6117b5d02f
15 changed files with 39 additions and 33 deletions

View File

@@ -166,6 +166,10 @@
var/turf/T = get_turf(source) var/turf/T = get_turf(source)
var/list/hear = list() var/list/hear = list()
if(!T)
return hear
var/list/range = hear(R, T) var/list/range = hear(R, T)
for(var/atom/A in range) for(var/atom/A in range)

View File

@@ -71,6 +71,10 @@
else non_whitespace = 1 else non_whitespace = 1
if(non_whitespace) return text //only accepts the text if it has some non-spaces if(non_whitespace) return text //only accepts the text if it has some non-spaces
// Used to get a sanitized input.
/proc/stripped_input(var/mob/user, var/message = "", var/title = "", var/default = "", var/max_length=MAX_MESSAGE_LEN)
var/name = input(user, message, title, default)
return strip_html_simple(name, max_length)
//Filters out undesirable characters from names //Filters out undesirable characters from names
/proc/reject_bad_name(var/t_in, var/allow_numbers=0, var/max_length=MAX_NAME_LEN) /proc/reject_bad_name(var/t_in, var/allow_numbers=0, var/max_length=MAX_NAME_LEN)

View File

@@ -353,11 +353,9 @@ text("<A href='?src=\ref[src];operation=oddbutton'>[src.oddbutton ? "Yes" : "No"
del(src) del(src)
else if (istype(W, /obj/item/weapon/pen)) else if (istype(W, /obj/item/weapon/pen))
var/t = input(user, "Enter new robot name", src.name, src.created_name) as text var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name)
t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN)
if (!t) if (!t)
return return
if (!in_range(src, usr) && src.loc != usr) if (!in_range(src, usr) && src.loc != usr)
return return
src.created_name = t src.created_name = t

View File

@@ -891,8 +891,7 @@ Auto Patrol: []"},
..() ..()
if(istype(W, /obj/item/weapon/pen)) if(istype(W, /obj/item/weapon/pen))
var/t = input(user, "Enter new robot name", src.name, src.created_name) as text var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name)
t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN)
if(!t) return if(!t) return
if(!in_range(src, usr) && src.loc != usr) return if(!in_range(src, usr) && src.loc != usr) return
created_name = t created_name = t

View File

@@ -425,8 +425,7 @@
del(src) del(src)
else if (istype(W, /obj/item/weapon/pen)) else if (istype(W, /obj/item/weapon/pen))
var/t = input(user, "Enter new robot name", src.name, src.created_name) as text var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name)
t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN)
if (!t) if (!t)
return return
if (!in_range(src, usr) && src.loc != usr) if (!in_range(src, usr) && src.loc != usr)
@@ -445,8 +444,8 @@
user.drop_from_inventory(src) user.drop_from_inventory(src)
del(src) del(src)
else if (istype(W, /obj/item/weapon/pen)) else if (istype(W, /obj/item/weapon/pen))
var/t = input(user, "Enter new robot name", src.name, src.created_name) as text var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name)
t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN)
if (!t) if (!t)
return return
if (!in_range(src, usr) && src.loc != usr) if (!in_range(src, usr) && src.loc != usr)

View File

@@ -559,13 +559,11 @@
/obj/item/weapon/firstaid_arm_assembly/attackby(obj/item/weapon/W as obj, mob/user as mob) /obj/item/weapon/firstaid_arm_assembly/attackby(obj/item/weapon/W as obj, mob/user as mob)
..() ..()
if(istype(W, /obj/item/weapon/pen)) if(istype(W, /obj/item/weapon/pen))
var/t = input(user, "Enter new robot name", src.name, src.created_name) as text var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name)
t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN)
if (!t) if (!t)
return return
if (!in_range(src, usr) && src.loc != usr) if (!in_range(src, usr) && src.loc != usr)
return return
src.created_name = t src.created_name = t
else else
switch(build_step) switch(build_step)

View File

@@ -754,11 +754,9 @@ Auto Patrol: []"},
del(src) del(src)
else if(istype(W, /obj/item/weapon/pen)) else if(istype(W, /obj/item/weapon/pen))
var/t = input(user, "Enter new robot name", src.name, src.created_name) as text var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name)
t = copytext(sanitize(t), 1, MAX_MESSAGE_LEN)
if(!t) if(!t)
return return
if(!in_range(src, usr) && src.loc != usr) if(!in_range(src, usr) && src.loc != usr)
return return
src.created_name = t src.created_name = t

View File

@@ -112,7 +112,7 @@
if(U.eyeobj) if(U.eyeobj)
U.eyeobj.setLoc(get_turf(target)) U.eyeobj.setLoc(get_turf(target))
else else
core() view_core()
return return
sleep(10) sleep(10)

View File

@@ -98,7 +98,7 @@
if("announce") if("announce")
if(src.authenticated==2) if(src.authenticated==2)
if(message_cooldown) return if(message_cooldown) return
var/input = copytext(strip_html_simple(input(usr, "Please choose a message to announce to the station crew.", "What?", "")),1,MAX_MESSAGE_LEN) var/input = stripped_input(usr, "Please choose a message to announce to the station crew.", "What?")
if(!input || !(usr in view(1,src))) if(!input || !(usr in view(1,src)))
return return
captain_announce(input)//This should really tell who is, IE HoP, CE, HoS, RD, Captain captain_announce(input)//This should really tell who is, IE HoP, CE, HoS, RD, Captain
@@ -177,15 +177,15 @@
if(centcomm_message_cooldown) if(centcomm_message_cooldown)
usr << "Arrays recycling. Please stand by." usr << "Arrays recycling. Please stand by."
return return
var/input = copytext(sanitize(input(usr, "Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "")),1,MAX_MESSAGE_LEN) var/input = stripped_input(usr, "Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "")
if(!input || !(usr in view(1,src))) if(!input || !(usr in view(1,src)))
return return
Centcomm_announce(input, usr) Centcomm_announce(input, usr)
usr << "Message transmitted." usr << "Message transmitted."
log_say("[key_name(usr)] has made a Centcomm announcement: [input]") log_say("[key_name(usr)] has made a Centcomm announcement: [input]")
centcomm_message_cooldown = 1 centcomm_message_cooldown = 1
spawn(600)//One minute cooldown spawn(6000)//10 minute cooldown
message_cooldown = 0 centcomm_message_cooldown = 0
// OMG SYNDICATE ...LETTERHEAD // OMG SYNDICATE ...LETTERHEAD
@@ -194,15 +194,15 @@
if(centcomm_message_cooldown) if(centcomm_message_cooldown)
usr << "Arrays recycling. Please stand by." usr << "Arrays recycling. Please stand by."
return return
var/input = copytext(sanitize(input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "")),1,MAX_MESSAGE_LEN) var/input = stripped_input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "")
if(!input || !(usr in view(1,src))) if(!input || !(usr in view(1,src)))
return return
Syndicate_announce(input, usr) Syndicate_announce(input, usr)
usr << "Message transmitted." usr << "Message transmitted."
log_say("[key_name(usr)] has made a Syndicate announcement: [input]") log_say("[key_name(usr)] has made a Syndicate announcement: [input]")
centcomm_message_cooldown = 1 centcomm_message_cooldown = 1
spawn(600)//One minute cooldown spawn(6000)//10 minute cooldown
message_cooldown = 0 centcomm_message_cooldown = 0
if("RestoreBackup") if("RestoreBackup")
usr << "Backup routing data restored!" usr << "Backup routing data restored!"

View File

@@ -216,8 +216,7 @@
user << "\blue The MMI must go in after everything else!" user << "\blue The MMI must go in after everything else!"
if (istype(W, /obj/item/weapon/pen)) if (istype(W, /obj/item/weapon/pen))
var/t = input(user, "Enter new robot name", src.name, src.created_name) as text var/t = stripped_input(user, "Enter new robot name", src.name, src.created_name, MAX_NAME_LEN)
t = copytext(sanitize(t), 1, MAX_NAME_LEN)
if (!t) if (!t)
return return
if (!in_range(src, usr) && src.loc != usr) if (!in_range(src, usr) && src.loc != usr)

View File

@@ -793,10 +793,11 @@ var/global/BSACooldown = 0
if ((src.rank in list( "Trial Admin", "Badmin", "Game Admin", "Game Master" ))) if ((src.rank in list( "Trial Admin", "Badmin", "Game Admin", "Game Master" )))
var/mob/M = locate(href_list["forcespeech"]) var/mob/M = locate(href_list["forcespeech"])
if (ismob(M)) if (ismob(M))
var/speech = copytext(sanitize(input("What will [key_name(M)] say?.", "Force speech", "")),1,MAX_MESSAGE_LEN) var/speech = input("What will [key_name(M)] say?.", "Force speech", "")// Don't need to sanitize, since it does that in say(), we also trust our admins.
if(!speech) if(!speech)
return return
M.say(speech) M.say(speech)
speech = sanitize(speech) // Nah, we don't trust them
log_admin("[key_name(usr)] forced [key_name(M)] to say: [speech]") log_admin("[key_name(usr)] forced [key_name(M)] to say: [speech]")
message_admins("\blue [key_name_admin(usr)] forced [key_name_admin(M)] to say: [speech]") message_admins("\blue [key_name_admin(usr)] forced [key_name_admin(M)] to say: [speech]")
else else

View File

@@ -261,7 +261,7 @@
if (prob(30)) if (prob(30))
switch(pick(1,2)) switch(pick(1,2))
if(1) if(1)
core() view_core()
if(2) if(2)
ai_call_shuttle() ai_call_shuttle()
..() ..()
@@ -445,7 +445,7 @@
return 0 return 0
if(!src.eyeobj) if(!src.eyeobj)
core() view_core()
return return
// ok, we're alive, camera is good and in our network... // ok, we're alive, camera is good and in our network...
eyeobj.setLoc(get_turf(C)) eyeobj.setLoc(get_turf(C))
@@ -512,7 +512,7 @@
set name = "Cancel Camera View" set name = "Cancel Camera View"
//src.cameraFollow = null //src.cameraFollow = null
src.core() src.view_core()
//Replaces /mob/living/silicon/ai/verb/change_network() in ai.dm & camera.dm //Replaces /mob/living/silicon/ai/verb/change_network() in ai.dm & camera.dm
@@ -547,7 +547,7 @@
network = input(U, "Which network would you like to view?") as null|anything in cameralist network = input(U, "Which network would you like to view?") as null|anything in cameralist
if(!U.eyeobj) if(!U.eyeobj)
U.core() U.view_core()
return return
if(isnull(network)) if(isnull(network))

View File

@@ -103,11 +103,17 @@
/mob/living/silicon/ai/verb/core() /mob/living/silicon/ai/verb/core()
set category = "AI Commands" set category = "AI Commands"
set name = "AI Core" set name = "AI Core"
view_core()
/mob/living/silicon/ai/proc/view_core()
current = null current = null
cameraFollow = null cameraFollow = null
machine = null machine = null
if(src.eyeobj) if(src.eyeobj && src.loc)
src.eyeobj.loc = src.loc src.eyeobj.loc = src.loc
else else
src << "ERROR: Eyeobj not found. Please report this to Giacom. Creating new eye..." src << "ERROR: Eyeobj not found. Please report this to Giacom. Creating new eye..."

View File

@@ -22,5 +22,5 @@
if(O) if(O)
O.mode = 1 O.mode = 1
O.emotion = "Neutral" O.emotion = "Neutral"
src.core() src.view_core()
return return

View File

@@ -6,5 +6,5 @@
if (client) if (client)
client.eye = loc client.eye = loc
client.perspective = EYE_PERSPECTIVE client.perspective = EYE_PERSPECTIVE
src.core() src.view_core()
return return