-Brain radio MMIs were fixed, they wouldn't broadcast the MMI's message.

-Fixed a bug where you couldn't talk into intercoms while it is dark.
-AIs can now type in the "track with camera" verb and get a list of names to show up. This can save time if the AI needs to track an individual.
-Deleted the old AI move.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4910 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
giacomand@gmail.com
2012-10-18 16:16:29 +00:00
parent ecad5024c3
commit 2f68d2cd48
9 changed files with 364 additions and 131 deletions
+5 -3
View File
@@ -10,6 +10,8 @@
return
else
message = Gibberish(message, (emp_damage*6))//scrambles the message, gets worse when emp_damage is higher
..()
else
..()
if(istype(container, /obj/item/device/mmi/radio_enabled))
var/obj/item/device/mmi/radio_enabled/R = container
if(R.radio)
spawn(0) R.radio.hear_talk(src, message)
..()
+4 -3
View File
@@ -280,7 +280,7 @@ var/list/department_radio_keys = list(
listening|=M
var/turf/T = get_turf(src)
var/list/W = view(message_range, T)
var/list/W = hear(message_range, T)
for (var/obj/O in ((W | contents)-used_radios))
W |= O
@@ -311,12 +311,13 @@ var/list/department_radio_keys = list(
if (O)
O.hear_talk(src, message)
*/
if(isbrain(src))//For brains to properly talk if they are in an MMI..or in a brain. Could be extended to other mobs I guess.
/* if(isbrain(src))//For brains to properly talk if they are in an MMI..or in a brain. Could be extended to other mobs I guess.
for(var/obj/O in loc)//Kinda ugly but whatever.
if(O)
spawn(0)
O.hear_talk(src, message)
*/
var/list/heard_a = list() // understood us
+1
View File
@@ -41,6 +41,7 @@
var/mob/living/silicon/ai/parent = null
var/camera_light_on = 0 //Defines if the AI toggled the light on the camera it's looking through.
var/datum/trackable/track = null
/mob/living/silicon/ai/New(loc, var/datum/ai_laws/L, var/obj/item/device/mmi/B, var/safety = 0)
var/list/possibleNames = ai_names
@@ -124,8 +124,6 @@
/datum/camerachunk/New(loc, x, y, z)
set background = 1
// 0xf = 15
x &= ~0xf
y &= ~0xf
@@ -94,7 +94,7 @@
// This will move the AIEye. It will also cause lights near the eye to light up, if toggled.
// This is handled in the proc below this one.
/client/AIMove(n, direct, var/mob/living/silicon/ai/user)
/client/proc/AIMove(n, direct, var/mob/living/silicon/ai/user)
var/initial = initial(user.sprint)
var/max_sprint = 50
@@ -1,71 +0,0 @@
/var/const/SHARED_TYPES_WEIGHT = 5
/var/const/CAMERA_PROXIMITY_PREFERENCE = 0.2
// the smaller this is, the more a straight line will be preferred over a closer camera when changing cameras
// if you set this to 0 the game will crash. don't do that.
// if you set it to be negative the algorithm will do completely nonsensical things (like choosing the camera that's
// the farthest away). don't do that.
/client/proc/AIMove(n,direct,var/mob/living/silicon/ai/user)
if(!user) return
if(user.control_disabled) return
var/min_dist = 1e8
var/obj/machinery/camera/closest = null
var/atom/old = (user.current?user.current : user.loc)
if(!old) return
var/dx = 0
var/dy = 0
if(direct & NORTH)
dy = 1
else if(direct & SOUTH)
dy = -1
if(direct & EAST)
dx = 1
else if(direct & WEST)
dx = -1
var/area/A = get_area(old)
var/list/old_types = dd_text2list("[A.type]", "/")
for(var/obj/machinery/camera/current in cameranet.cameras)
if(user.network != current.network) continue
if(!current.status) continue // ignore disabled cameras
//make sure it's the right direction
if(dx && (current.x * dx <= old.x * dx))
continue
if(dy && (current.y * dy <= old.y * dy))
continue
var/shared_types = 0 //how many levels deep the old camera and the closest camera's areas share
//for instance, /area/A and /area/B would have shared_types = 2 (because of how dd_text2list works)
//whereas area/A/B and /area/A/C would have it as 3
var/area/cur_area = get_area(current)
if(!cur_area) continue
var/list/new_types = dd_text2list("[cur_area.type]", "/")
for(var/i = 1; i <= old_types.len && i <= new_types.len; i++)
if(old_types[i] == new_types[i])
shared_types++
else
break
//don't let it be too far from the current one in the axis perpindicular to the direction of travel,
//but let it be farther from that if it's in the same area
//something in the same hallway but farther away beats something in the same hallway
var/distance = abs((current.y - old.y)/(CAMERA_PROXIMITY_PREFERENCE + abs(dy))) + abs((current.x - old.x)/(CAMERA_PROXIMITY_PREFERENCE + abs(dx)))
distance -= SHARED_TYPES_WEIGHT * shared_types
//weight things in the same area as this so they count as being closer - makes you stay in the same area
//when possible
if(distance < min_dist)
//closer, or this is in the same area and the current closest isn't
min_dist = distance
closest = current
if(!closest)
return
user.switchCamera(closest)