Radiophones (#30778)

This commit is contained in:
Kurfursten
2021-09-16 20:33:12 -05:00
committed by GitHub
parent 8f6df8e23f
commit dc1f99ef6e
5 changed files with 89 additions and 3 deletions

View File

@@ -120,18 +120,18 @@
/obj/item/device/radio/Topic(href, href_list) /obj/item/device/radio/Topic(href, href_list)
if (!isAdminGhost(usr) && (usr.stat || !on)) if (!isAdminGhost(usr) && (usr.stat || !on))
return return 1
if(!in_range(src,usr) && !isAdminGhost(usr) && !issilicon(usr)) //Not adjacent/have telekinesis/a silicon/an aghost? Close it. if(!in_range(src,usr) && !isAdminGhost(usr) && !issilicon(usr)) //Not adjacent/have telekinesis/a silicon/an aghost? Close it.
usr << browse(null, "window=radio") usr << browse(null, "window=radio")
return return 1
usr.set_machine(src) usr.set_machine(src)
if (href_list["open"]) if (href_list["open"])
var/mob/target = locate(href_list["open"]) var/mob/target = locate(href_list["open"])
var/mob/living/silicon/ai/A = locate(href_list["open2"]) var/mob/living/silicon/ai/A = locate(href_list["open2"])
if(A && target) if(A && target)
A.open_nearest_door(target) A.open_nearest_door(target)
return return 1
else if("set_freq" in href_list) else if("set_freq" in href_list)
var/new_frequency var/new_frequency
@@ -517,3 +517,89 @@
for (var/ch_name in channels) for (var/ch_name in channels)
channels[ch_name] = 0 channels[ch_name] = 0
..() ..()
/obj/item/device/radio/phone
name = "radio phone"
desc = "A hard line, immobile."
icon = 'icons/obj/items.dmi'
icon_state = "brown_phone"
anchored = TRUE
w_class = W_CLASS_LARGE
canhear_range = 1
channels = list("Response Team" = 1, "Command" = 0)
/obj/item/device/radio/phone/attack_hand(mob/user)
add_fingerprint(user)
if(anchored)
attack_self(user)
else
..()
/obj/item/device/radio/phone/Hear(var/datum/speech/speech, var/rendered_speech="")
if(!speech.speaker || speech.frequency)
return
if(broadcasting && (get_dist(src, speech.speaker) <= canhear_range))
for(var/ch in channels)
if(channels[ch])
talk_into(speech, ch)
/obj/item/device/radio/phone/interact(mob/user as mob)
if(!on)
return
var/dat = "<html><head><title>[src]</title></head><body><TT>"
dat += "Microphone: [broadcasting ? "<A href='byond://?src=\ref[src];talk=0'>Engaged</A>" : "<A href='byond://?src=\ref[src];talk=1'>Disengaged</A>"]<BR>"
if(channels["Response Team"] == 1)
dat += "Channel: <b>Responder</b> <A href='byond://?src=\ref[src];toggle_channel=1'>Command</A>"
else
dat += "Channel: <A href='byond://?src=\ref[src];toggle_channel=1'>Responder</A> <b>Command</b>"
dat+={"</TT></body></html>"}
user << browse(dat, "window=radio")
onclose(user, "radio")
/obj/item/device/radio/phone/Topic(href, href_list)
if(..())
return 1
if("toggle_channel" in href_list)
channels["Response Team"] = !channels["Response Team"]
channels["Command"] = !channels["Command"]
updateDialog()
/obj/item/device/radio/phone/pack
name = "radio backpack"
desc = "Although most of the space is taken up by the radio, there's still space for some storage. Use in hand to access radio channels."
anchored = FALSE
slot_flags = SLOT_BACK
icon_state = "radiopack"
item_state = "radiopack"
inhand_states = list("left_hand" = 'icons/mob/in-hand/left/backpacks_n_bags.dmi', "right_hand" = 'icons/mob/in-hand/right/backpacks_n_bags.dmi')
var/obj/item/weapon/storage/radiopack/ourpack
/obj/item/device/radio/phone/pack/New()
..()
ourpack = new /obj/item/weapon/storage/radiopack(src)
/obj/item/device/radio/phone/pack/attack_hand(mob/user)
if(user.get_inactive_hand() == src)
ourpack.show_to(user)
else
..()
/obj/item/device/radio/phone/pack/AltClick(mob/user)
ourpack.AltClick(user)
/obj/item/device/radio/phone/pack/attackby(obj/item/I, mob/user)
ourpack.attackby(I,user)
/obj/item/weapon/storage/radiopack
name = "radio backpack"
desc = "Although most of the space is taken up by the radio, there's still space for some storage. Use in hand to access radio channels."
w_class = W_CLASS_LARGE
/obj/item/weapon/storage/radiopack/distance_interact(mob/user)
if(istype(loc,/obj/item/device/radio/phone/pack) && in_range(user,loc))
playsound(loc, rustle_sound, 50, 1, -5)
return TRUE
return FALSE

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 109 KiB