Merge pull request #4461 from Novacat/nova-heterochromia

Adds Subspace Radio
This commit is contained in:
Spades
2018-12-08 09:43:34 -05:00
committed by GitHub
6 changed files with 168 additions and 20 deletions
+17 -6
View File
@@ -1,4 +1,5 @@
// Access check is of the type requires one. These have been carefully selected to avoid allowing the janitor to see channels he shouldn't
//VOREStation Edit Start - Updating this for Virgo
var/global/list/default_internal_channels = list(
num2text(PUB_FREQ) = list(),
num2text(AI_FREQ) = list(access_synth),
@@ -10,16 +11,18 @@ var/global/list/default_internal_channels = list(
num2text(MED_I_FREQ)=list(access_medical_equip),
num2text(SEC_FREQ) = list(access_security),
num2text(SEC_I_FREQ)=list(access_security),
num2text(SCI_FREQ) = list(access_tox,access_robotics,access_xenobiology),
num2text(SUP_FREQ) = list(access_cargo),
num2text(SRV_FREQ) = list(access_janitor, access_hydroponics)
num2text(SCI_FREQ) = list(access_tox, access_robotics, access_xenobiology, access_explorer),
num2text(SUP_FREQ) = list(access_cargo, access_mining_station),
num2text(SRV_FREQ) = list(access_janitor, access_library, access_hydroponics, access_bar, access_kitchen),
num2text(EXP_FREQ) = list(access_explorer, access_pilot, access_rd)
)
var/global/list/default_medbay_channels = list(
num2text(PUB_FREQ) = list(),
num2text(MED_FREQ) = list(access_medical_equip),
num2text(MED_I_FREQ) = list(access_medical_equip)
num2text(MED_FREQ) = list(),
num2text(MED_I_FREQ) = list()
)
//VOREStation Edit End
/obj/item/device/radio
icon = 'icons/obj/radio_vr.dmi' //VOREStation Edit
@@ -480,6 +483,13 @@ var/global/list/default_medbay_channels = list(
//THIS IS TEMPORARY. YEAH RIGHT
if(!connection) return 0 //~Carn
//VOREStation Add Start
if(bluespace_radio)
return Broadcast_Message(connection, M, voicemask, pick(M.speak_emote),
src, message, displayname, jobname, real_name, M.voice_name,
0, signal.data["compression"], list(0), connection.frequency,verb,speaking)
//VOREStation Add End
return Broadcast_Message(connection, M, voicemask, pick(M.speak_emote),
src, message, displayname, jobname, real_name, M.voice_name,
filter_type, signal.data["compression"], list(position.z), connection.frequency,verb,speaking)
@@ -518,7 +528,8 @@ var/global/list/default_medbay_channels = list(
if(!(0 in level))
var/turf/position = get_turf(src)
if(!position || !(position.z in level))
return -1
if(!bluespace_radio) //VOREStation Edit
return -1
if(freq in ANTAG_FREQS)
if(!(src.syndie))//Checks to see if it's allowed on that frequency, based on the encryption keys
return -1
@@ -0,0 +1,146 @@
/obj/item/device/radio
var/bluespace_radio = FALSE
/obj/item/device/radio/phone
subspace_transmission = 1
canhear_range = 0
adhoc_fallback = TRUE
/obj/item/device/radio/emergency
name = "Medbay Emergency Radio Link"
icon_state = "med_walkietalkie"
frequency = MED_I_FREQ
subspace_transmission = 1
adhoc_fallback = TRUE
/obj/item/device/radio/emergency/New()
..()
internal_channels = default_medbay_channels.Copy()
//Pathfinder's Subspace Radio
/obj/item/device/subspaceradio
name = "subspace radio"
desc = "A powerful new radio recently gifted to Nanotrasen from KHI, this communications device has the ability to send and recieve transmissions from anywhere."
icon = 'icons/vore/custom_items_vr.dmi'
icon_state = "radiopack"
item_state = "parachute"
slot_flags = SLOT_BACK
force = 5
throwforce = 6
preserve_item = 1
w_class = ITEMSIZE_LARGE
action_button_name = "Remove/Replace Handset"
var/obj/item/device/radio/subspacehandset/linked/handset
/obj/item/device/subspaceradio/New() //starts without a cell for rnd
..()
if(ispath(handset))
handset = new handset(src, src)
else
handset = new(src, src)
/obj/item/device/subspaceradio/Destroy()
. = ..()
QDEL_NULL(handset)
/obj/item/device/subspaceradio/ui_action_click()
toggle_handset()
/obj/item/device/subspaceradio/attack_hand(mob/user)
if(loc == user)
toggle_handset()
else
..()
/obj/item/device/subspaceradio/MouseDrop()
if(ismob(loc))
if(!CanMouseDrop(src))
return
var/mob/M = loc
if(!M.unEquip(src))
return
add_fingerprint(usr)
M.put_in_any_hand_if_possible(src)
/obj/item/device/subspaceradio/attackby(obj/item/weapon/W, mob/user, params)
if(W == handset)
reattach_handset(user)
else
return ..()
/obj/item/device/subspaceradio/verb/toggle_handset()
set name = "Toggle Handset"
set category = "Object"
var/mob/living/carbon/human/user = usr
if(!handset)
to_chat(user, "<span class='warning'>The handset is missing!</span>")
return
if(handset.loc != src)
reattach_handset(user) //Remove from their hands and back onto the defib unit
return
if(!slot_check())
to_chat(user, "<span class='warning'>You need to equip [src] before taking out [handset].</span>")
else
if(!usr.put_in_hands(handset)) //Detach the handset into the user's hands
to_chat(user, "<span class='warning'>You need a free hand to hold the handset!</span>")
update_icon() //success
//checks that the base unit is in the correct slot to be used
/obj/item/device/subspaceradio/proc/slot_check()
var/mob/M = loc
if(!istype(M))
return 0 //not equipped
if((slot_flags & SLOT_BACK) && M.get_equipped_item(slot_back) == src)
return 1
if((slot_flags & SLOT_BELT) && M.get_equipped_item(slot_belt) == src)
return 1
return 0
/obj/item/device/subspaceradio/dropped(mob/user)
..()
reattach_handset(user) //handset attached to a base unit should never exist outside of their base unit or the mob equipping the base unit
/obj/item/device/subspaceradio/proc/reattach_handset(mob/user)
if(!handset) return
if(ismob(handset.loc))
var/mob/M = handset.loc
if(M.drop_from_inventory(handset, src))
to_chat(user, "<span class='notice'>\The [handset] snap back into the main unit.</span>")
else
handset.forceMove(src)
//Subspace Radio Handset
/obj/item/device/radio/subspacehandset
name = "subspace radio handset"
desc = "A large walkie talkie attached to the subspace radio by a retractable cord. It sits comfortably on a slot in the radio when not in use."
bluespace_radio = TRUE
icon_state = "signaller"
slot_flags = null
w_class = ITEMSIZE_LARGE
/obj/item/device/radio/subspacehandset/linked
var/obj/item/device/subspaceradio/base_unit
/obj/item/device/radio/subspacehandset/linked/New(newloc, obj/item/device/subspaceradio/radio)
base_unit = radio
..(newloc)
/obj/item/device/radio/subspacehandset/linked/Destroy()
if(base_unit)
//ensure the base unit's icon updates
if(base_unit.handset == src)
base_unit.handset = null
base_unit = null
return ..()
/obj/item/device/radio/subspacehandset/linked/dropped(mob/user)
..() //update twohanding
if(base_unit)
base_unit.reattach_handset(user) //handset attached to a base unit should never exist outside of their base unit or the mob equipping the base unit