mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 04:27:35 +01:00
Borg radios now work while they're recharging
MMIs/pAIs/lockers in the dark can now hear. This was done by changing the area check for hearing to a range instead of view, and then doing a line of sight calculation for each mob that can't hear naturally and checking if it's clear. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3180 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -100,50 +100,113 @@
|
||||
|
||||
var/turf/T = get_turf(source)
|
||||
var/list/hear = hearers(R, T)
|
||||
var/list/V = view(R, T)
|
||||
var/list/V = range(R, T)
|
||||
|
||||
// Search for closets:
|
||||
for(var/obj/structure/closet/C in V)
|
||||
for(var/mob/M in C.contents)
|
||||
if(M.client)
|
||||
hear += M
|
||||
if(isInSight(source,C))
|
||||
if(M.client)
|
||||
hear += M
|
||||
|
||||
// Cryos:
|
||||
for(var/obj/machinery/atmospherics/unary/cryo_cell/C in V)
|
||||
if(C.occupant)
|
||||
if(C.occupant.client)
|
||||
hear += C.occupant
|
||||
if(isInSight(source,C))
|
||||
if(C.occupant.client)
|
||||
hear += C.occupant
|
||||
|
||||
// Intelicards
|
||||
for(var/obj/item/device/aicard/C in V)
|
||||
for(var/mob/living/silicon/ai/M in C)
|
||||
if(M.client)
|
||||
hear += M
|
||||
if(isInSight(source,C))
|
||||
if(M.client)
|
||||
hear += M
|
||||
|
||||
// Brains/MMIs/pAIs
|
||||
for(var/mob/living/carbon/brain/C in world)
|
||||
if(get_turf(C) in V)
|
||||
hear += C
|
||||
if(isInSight(source,C))
|
||||
hear += C
|
||||
for(var/mob/living/silicon/pai/C in world)
|
||||
if(get_turf(C) in V)
|
||||
hear += C
|
||||
if(isInSight(source,C))
|
||||
hear += C
|
||||
|
||||
/* -- Handled above. WHY IS THIS HERE? WHYYYYYYY
|
||||
// Personal AIs
|
||||
for(var/obj/item/device/paicard/C in V)
|
||||
if(C.pai)
|
||||
if(C.pai.client)
|
||||
hear += C.pai
|
||||
|
||||
if(isInSight(source,C))
|
||||
if(C.pai.client)
|
||||
hear += C.pai
|
||||
*/
|
||||
// Exosuits
|
||||
for(var/obj/mecha/C in V)
|
||||
if(C.occupant)
|
||||
if(C.occupant.client)
|
||||
hear += C.occupant
|
||||
if(isInSight(source,C))
|
||||
if(C.occupant.client)
|
||||
hear += C.occupant
|
||||
|
||||
// Disposal Machines
|
||||
for(var/obj/machinery/disposal/C in V)
|
||||
for(var/mob/M in C.contents)
|
||||
if(M.client)
|
||||
hear += M
|
||||
if(isInSight(source,C))
|
||||
if(M.client)
|
||||
hear += M
|
||||
|
||||
return hear
|
||||
//Borg rechargers
|
||||
for(var/obj/machinery/recharge_station/C in V)
|
||||
if(C.occupant)
|
||||
if(isInSight(source,C))
|
||||
if(C.occupant.client)
|
||||
hear += C.occupant
|
||||
|
||||
return hear
|
||||
|
||||
#define SIGN(X) ((X<0)?-1:1)
|
||||
|
||||
proc
|
||||
inLineOfSight(X1,Y1,X2,Y2,Z=1,PX1=16.5,PY1=16.5,PX2=16.5,PY2=16.5)
|
||||
var/turf/T
|
||||
if(X1==X2)
|
||||
if(Y1==Y2)
|
||||
return 1 //Light cannot be blocked on same tile
|
||||
else
|
||||
var/s = SIGN(Y2-Y1)
|
||||
Y1+=s
|
||||
while(Y1!=Y2)
|
||||
T=locate(X1,Y1,Z)
|
||||
if(T.opacity)
|
||||
return 0
|
||||
Y1+=s
|
||||
else
|
||||
var
|
||||
m=(32*(Y2-Y1)+(PY2-PY1))/(32*(X2-X1)+(PX2-PX1))
|
||||
b=(Y1+PY1/32-0.015625)-m*(X1+PX1/32-0.015625) //In tiles
|
||||
signX = SIGN(X2-X1)
|
||||
signY = SIGN(Y2-Y1)
|
||||
if(X1<X2)
|
||||
b+=m
|
||||
while(X1!=X2 || Y1!=Y2)
|
||||
if(round(m*X1+b-Y1))
|
||||
Y1+=signY //Line exits tile vertically
|
||||
else
|
||||
X1+=signX //Line exits tile horizontally
|
||||
T=locate(X1,Y1,Z)
|
||||
if(T.opacity)
|
||||
return 0
|
||||
return 1
|
||||
|
||||
proc/isInSight(var/atom/A, var/atom/B)
|
||||
var/turf/Aturf = get_turf(A)
|
||||
var/turf/Bturf = get_turf(B)
|
||||
|
||||
if(!Aturf || !Bturf)
|
||||
return 0
|
||||
|
||||
if(inLineOfSight(Aturf.x,Aturf.y, Bturf.x,Bturf.y,Aturf.z))
|
||||
return 1
|
||||
|
||||
else
|
||||
return 0
|
||||
|
||||
@@ -264,8 +264,11 @@
|
||||
listening += src
|
||||
|
||||
*/
|
||||
/* Handing this section over to get_mobs_in_view which was written with radiocode update
|
||||
var/turf/T = get_turf(src)
|
||||
listening = hearers(message_range, T)
|
||||
for (var/O in listening)
|
||||
world << O
|
||||
var/list/V = view(message_range, T)
|
||||
//find mobs in lockers, cryo, intellicards, brains, MMIs, and so on.
|
||||
for (var/mob/M in world)
|
||||
@@ -282,6 +285,21 @@
|
||||
if (M.client && M.client.ghost_ears)
|
||||
listening|=M
|
||||
|
||||
*/
|
||||
|
||||
listening = get_mobs_in_view(message_range, src)
|
||||
for(var/mob/M in world)
|
||||
if (!M.client)
|
||||
continue //skip monkeys and leavers
|
||||
if (istype(M, /mob/new_player))
|
||||
continue
|
||||
if(M.stat == 2 && M.client.ghost_ears)
|
||||
listening|=M
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
var/list/V = view(message_range, T)
|
||||
|
||||
|
||||
for (var/obj/O in ((V | contents)-used_radios)) //radio in pocket could work, radio in backpack wouldn't --rastaf0
|
||||
spawn (0)
|
||||
if (O)
|
||||
@@ -293,14 +311,17 @@
|
||||
spawn(0)
|
||||
O.hear_talk(src, message)
|
||||
|
||||
|
||||
|
||||
var/list/heard_a = list() // understood us
|
||||
var/list/heard_b = list() // didn't understand us
|
||||
|
||||
for (var/mob/M in listening)
|
||||
if (M.say_understands(src))
|
||||
heard_a += M
|
||||
else
|
||||
heard_b += M
|
||||
for (var/M in listening)
|
||||
if(hascall(M,"say_understands"))
|
||||
if (M:say_understands(src))
|
||||
heard_a += M
|
||||
else
|
||||
heard_b += M
|
||||
|
||||
var/rendered = null
|
||||
if (length(heard_a))
|
||||
@@ -318,60 +339,9 @@
|
||||
else
|
||||
rendered = "<span class='game say'><span class='name'>[real_name]</span>[alt_name] <span class='message'>[message_a]</span></span>"
|
||||
|
||||
/*
|
||||
// Create speech bubble
|
||||
var/obj/effect/speech_bubble/B = new/obj/effect/speech_bubble
|
||||
B.icon = 'speechbubble.dmi'
|
||||
B.parent = src
|
||||
B.mouse_opacity = 0
|
||||
B.invisibility = invisibility
|
||||
B.layer = 10
|
||||
|
||||
// Determine if the speech bubble's going to have a special look
|
||||
var/presay = ""
|
||||
if(istype(src, /mob/living/silicon))
|
||||
presay = "bot"
|
||||
if(istype(src, /mob/living/carbon/alien))
|
||||
presay = "xeno"
|
||||
if(istype(src, /mob/living/carbon/metroid))
|
||||
presay = "metroid"
|
||||
*/
|
||||
for (var/mob/M in heard_a)
|
||||
|
||||
M.show_message(rendered, 2)
|
||||
/*
|
||||
if(M.client)
|
||||
|
||||
// If this client has bubbles disabled, obscure the bubble
|
||||
if(!M.client.bubbles || M == src)
|
||||
var/image/I = image('speechbubble.dmi', B, "override")
|
||||
I.override = 1
|
||||
M << I
|
||||
*/
|
||||
/*
|
||||
// find the suffix, if bot, human or monkey
|
||||
var/punctuation = ""
|
||||
if(presay == "bot" || presay == "")
|
||||
var/ending = copytext(text, length(text))
|
||||
if (ending == "?")
|
||||
punctuation = "question"
|
||||
else if (ending == "!")
|
||||
punctuation = "exclamation"
|
||||
else
|
||||
punctuation = ""
|
||||
|
||||
// flick the bubble
|
||||
flick("[presay]say[punctuation]", B)
|
||||
|
||||
if(istype(loc, /turf))
|
||||
B.loc = loc
|
||||
else
|
||||
B.loc = loc.loc
|
||||
|
||||
spawn()
|
||||
sleep(11)
|
||||
del(B)
|
||||
*/
|
||||
for (var/M in heard_a)
|
||||
if(hascall(M,"show_message"))
|
||||
M:show_message(rendered, 2)
|
||||
|
||||
if (length(heard_b))
|
||||
var/message_b
|
||||
@@ -388,27 +358,9 @@
|
||||
rendered = "<span class='game say'><span class='name'>[voice_name]</span> <span class='message'>[message_b]</span></span>"
|
||||
|
||||
|
||||
/*
|
||||
// Create speech bubble
|
||||
var/obj/effect/speech_bubble/B = new/obj/effect/speech_bubble
|
||||
B.icon = 'speechbubble.dmi'
|
||||
B.parent = src
|
||||
B.mouse_opacity = 0
|
||||
B.invisibility = invisibility
|
||||
B.layer = 10
|
||||
|
||||
// Determine if the speech bubble's going to have a special look
|
||||
var/presay = ""
|
||||
if(istype(src, /mob/living/silicon))
|
||||
presay = "bot"
|
||||
if(istype(src, /mob/living/carbon/alien))
|
||||
presay = "xeno"
|
||||
if(istype(src, /mob/living/carbon/metroid))
|
||||
presay = "metroid"
|
||||
*/
|
||||
|
||||
for (var/mob/M in heard_b)
|
||||
M.show_message(rendered, 2)
|
||||
for (var/M in heard_b)
|
||||
if(hascall(M,"show_message"))
|
||||
M:show_message(rendered, 2)
|
||||
|
||||
/*
|
||||
if(M.client)
|
||||
|
||||
Reference in New Issue
Block a user