TG: AI can now track its cyborgs who speak on robotic talk.

Revision: r3526
Author: 	 VivianFoxfoot
This commit is contained in:
Erthilo
2012-05-06 19:21:33 +01:00
parent 6e1bc2b0fb
commit 4a6adbef82
4 changed files with 75 additions and 32 deletions

View File

@@ -137,33 +137,38 @@
var/obj/machinery/camera/C = usr:current
if ((C && istype(C, /obj/machinery/camera)) || C==null)
var/closestDist = -1
if (C!=null)
if (C.status)
closestDist = get_dist(C, target)
//usr << text("Dist = [] for camera []", closestDist, C.name)
var/zmatched = 0
if (closestDist > 7 || closestDist == -1)
//check other cameras
var/obj/machinery/camera/closest = C
for(var/obj/machinery/camera/C2 in world)
if (C2.network in src.networks)
if (C2.z == target.z)
zmatched = 1
if (C2.status)
var/dist = get_dist(C2, target)
if ((dist < closestDist) || (closestDist == -1))
closestDist = dist
closest = C2
//usr << text("Closest camera dist = [], for camera []", closestDist, closest.area.name)
if(isrobot(target))
C = target:camera
usr:current = C
usr.reset_view(C)
else
var/closestDist = -1
if (C!=null)
if (C.status)
closestDist = get_dist(C, target)
//usr << text("Dist = [] for camera []", closestDist, C.name)
var/zmatched = 0
if (closestDist > 7 || closestDist == -1)
//check other cameras
var/obj/machinery/camera/closest = C
for(var/obj/machinery/camera/C2 in world)
if (C2.network == src.networks)
if (C2.z == target.z)
zmatched = 1
if (C2.status)
var/dist = get_dist(C2, target)
if ((dist < closestDist) || (closestDist == -1))
closestDist = dist
closest = C2
//usr << text("Closest camera dist = [], for camera []", closestDist, closest.area.name)
if (closest != C)
usr:current = closest
usr.reset_view(closest)
//use_power(50)
if (zmatched == 0)
usr << "Target is not on or near any active cameras on the station. We'll check again in 5 seconds (unless you use the cancel-camera verb)."
sleep(40) //because we're sleeping another second after this (a few lines down)
if (closest != C)
usr:current = closest
usr.reset_view(closest)
//use_power(50)
if (zmatched == 0)
usr << "Target is not on or near any active cameras on the station. We'll check again in 5 seconds (unless you use the cancel-camera verb)."
sleep(40) //because we're sleeping another second after this (a few lines down)
else
usr << "Follow camera mode ended."
usr:cameraFollow = null

View File

@@ -1,7 +1,10 @@
/mob/living/proc/binarycheck()
if (istype(src, /mob/living/silicon/pai)) return
if (issilicon(src)) return 1
if (!ishuman(src)) return
if (istype(src, /mob/living/silicon/pai))
return
if (issilicon(src))
return 1
if (!ishuman(src))
return
var/mob/living/carbon/human/H = src
if (H.l_ear || H.r_ear)
var/obj/item/device/radio/headset/dongle

View File

@@ -330,6 +330,30 @@
if (href_list["laws"]) // With how my law selection code works, I changed statelaws from a verb to a proc, and call it through my law selection panel. --NeoFite
statelaws()
if (href_list["track"])
var/mob/target = locate(href_list["track"])
var/mob/living/silicon/ai/A = locate(href_list["track2"])
if(A && target)
A.ai_actual_track(target)
return
else if (href_list["faketrack"])
var/mob/target = locate(href_list["track"])
var/mob/living/silicon/ai/A = locate(href_list["track2"])
if(A && target)
A:cameraFollow = target
A << text("Now tracking [] on camera.", target.name)
if (usr.machine == null)
usr.machine = usr
while (usr:cameraFollow == target)
usr << "Target is not on or near any active cameras on the station. We'll check again in 5 seconds (unless you use the cancel-camera verb)."
sleep(40)
continue
return
return
/mob/living/silicon/ai/meteorhit(obj/O as obj)

View File

@@ -83,12 +83,23 @@
var/message_a = say_quote(message)
var/rendered = "<i><span class='game say'>Robotic Talk, <span class='name'>[name]</span> <span class='message'>[message_a]</span></span></i>"
for (var/mob/living/S in world)
if(!S.stat)
if(S.robot_talk_understand && (S.robot_talk_understand == robot_talk_understand))
S.show_message(rendered, 2)
if(S.robot_talk_understand && (S.robot_talk_understand == robot_talk_understand)) // This SHOULD catch everything caught by the one below, but I'm not going to change it.
if(istype(S , /mob/living/silicon/ai))
var/renderedAI = "<i><span class='game say'>Robotic Talk, <a href='byond://?src=\ref[S];track2=\ref[S];track=\ref[src]'><span class='name'>[name]</span></a> <span class='message'>[message_a]</span></span></i>"
S.show_message(renderedAI, 2)
else
S.show_message(rendered, 2)
else if (S.binarycheck())
S.show_message(rendered, 2)
if(istype(S , /mob/living/silicon/ai))
var/renderedAI = "<i><span class='game say'>Robotic Talk, <a href='byond://?src=\ref[S];track2=\ref[S];track=\ref[src]'><span class='name'>[name]</span></a> <span class='message'>[message_a]</span></span></i>"
S.show_message(renderedAI, 2)
else
S.show_message(rendered, 2)
var/list/listening = hearers(1, src)
listening -= src