mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-29 19:43:52 +00:00
# Conflicts: # code/__defines/holomap.dm # code/__defines/mobs.dm # code/_helpers/icons.dm # code/_helpers/unsorted.dm # code/_onclick/hud/hud.dm # code/_onclick/item_attack.dm # code/controllers/Processes/supply.dm # code/controllers/subsystems/planets.dm # code/datums/supplypacks/munitions.dm # code/datums/supplypacks/science.dm # code/datums/supplypacks/security.dm # code/datums/supplypacks/supply.dm # code/game/area/Space Station 13 areas.dm # code/game/atoms_movable.dm # code/game/machinery/autolathe.dm # code/game/machinery/doors/door.dm # code/game/machinery/jukebox.dm # code/game/machinery/recharger.dm # code/game/machinery/vending.dm # code/game/mecha/equipment/tools/medical_tools.dm # code/game/mecha/equipment/weapons/weapons.dm # code/game/objects/items/devices/PDA/PDA.dm # code/game/objects/items/devices/megaphone.dm # code/game/objects/items/poi_items.dm # code/game/objects/items/weapons/implants/implantlanguage.dm # code/game/objects/items/weapons/storage/firstaid.dm # code/game/objects/items/weapons/tools/weldingtool.dm # code/game/objects/structures/flora/trees.dm # code/game/objects/structures/plasticflaps.dm # code/game/supplyshuttle.dm # code/game/turfs/simulated/wall_attacks.dm # code/modules/admin/admin_verbs.dm # code/modules/assembly/infrared.dm # code/modules/client/client procs.dm # code/modules/client/preference_setup/loadout/loadout_utility.dm # code/modules/client/preferences.dm # code/modules/clothing/suits/miscellaneous.dm # code/modules/holomap/holomap_datum.dm # code/modules/holomap/station_holomap.dm # code/modules/integrated_electronics/core/printer.dm # code/modules/mining/machine_processing.dm # code/modules/mob/living/carbon/human/human_defense.dm # code/modules/mob/living/carbon/human/species/virtual_reality/avatar.dm # code/modules/mob/living/death.dm # code/modules/mob/living/silicon/ai/ai.dm # code/modules/mob/living/silicon/pai/pai.dm # code/modules/mob/living/silicon/robot/robot.dm # code/modules/mob/living/simple_animal/animals/parrot.dm # code/modules/mob/mob_movement.dm # code/modules/organs/organ_external.dm # code/modules/organs/organ_icon.dm # code/modules/organs/subtypes/standard.dm # code/modules/planet/weather.dm # code/modules/power/cable.dm # code/modules/power/fusion/core/core_control.dm # code/modules/power/fusion/fuel_assembly/fuel_control.dm # code/modules/power/fusion/gyrotron/gyrotron_control.dm # code/modules/projectiles/gun.dm # code/modules/reagents/Chemistry-Reagents/Chemistry-Reagents-Food-Drinks.dm # config/names/first_name_skrell.txt # config/names/last_name_skrell.txt # icons/mob/head.dmi # icons/mob/robots.dmi # icons/mob/species/tajaran/helmet.dmi # icons/obj/ammo.dmi # icons/obj/gun.dmi # icons/obj/mining.dmi # icons/obj/projectiles.dmi # icons/obj/rig_modules.dmi # icons/obj/surgery.dmi # icons/turf/walls.dmi # maps/southern_cross/southern_cross-1.dmm # maps/southern_cross/southern_cross-3.dmm # maps/southern_cross/southern_cross-6.dmm # maps/southern_cross/southern_cross-8.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1A.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1B.dmm # maps/submaps/surface_submaps/mountains/backup/IceCave1C.dmm # maps/submaps/surface_submaps/mountains/crashedcontainmentshuttle.dmm # maps/submaps/surface_submaps/mountains/deadspy.dmm # maps/submaps/surface_submaps/mountains/mountains_areas.dm # maps/submaps/surface_submaps/plains/Thiefc.dmm # maps/~map_system/maps.dm # vorestation.dme
139 lines
3.9 KiB
Plaintext
139 lines
3.9 KiB
Plaintext
///////////
|
|
// Commlink - Has a bunch of extra stuff due to communicator defines.
|
|
/datum/nifsoft/commlink
|
|
name = "Commlink"
|
|
desc = "An internal communicator for keeping in touch with people."
|
|
list_pos = NIF_COMMLINK
|
|
cost = 500
|
|
wear = 0
|
|
p_drain = 0.01
|
|
other_flags = (NIF_O_COMMLINK)
|
|
|
|
install()
|
|
if((. = ..()))
|
|
nif.comm = new(nif,src)
|
|
|
|
uninstall()
|
|
var/obj/item/device/nif/lnif = nif //Awkward. Parent clears it in an attempt to clean up.
|
|
if((. = ..()) && lnif)
|
|
QDEL_NULL(lnif.comm)
|
|
|
|
activate()
|
|
if((. = ..()))
|
|
nif.comm.initialize_exonet(nif.human)
|
|
nif.comm.ui_interact(nif.human,key_state = commlink_state)
|
|
spawn(0)
|
|
deactivate()
|
|
|
|
stat_text()
|
|
return "Show Commlink"
|
|
|
|
/datum/nifsoft/commlink/Topic(href, href_list)
|
|
if(href_list["open"])
|
|
activate()
|
|
|
|
/obj/item/device/communicator/commlink
|
|
name = "commlink"
|
|
desc = "An internal communicator, basically."
|
|
occupation = "\[Commlink\]"
|
|
var/obj/item/device/nif/nif
|
|
var/datum/nifsoft/commlink/nifsoft
|
|
|
|
New(var/newloc,var/soft)
|
|
..()
|
|
nif = newloc
|
|
nifsoft = soft
|
|
QDEL_NULL(camera) //Not supported on internal one.
|
|
|
|
Destroy()
|
|
if(nif)
|
|
nif.comm = null
|
|
nif = null
|
|
nifsoft = null
|
|
return ..()
|
|
|
|
/obj/item/device/communicator/commlink/register_device(var/new_name)
|
|
owner = new_name
|
|
name = "[owner]'s [initial(name)]"
|
|
nif.save_data["commlink_name"] = owner
|
|
|
|
//So that only the owner's chat is relayed to others.
|
|
/obj/item/device/communicator/commlink/hear_talk(mob/living/M, text, verb, datum/language/speaking)
|
|
if(M != nif.human) return
|
|
for(var/obj/item/device/communicator/comm in communicating)
|
|
|
|
var/turf/T = get_turf(comm)
|
|
if(!T) return
|
|
|
|
var/icon_object = src
|
|
|
|
var/list/mobs_to_relay
|
|
if(istype(comm,/obj/item/device/communicator/commlink))
|
|
var/obj/item/device/communicator/commlink/CL = comm
|
|
mobs_to_relay = list(CL.nif.human)
|
|
icon_object = CL.nif.big_icon
|
|
else
|
|
var/list/in_range = get_mobs_and_objs_in_view_fast(T,world.view,0)
|
|
mobs_to_relay = in_range["mobs"]
|
|
|
|
for(var/mob/mob in mobs_to_relay)
|
|
//Can whoever is hearing us understand?
|
|
if(!mob.say_understands(M, speaking))
|
|
if(speaking)
|
|
text = speaking.scramble(text)
|
|
else
|
|
text = stars(text)
|
|
var/name_used = M.GetVoice()
|
|
var/rendered = null
|
|
if(speaking) //Language being used
|
|
rendered = "<span class='game say'>\icon[icon_object] <span class='name'>[name_used]</span> [speaking.format_message(text, verb)]</span>"
|
|
else
|
|
rendered = "<span class='game say'>\icon[icon_object] <span class='name'>[name_used]</span> [verb], <span class='message'>\"[text]\"</span></span>"
|
|
mob.show_message(rendered, 2)
|
|
|
|
//Not supported by the internal one
|
|
/obj/item/device/communicator/commlink/show_message(msg, type, alt, alt_type)
|
|
return
|
|
|
|
//The silent treatment
|
|
/obj/item/device/communicator/commlink/request(var/atom/candidate)
|
|
if(candidate in voice_requests)
|
|
return
|
|
var/who = null
|
|
if(isobserver(candidate))
|
|
who = candidate.name
|
|
else if(istype(candidate, /obj/item/device/communicator))
|
|
var/obj/item/device/communicator/comm = candidate
|
|
who = comm.owner
|
|
comm.voice_invites |= src
|
|
|
|
if(!who)
|
|
return
|
|
|
|
voice_requests |= candidate
|
|
|
|
if(ringer && nif.human)
|
|
nif.notify("New commlink call from [who]. (<a href='?src=\ref[nifsoft];open=1'>Open</a>)")
|
|
|
|
//Similar reason
|
|
/obj/item/device/communicator/commlink/request_im(var/atom/candidate, var/origin_address, var/text)
|
|
var/who = null
|
|
if(isobserver(candidate))
|
|
var/mob/observer/dead/ghost = candidate
|
|
who = ghost
|
|
im_list += list(list("address" = origin_address, "to_address" = exonet.address, "im" = text))
|
|
else if(istype(candidate, /obj/item/device/communicator))
|
|
var/obj/item/device/communicator/comm = candidate
|
|
who = comm.owner
|
|
comm.im_contacts |= src
|
|
im_list += list(list("address" = origin_address, "to_address" = exonet.address, "im" = text))
|
|
else return
|
|
|
|
im_contacts |= candidate
|
|
|
|
if(!who)
|
|
return
|
|
|
|
if(ringer && nif.human)
|
|
nif.notify("Commlink message from [who]: \"[text]\" (<a href='?src=\ref[nifsoft];open=1'>Open</a>)")
|