mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-28 03:01:37 +00:00
Rather than calling a function on every single radio object which expensively collects hearers(in closets etc.), the proc will now instead build a list of radios. This list is then passed to another proc, which iterates through all clients in the world, and checks if the client's mob can hear the message. Note that I did shallow testing, but deeper issues may still be present with stuff like pAIs which I wasn't able to test on my single player server. If any other problems are found, please notify me. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4019 316c924e-a436-60f5-8080-3fe189b3f50e
50 lines
1.0 KiB
Plaintext
50 lines
1.0 KiB
Plaintext
/obj/item/device/radio/intercom
|
|
name = "station intercom"
|
|
desc = "Talk through this."
|
|
icon_state = "intercom"
|
|
anchored = 1
|
|
w_class = 4.0
|
|
canhear_range = 4
|
|
var/number = 0
|
|
var/anyai = 1
|
|
var/mob/living/silicon/ai/ai = list()
|
|
|
|
|
|
attack_ai(mob/user as mob)
|
|
src.add_fingerprint(user)
|
|
spawn (0)
|
|
attack_self(user)
|
|
|
|
attack_paw(mob/user as mob)
|
|
if ((ticker && ticker.mode.name == "monkey"))
|
|
return src.attack_hand(user)
|
|
|
|
|
|
attack_hand(mob/user as mob)
|
|
src.add_fingerprint(user)
|
|
spawn (0)
|
|
attack_self(user)
|
|
|
|
|
|
send_hear(freq)
|
|
var/range = receive_range(freq)
|
|
|
|
if(range > 0)
|
|
return get_mobs_in_view(canhear_range, src)
|
|
|
|
receive_range(freq)
|
|
if (!(src.wires & WIRE_RECEIVE))
|
|
return 0
|
|
if (!src.listening)
|
|
return 0
|
|
if(freq == SYND_FREQ)
|
|
if(!(src.syndie))
|
|
return 0//Prevents broadcast of messages over devices lacking the encryption
|
|
|
|
return canhear_range
|
|
|
|
|
|
hear_talk(mob/M as mob, msg)
|
|
if(!src.anyai && !(M in src.ai))
|
|
return
|
|
..() |