initial commit - cross reference with 5th port - obviously has compile errors
This commit is contained in:
@@ -0,0 +1,991 @@
|
||||
|
||||
//The advanced pea-green monochrome lcd of tomorrow.
|
||||
|
||||
var/global/list/obj/item/device/pda/PDAs = list()
|
||||
|
||||
|
||||
/obj/item/device/pda
|
||||
name = "\improper PDA"
|
||||
desc = "A portable microcomputer by Thinktronic Systems, LTD. Functionality determined by a preprogrammed ROM cartridge."
|
||||
icon = 'icons/obj/pda.dmi'
|
||||
icon_state = "pda"
|
||||
item_state = "electronic"
|
||||
flags = NOBLUDGEON
|
||||
w_class = 1
|
||||
slot_flags = SLOT_ID | SLOT_BELT
|
||||
origin_tech = "programming=2"
|
||||
|
||||
//Main variables
|
||||
var/owner = null // String name of owner
|
||||
var/default_cartridge = 0 // Access level defined by cartridge
|
||||
var/obj/item/weapon/cartridge/cartridge = null //current cartridge
|
||||
var/mode = 0 //Controls what menu the PDA will display. 0 is hub; the rest are either built in or based on cartridge.
|
||||
var/icon_alert = "pda-r" //Icon to be overlayed for message alerts. Taken from the pda icon file.
|
||||
|
||||
//Secondary variables
|
||||
var/scanmode = 0 //1 is medical scanner, 2 is forensics, 3 is reagent scanner.
|
||||
var/fon = 0 //Is the flashlight function on?
|
||||
var/f_lum = 3 //Luminosity for the flashlight function
|
||||
var/silent = 0 //To beep or not to beep, that is the question
|
||||
var/toff = 0 //If 1, messenger disabled
|
||||
var/tnote = null //Current Texts
|
||||
var/last_text //No text spamming
|
||||
var/last_noise //Also no honk spamming that's bad too
|
||||
var/ttone = "beep" //The ringtone!
|
||||
var/lock_code = "" // Lockcode to unlock uplink
|
||||
var/honkamt = 0 //How many honks left when infected with honk.exe
|
||||
var/mimeamt = 0 //How many silence left when infected with mime.exe
|
||||
var/note = "Congratulations, your station has chosen the Thinktronic 5230 Personal Data Assistant!" //Current note in the notepad function
|
||||
var/notehtml = ""
|
||||
var/notescanned = 0 // True if what is in the notekeeper was from a paper.
|
||||
var/cart = "" //A place to stick cartridge menu information
|
||||
var/detonate = 1 // Can the PDA be blown up?
|
||||
var/hidden = 0 // Is the PDA hidden from the PDA list?
|
||||
var/emped = 0
|
||||
|
||||
var/obj/item/weapon/card/id/id = null //Making it possible to slot an ID card into the PDA so it can function as both.
|
||||
var/ownjob = null //related to above
|
||||
|
||||
var/obj/item/device/paicard/pai = null // A slot for a personal AI device
|
||||
|
||||
var/image/photo = null //Scanned photo
|
||||
|
||||
|
||||
/obj/item/device/pda/pickup(mob/user)
|
||||
..()
|
||||
if(fon)
|
||||
SetLuminosity(0)
|
||||
user.AddLuminosity(f_lum)
|
||||
|
||||
/obj/item/device/pda/dropped(mob/user)
|
||||
..()
|
||||
if(fon)
|
||||
user.AddLuminosity(-f_lum)
|
||||
SetLuminosity(f_lum)
|
||||
|
||||
/obj/item/device/pda/New()
|
||||
..()
|
||||
if(fon)
|
||||
if(!isturf(loc))
|
||||
loc.AddLuminosity(f_lum)
|
||||
SetLuminosity(0)
|
||||
else
|
||||
SetLuminosity(f_lum)
|
||||
PDAs += src
|
||||
if(default_cartridge)
|
||||
cartridge = new default_cartridge(src)
|
||||
new /obj/item/weapon/pen(src)
|
||||
|
||||
/obj/item/device/pda/proc/update_label()
|
||||
name = "PDA-[owner] ([ownjob])" //Name generalisation
|
||||
|
||||
/obj/item/device/pda/GetAccess()
|
||||
if(id)
|
||||
return id.GetAccess()
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/device/pda/GetID()
|
||||
return id
|
||||
|
||||
/obj/item/device/pda/MouseDrop(obj/over_object, src_location, over_location)
|
||||
var/mob/M = usr
|
||||
if((!istype(over_object, /obj/screen)) && usr.canUseTopic(src))
|
||||
return attack_self(M)
|
||||
return
|
||||
|
||||
/obj/item/device/pda/attack_self(mob/user)
|
||||
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/pda)
|
||||
assets.send(user)
|
||||
|
||||
user.set_machine(src)
|
||||
|
||||
if(hidden_uplink && hidden_uplink.active)
|
||||
hidden_uplink.interact(user)
|
||||
return
|
||||
|
||||
var/dat = "<html><head><title>Personal Data Assistant</title></head><body bgcolor=\"#808000\"><style>a, a:link, a:visited, a:active, a:hover { color: #000000; }img {border-style:none;}</style>"
|
||||
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Refresh'><img src=pda_refresh.png> Refresh</a>"
|
||||
|
||||
if ((!isnull(cartridge)) && (mode == 0))
|
||||
dat += " | <a href='byond://?src=\ref[src];choice=Eject'><img src=pda_eject.png> Eject [cartridge]</a>"
|
||||
if (mode)
|
||||
dat += " | <a href='byond://?src=\ref[src];choice=Return'><img src=pda_menu.png> Return</a>"
|
||||
|
||||
dat += "<br>"
|
||||
|
||||
if (!owner)
|
||||
dat += "Warning: No owner information entered. Please swipe card.<br><br>"
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Refresh'><img src=pda_refresh.png> Retry</a>"
|
||||
else
|
||||
switch (mode)
|
||||
if (0)
|
||||
dat += "<h2>PERSONAL DATA ASSISTANT v.1.2</h2>"
|
||||
dat += "Owner: [owner], [ownjob]<br>"
|
||||
dat += text("ID: <A href='?src=\ref[src];choice=Authenticate'>[id ? "[id.registered_name], [id.assignment]" : "----------"]")
|
||||
dat += text("<br><A href='?src=\ref[src];choice=UpdateInfo'>[id ? "Update PDA Info" : ""]</A><br><br>")
|
||||
|
||||
dat += "[worldtime2text()]<br>" //:[world.time / 100 % 6][world.time / 100 % 10]"
|
||||
dat += "[time2text(world.realtime, "MMM DD")] [year_integer+540]"
|
||||
|
||||
dat += "<br><br>"
|
||||
|
||||
dat += "<h4>General Functions</h4>"
|
||||
dat += "<ul>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=1'><img src=pda_notes.png> Notekeeper</a></li>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=2'><img src=pda_mail.png> Messenger</a></li>"
|
||||
|
||||
if (cartridge)
|
||||
if (cartridge.access_clown)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Honk'><img src=pda_honk.png> Honk Synthesizer</a></li>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Trombone'><img src=pda_honk.png> Sad Trombone</a></li>"
|
||||
if (cartridge.access_manifest)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=41'><img src=pda_notes.png> View Crew Manifest</a></li>"
|
||||
if(cartridge.access_status_display)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=42'><img src=pda_status.png> Set Status Display</a></li>"
|
||||
dat += "</ul>"
|
||||
if (cartridge.access_engine)
|
||||
dat += "<h4>Engineering Functions</h4>"
|
||||
dat += "<ul>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=43'><img src=pda_power.png> Power Monitor</a></li>"
|
||||
dat += "</ul>"
|
||||
if (cartridge.access_medical)
|
||||
dat += "<h4>Medical Functions</h4>"
|
||||
dat += "<ul>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=44'><img src=pda_medical.png> Medical Records</a></li>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Medical Scan'><img src=pda_scanner.png> [scanmode == 1 ? "Disable" : "Enable"] Medical Scanner</a></li>"
|
||||
dat += "</ul>"
|
||||
if (cartridge.access_security)
|
||||
dat += "<h4>Security Functions</h4>"
|
||||
dat += "<ul>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=45'><img src=pda_cuffs.png> Security Records</A></li>"
|
||||
dat += "</ul>"
|
||||
if(cartridge.access_quartermaster)
|
||||
dat += "<h4>Quartermaster Functions:</h4>"
|
||||
dat += "<ul>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=47'><img src=pda_crate.png> Supply Records</A></li>"
|
||||
dat += "</ul>"
|
||||
dat += "</ul>"
|
||||
|
||||
dat += "<h4>Utilities</h4>"
|
||||
dat += "<ul>"
|
||||
if (cartridge)
|
||||
if(cartridge.bot_access_flags)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=54'><img src=pda_medbot.png> Bots Access</a></li>"
|
||||
if (cartridge.access_janitor)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=49'><img src=pda_bucket.png> Custodial Locator</a></li>"
|
||||
if (istype(cartridge.radio, /obj/item/radio/integrated/signal))
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=40'><img src=pda_signaler.png> Signaler System</a></li>"
|
||||
if (cartridge.access_newscaster)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=53'><img src=pda_notes.png> Newscaster Access </a></li>"
|
||||
if (cartridge.access_reagent_scanner)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Reagent Scan'><img src=pda_reagent.png> [scanmode == 3 ? "Disable" : "Enable"] Reagent Scanner</a></li>"
|
||||
if (cartridge.access_engine)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Halogen Counter'><img src=pda_reagent.png> [scanmode == 4 ? "Disable" : "Enable"] Halogen Counter</a></li>"
|
||||
if (cartridge.access_atmos)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Gas Scan'><img src=pda_reagent.png> [scanmode == 5 ? "Disable" : "Enable"] Gas Scanner</a></li>"
|
||||
if (cartridge.access_remote_door)
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Toggle Door'><img src=pda_rdoor.png> Toggle Remote Door</a></li>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=3'><img src=pda_atmos.png> Atmospheric Scan</a></li>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Light'><img src=pda_flashlight.png> [fon ? "Disable" : "Enable"] Flashlight</a></li>"
|
||||
if (pai)
|
||||
if(pai.loc != src)
|
||||
pai = null
|
||||
else
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=pai;option=1'>pAI Device Configuration</a></li>"
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=pai;option=2'>Eject pAI Device</a></li>"
|
||||
dat += "</ul>"
|
||||
|
||||
if (1)
|
||||
dat += "<h4><img src=pda_notes.png> Notekeeper V2.2</h4>"
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Edit'>Edit</a><br>"
|
||||
if(notescanned)
|
||||
dat += "(This is a scanned image, editing it may cause some text formatting to change.)<br>"
|
||||
dat += "<HR><font face=\"[PEN_FONT]\">[(!notehtml ? note : notehtml)]</font>"
|
||||
|
||||
if (2)
|
||||
dat += "<h4><img src=pda_mail.png> SpaceMessenger V3.9.6</h4>"
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Toggle Ringer'><img src=pda_bell.png> Ringer: [silent == 1 ? "Off" : "On"]</a> | "
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Toggle Messenger'><img src=pda_mail.png> Send / Receive: [toff == 1 ? "Off" : "On"]</a> | "
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Ringtone'><img src=pda_bell.png> Set Ringtone</a> | "
|
||||
dat += "<a href='byond://?src=\ref[src];choice=21'><img src=pda_mail.png> Messages</a><br>"
|
||||
|
||||
if (istype(cartridge, /obj/item/weapon/cartridge/syndicate))
|
||||
dat += "<b>[cartridge:shock_charges] detonation charges left.</b><HR>"
|
||||
if (istype(cartridge, /obj/item/weapon/cartridge/clown))
|
||||
dat += "<b>[cartridge:honk_charges] viral files left.</b><HR>"
|
||||
if (istype(cartridge, /obj/item/weapon/cartridge/mime))
|
||||
dat += "<b>[cartridge:mime_charges] viral files left.</b><HR>"
|
||||
|
||||
dat += "<h4><img src=pda_menu.png> Detected PDAs</h4>"
|
||||
|
||||
dat += "<ul>"
|
||||
var/count = 0
|
||||
|
||||
if (!toff)
|
||||
for (var/obj/item/device/pda/P in sortNames(get_viewable_pdas()))
|
||||
if (P == src)
|
||||
continue
|
||||
dat += "<li><a href='byond://?src=\ref[src];choice=Message;target=\ref[P]'>[P]</a>"
|
||||
if (istype(cartridge, /obj/item/weapon/cartridge/syndicate) && P.detonate)
|
||||
dat += " (<a href='byond://?src=\ref[src];choice=Detonate;target=\ref[P]'><img src=pda_boom.png>*Detonate*</a>)"
|
||||
if (istype(cartridge, /obj/item/weapon/cartridge/clown))
|
||||
dat += " (<a href='byond://?src=\ref[src];choice=Send Honk;target=\ref[P]'><img src=pda_honk.png>*Send Virus*</a>)"
|
||||
if (istype(cartridge, /obj/item/weapon/cartridge/mime))
|
||||
dat += " (<a href='byond://?src=\ref[src];choice=Send Silence;target=\ref[P]'>*Send Virus*</a>)"
|
||||
dat += "</li>"
|
||||
count++
|
||||
dat += "</ul>"
|
||||
if (count == 0)
|
||||
dat += "None detected.<br>"
|
||||
else if(cartridge && cartridge.spam_enabled)
|
||||
dat += "<a href='byond://?src=\ref[src];choice=MessageAll'>Send To All</a>"
|
||||
|
||||
if(21)
|
||||
dat += "<h4><img src=pda_mail.png> SpaceMessenger V3.9.6</h4>"
|
||||
dat += "<a href='byond://?src=\ref[src];choice=Clear'><img src=pda_blank.png> Clear Messages</a>"
|
||||
|
||||
dat += "<h4><img src=pda_mail.png> Messages</h4>"
|
||||
|
||||
dat += tnote
|
||||
dat += "<br>"
|
||||
|
||||
if (3)
|
||||
dat += "<h4><img src=pda_atmos.png> Atmospheric Readings</h4>"
|
||||
|
||||
var/turf/T = user.loc
|
||||
if (isnull(T))
|
||||
dat += "Unable to obtain a reading.<br>"
|
||||
else
|
||||
var/datum/gas_mixture/environment = T.return_air()
|
||||
var/list/env_gases = environment.gases
|
||||
|
||||
var/pressure = environment.return_pressure()
|
||||
var/total_moles = environment.total_moles()
|
||||
|
||||
dat += "Air Pressure: [round(pressure,0.1)] kPa<br>"
|
||||
|
||||
if (total_moles)
|
||||
for(var/id in env_gases)
|
||||
var/gas_level = env_gases[id][MOLES]/total_moles
|
||||
if(gas_level > 0)
|
||||
dat += "[env_gases[id][GAS_META][META_GAS_NAME]]: [round(gas_level*100, 0.01)]%<br>"
|
||||
|
||||
dat += "Temperature: [round(environment.temperature-T0C)]°C<br>"
|
||||
dat += "<br>"
|
||||
|
||||
else//Else it links to the cart menu proc. Although, it really uses menu hub 4--menu 4 doesn't really exist as it simply redirects to hub.
|
||||
dat += cart
|
||||
|
||||
dat += "</body></html>"
|
||||
user << browse(dat, "window=pda;size=400x450;border=1;can_resize=1;can_minimize=0")
|
||||
onclose(user, "pda", src)
|
||||
|
||||
/obj/item/device/pda/Topic(href, href_list)
|
||||
..()
|
||||
var/mob/living/U = usr
|
||||
//Looking for master was kind of pointless since PDAs don't appear to have one.
|
||||
|
||||
if(usr.canUseTopic(src) && !href_list["close"])
|
||||
add_fingerprint(U)
|
||||
U.set_machine(src)
|
||||
|
||||
switch(href_list["choice"])
|
||||
|
||||
//BASIC FUNCTIONS===================================
|
||||
|
||||
if("Refresh")//Refresh, goes to the end of the proc.
|
||||
if("Return")//Return
|
||||
if(mode<=9)
|
||||
mode = 0
|
||||
else
|
||||
mode = round(mode/10)
|
||||
if(mode==4 || mode == 5)//Fix for cartridges. Redirects to hub.
|
||||
mode = 0
|
||||
else if(mode >= 40 && mode <= 59)//Fix for cartridges. Redirects to refresh the menu.
|
||||
cartridge.mode = mode
|
||||
cartridge.unlock()
|
||||
if ("Authenticate")//Checks for ID
|
||||
id_check(U, 1)
|
||||
if("UpdateInfo")
|
||||
ownjob = id.assignment
|
||||
update_label()
|
||||
if("Eject")//Ejects the cart, only done from hub.
|
||||
if (!isnull(cartridge))
|
||||
var/turf/T = loc
|
||||
if(ismob(T))
|
||||
T = T.loc
|
||||
cartridge.loc = T
|
||||
scanmode = 0
|
||||
if (cartridge.radio)
|
||||
cartridge.radio.hostpda = null
|
||||
cartridge = null
|
||||
|
||||
//MENU FUNCTIONS===================================
|
||||
|
||||
if("0")//Hub
|
||||
mode = 0
|
||||
if("1")//Notes
|
||||
mode = 1
|
||||
if("2")//Messenger
|
||||
mode = 2
|
||||
if("21")//Read messeges
|
||||
mode = 21
|
||||
if("3")//Atmos scan
|
||||
mode = 3
|
||||
if("4")//Redirects to hub
|
||||
mode = 0
|
||||
|
||||
|
||||
//MAIN FUNCTIONS===================================
|
||||
|
||||
if("Light")
|
||||
if(fon)
|
||||
fon = 0
|
||||
if(src in U.contents)
|
||||
U.AddLuminosity(-f_lum)
|
||||
else
|
||||
SetLuminosity(0)
|
||||
else
|
||||
fon = 1
|
||||
if(src in U.contents)
|
||||
U.AddLuminosity(f_lum)
|
||||
else
|
||||
SetLuminosity(f_lum)
|
||||
if("Medical Scan")
|
||||
if(scanmode == 1)
|
||||
scanmode = 0
|
||||
else if((!isnull(cartridge)) && (cartridge.access_medical))
|
||||
scanmode = 1
|
||||
if("Reagent Scan")
|
||||
if(scanmode == 3)
|
||||
scanmode = 0
|
||||
else if((!isnull(cartridge)) && (cartridge.access_reagent_scanner))
|
||||
scanmode = 3
|
||||
if("Halogen Counter")
|
||||
if(scanmode == 4)
|
||||
scanmode = 0
|
||||
else if((!isnull(cartridge)) && (cartridge.access_engine))
|
||||
scanmode = 4
|
||||
if("Honk")
|
||||
if ( !(last_noise && world.time < last_noise + 20) )
|
||||
playsound(loc, 'sound/items/bikehorn.ogg', 50, 1)
|
||||
last_noise = world.time
|
||||
if("Trombone")
|
||||
if ( !(last_noise && world.time < last_noise + 20) )
|
||||
playsound(loc, 'sound/misc/sadtrombone.ogg', 50, 1)
|
||||
last_noise = world.time
|
||||
if("Gas Scan")
|
||||
if(scanmode == 5)
|
||||
scanmode = 0
|
||||
else if((!isnull(cartridge)) && (cartridge.access_atmos))
|
||||
scanmode = 5
|
||||
|
||||
//NOTEKEEPER FUNCTIONS===================================
|
||||
|
||||
if ("Edit")
|
||||
var/n = stripped_multiline_input(U, "Please enter message", name, note)
|
||||
if (in_range(src, U) && loc == U)
|
||||
if (mode == 1 && n)
|
||||
note = n
|
||||
notehtml = parsepencode(n, U, SIGNFONT)
|
||||
notescanned = 0
|
||||
else
|
||||
U << browse(null, "window=pda")
|
||||
return
|
||||
|
||||
//MESSENGER FUNCTIONS===================================
|
||||
|
||||
if("Toggle Messenger")
|
||||
toff = !toff
|
||||
if("Toggle Ringer")//If viewing texts then erase them, if not then toggle silent status
|
||||
silent = !silent
|
||||
if("Clear")//Clears messages
|
||||
tnote = null
|
||||
if("Ringtone")
|
||||
var/t = input(U, "Please enter new ringtone", name, ttone) as text
|
||||
if(in_range(src, U) && loc == U)
|
||||
if(t)
|
||||
if(hidden_uplink && (trim(lowertext(t)) == trim(lowertext(lock_code))))
|
||||
hidden_uplink.interact(U)
|
||||
U << "The PDA softly beeps."
|
||||
U << browse(null, "window=pda")
|
||||
src.mode = 0
|
||||
else
|
||||
t = copytext(sanitize(t), 1, 20)
|
||||
ttone = t
|
||||
else
|
||||
U << browse(null, "window=pda")
|
||||
return
|
||||
if("Message")
|
||||
var/obj/item/device/pda/P = locate(href_list["target"])
|
||||
src.create_message(U, P)
|
||||
|
||||
if("MessageAll")
|
||||
src.send_to_all(U)
|
||||
|
||||
if("Send Honk")//Honk virus
|
||||
if(istype(cartridge, /obj/item/weapon/cartridge/clown))//Cartridge checks are kind of unnecessary since everything is done through switch.
|
||||
var/obj/item/device/pda/P = locate(href_list["target"])//Leaving it alone in case it may do something useful, I guess.
|
||||
if(!isnull(P))
|
||||
if (!P.toff && cartridge:honk_charges > 0)
|
||||
cartridge:honk_charges--
|
||||
U.show_message("<span class='notice'>Virus sent!</span>", 1)
|
||||
P.honkamt = (rand(15,20))
|
||||
else
|
||||
U << "PDA not found."
|
||||
else
|
||||
U << browse(null, "window=pda")
|
||||
return
|
||||
if("Send Silence")//Silent virus
|
||||
if(istype(cartridge, /obj/item/weapon/cartridge/mime))
|
||||
var/obj/item/device/pda/P = locate(href_list["target"])
|
||||
if(!isnull(P))
|
||||
if (!P.toff && cartridge:mime_charges > 0)
|
||||
cartridge:mime_charges--
|
||||
U.show_message("<span class='notice'>Virus sent!</span>", 1)
|
||||
P.silent = 1
|
||||
P.ttone = "silence"
|
||||
else
|
||||
U << "PDA not found."
|
||||
else
|
||||
U << browse(null, "window=pda")
|
||||
return
|
||||
|
||||
//SYNDICATE FUNCTIONS===================================
|
||||
|
||||
if("Toggle Door")
|
||||
if(cartridge && cartridge.access_remote_door)
|
||||
for(var/obj/machinery/door/poddoor/M in machines)
|
||||
if(M.id == cartridge.remote_door_id)
|
||||
if(M.density)
|
||||
M.open()
|
||||
else
|
||||
M.close()
|
||||
|
||||
if("Detonate")//Detonate PDA
|
||||
if(istype(cartridge, /obj/item/weapon/cartridge/syndicate))
|
||||
var/obj/item/device/pda/P = locate(href_list["target"])
|
||||
if(!isnull(P))
|
||||
if (!P.toff && cartridge:shock_charges > 0)
|
||||
cartridge:shock_charges--
|
||||
|
||||
var/difficulty = 0
|
||||
|
||||
if(P.cartridge)
|
||||
difficulty += P.cartridge.access_medical
|
||||
difficulty += P.cartridge.access_security
|
||||
difficulty += P.cartridge.access_engine
|
||||
difficulty += P.cartridge.access_clown
|
||||
difficulty += P.cartridge.access_janitor
|
||||
difficulty += P.cartridge.access_manifest * 2
|
||||
else
|
||||
difficulty += 2
|
||||
|
||||
if(prob(difficulty * 15) || (P.hidden_uplink))
|
||||
U.show_message("<span class='danger'>An error flashes on your [src].</span>", 1)
|
||||
else
|
||||
U.show_message("<span class='notice'>Success!</span>", 1)
|
||||
P.explode()
|
||||
else
|
||||
U << "PDA not found."
|
||||
else
|
||||
U.unset_machine()
|
||||
U << browse(null, "window=pda")
|
||||
return
|
||||
|
||||
//pAI FUNCTIONS===================================
|
||||
if("pai")
|
||||
switch(href_list["option"])
|
||||
if("1") // Configure pAI device
|
||||
pai.attack_self(U)
|
||||
if("2") // Eject pAI device
|
||||
var/turf/T = get_turf(src.loc)
|
||||
if(T)
|
||||
pai.loc = T
|
||||
|
||||
//LINK FUNCTIONS===================================
|
||||
|
||||
else//Cartridge menu linking
|
||||
mode = text2num(href_list["choice"])
|
||||
if(cartridge)
|
||||
cartridge.mode = mode
|
||||
cartridge.unlock()
|
||||
else//If not in range, can't interact or not using the pda.
|
||||
U.unset_machine()
|
||||
U << browse(null, "window=pda")
|
||||
return
|
||||
|
||||
//EXTRA FUNCTIONS===================================
|
||||
|
||||
if (mode == 2||mode == 21)//To clear message overlays.
|
||||
cut_overlays()
|
||||
|
||||
if ((honkamt > 0) && (prob(60)))//For clown virus.
|
||||
honkamt--
|
||||
playsound(loc, 'sound/items/bikehorn.ogg', 30, 1)
|
||||
|
||||
if(U.machine == src && href_list["skiprefresh"]!="1")//Final safety.
|
||||
attack_self(U)//It auto-closes the menu prior if the user is not in range and so on.
|
||||
else
|
||||
U.unset_machine()
|
||||
U << browse(null, "window=pda")
|
||||
return
|
||||
|
||||
/obj/item/device/pda/proc/remove_id()
|
||||
if (id)
|
||||
if (ismob(loc))
|
||||
var/mob/M = loc
|
||||
M.put_in_hands(id)
|
||||
usr << "<span class='notice'>You remove the ID from the [name].</span>"
|
||||
else
|
||||
id.loc = get_turf(src)
|
||||
id = null
|
||||
|
||||
/obj/item/device/pda/proc/msg_input(mob/living/U = usr)
|
||||
var/t = stripped_input(U, "Please enter message", name, null, MAX_MESSAGE_LEN)
|
||||
if (!t || toff)
|
||||
return
|
||||
if (!in_range(src, U) && loc != U)
|
||||
return
|
||||
if(!U.canUseTopic(src))
|
||||
return
|
||||
if(emped)
|
||||
t = Gibberish(t, 100)
|
||||
return t
|
||||
|
||||
/obj/item/device/pda/proc/send_message(mob/living/user = usr,list/obj/item/device/pda/targets)
|
||||
var/message = msg_input(user)
|
||||
|
||||
if(!message || !targets.len)
|
||||
return
|
||||
|
||||
if(last_text && world.time < last_text + 5)
|
||||
return
|
||||
|
||||
var/multiple = targets.len > 1
|
||||
|
||||
var/datum/data_pda_msg/last_sucessful_msg
|
||||
for(var/obj/item/device/pda/P in targets)
|
||||
if(P == src)
|
||||
continue
|
||||
var/obj/machinery/message_server/MS = null
|
||||
MS = can_send(P)
|
||||
if(MS)
|
||||
var/datum/data_pda_msg/msg = MS.send_pda_message("[P.owner]","[owner]","[message]",photo)
|
||||
if(msg)
|
||||
last_sucessful_msg = msg
|
||||
if(!multiple)
|
||||
show_to_sender(msg)
|
||||
P.show_recieved_message(msg,src)
|
||||
if(!multiple)
|
||||
show_to_ghosts(user,msg)
|
||||
log_pda("[user] (PDA: [src.name]) sent \"[message]\" to [P.name]")
|
||||
else
|
||||
if(!multiple)
|
||||
user << "<span class='notice'>ERROR: Server isn't responding.</span>"
|
||||
return
|
||||
photo = null
|
||||
|
||||
if(multiple)
|
||||
show_to_sender(last_sucessful_msg,1)
|
||||
show_to_ghosts(user,last_sucessful_msg,1)
|
||||
log_pda("[user] (PDA: [src.name]) sent \"[message]\" to Everyone")
|
||||
|
||||
/obj/item/device/pda/proc/show_to_sender(datum/data_pda_msg/msg,multiple = 0)
|
||||
tnote += "<i><b>→ To [multiple ? "Everyone" : msg.recipient]:</b></i><br>[msg.message][msg.get_photo_ref()]<br>"
|
||||
|
||||
/obj/item/device/pda/proc/show_recieved_message(datum/data_pda_msg/msg,obj/item/device/pda/source)
|
||||
tnote += "<i><b>← From <a href='byond://?src=\ref[src];choice=Message;target=\ref[source]'>[source.owner]</a> ([source.ownjob]):</b></i><br>[msg.message][msg.get_photo_ref()]<br>"
|
||||
|
||||
if (!silent)
|
||||
playsound(loc, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
audible_message("\icon[src] *[ttone]*", null, 3)
|
||||
//Search for holder of the PDA.
|
||||
var/mob/living/L = null
|
||||
if(loc && isliving(loc))
|
||||
L = loc
|
||||
//Maybe they are a pAI!
|
||||
else
|
||||
L = get(src, /mob/living/silicon)
|
||||
|
||||
if(L && L.stat != UNCONSCIOUS)
|
||||
L << "\icon[src] <b>Message from [source.owner] ([source.ownjob]), </b>\"[msg.message]\"[msg.get_photo_ref()] (<a href='byond://?src=\ref[src];choice=Message;skiprefresh=1;target=\ref[source]'>Reply</a>)"
|
||||
|
||||
cut_overlays()
|
||||
add_overlay(image(icon, icon_alert))
|
||||
|
||||
/obj/item/device/pda/proc/show_to_ghosts(mob/living/user, datum/data_pda_msg/msg,multiple = 0)
|
||||
for(var/mob/M in player_list)
|
||||
if(isobserver(M) && M.client && (M.client.prefs.chat_toggles & CHAT_GHOSTPDA))
|
||||
var/link = FOLLOW_LINK(M, user)
|
||||
M << "[link] <span class='name'>[msg.sender] </span><span class='game say'>PDA Message</span> --> <span class='name'>[multiple ? "Everyone" : msg.recipient]</span>: <span class='message'>[msg.message][msg.get_photo_ref()]</span></span>"
|
||||
|
||||
/obj/item/device/pda/proc/can_send(obj/item/device/pda/P)
|
||||
if(!P || qdeleted(P) || P.toff)
|
||||
return null
|
||||
|
||||
var/obj/machinery/message_server/useMS = null
|
||||
if(message_servers)
|
||||
for (var/obj/machinery/message_server/MS in message_servers)
|
||||
//PDAs are now dependant on the Message Server.
|
||||
if(MS.active)
|
||||
useMS = MS
|
||||
break
|
||||
|
||||
var/datum/signal/signal = src.telecomms_process()
|
||||
|
||||
if(!P || qdeleted(P) || P.toff) //in case the PDA or mob gets destroyed during telecomms_process()
|
||||
return null
|
||||
|
||||
var/useTC = 0
|
||||
if(signal)
|
||||
if(signal.data["done"])
|
||||
useTC = 1
|
||||
var/turf/pos = get_turf(P)
|
||||
if(pos.z in signal.data["level"])
|
||||
useTC = 2
|
||||
|
||||
if(useTC == 2)
|
||||
return useMS
|
||||
else
|
||||
return null
|
||||
|
||||
|
||||
/obj/item/device/pda/proc/send_to_all(mob/living/U = usr)
|
||||
send_message(U,get_viewable_pdas())
|
||||
|
||||
/obj/item/device/pda/proc/create_message(mob/living/U = usr, obj/item/device/pda/P)
|
||||
send_message(U,list(P))
|
||||
|
||||
/obj/item/device/pda/AltClick()
|
||||
..()
|
||||
|
||||
if(issilicon(usr))
|
||||
return
|
||||
|
||||
if(usr.canUseTopic(src))
|
||||
if(id)
|
||||
remove_id()
|
||||
else
|
||||
usr << "<span class='warning'>This PDA does not have an ID in it!</span>"
|
||||
|
||||
/obj/item/device/pda/verb/verb_remove_id()
|
||||
set category = "Object"
|
||||
set name = "Eject ID"
|
||||
set src in usr
|
||||
|
||||
if(issilicon(usr))
|
||||
return
|
||||
|
||||
if (usr.canUseTopic(src))
|
||||
if(id)
|
||||
remove_id()
|
||||
else
|
||||
usr << "<span class='warning'>This PDA does not have an ID in it!</span>"
|
||||
|
||||
/obj/item/device/pda/verb/verb_remove_pen()
|
||||
set category = "Object"
|
||||
set name = "Remove Pen"
|
||||
set src in usr
|
||||
|
||||
if(issilicon(usr))
|
||||
return
|
||||
|
||||
if (usr.canUseTopic(src))
|
||||
var/obj/item/weapon/pen/O = locate() in src
|
||||
if(O)
|
||||
if (istype(loc, /mob))
|
||||
var/mob/M = loc
|
||||
if(M.get_active_hand() == null)
|
||||
M.put_in_hands(O)
|
||||
usr << "<span class='notice'>You remove \the [O] from \the [src].</span>"
|
||||
return
|
||||
O.loc = get_turf(src)
|
||||
else
|
||||
usr << "<span class='warning'>This PDA does not have a pen in it!</span>"
|
||||
|
||||
/obj/item/device/pda/proc/id_check(mob/user, choice as num)//To check for IDs; 1 for in-pda use, 2 for out of pda use.
|
||||
if(choice == 1)
|
||||
if (id)
|
||||
remove_id()
|
||||
else
|
||||
var/obj/item/I = user.get_active_hand()
|
||||
if (istype(I, /obj/item/weapon/card/id))
|
||||
if(!user.unEquip(I))
|
||||
return 0
|
||||
I.loc = src
|
||||
id = I
|
||||
else
|
||||
var/obj/item/weapon/card/I = user.get_active_hand()
|
||||
if (istype(I, /obj/item/weapon/card/id) && I:registered_name)
|
||||
if(!user.unEquip(I))
|
||||
return 0
|
||||
var/obj/old_id = id
|
||||
I.loc = src
|
||||
id = I
|
||||
user.put_in_hands(old_id)
|
||||
return 1
|
||||
|
||||
// access to status display signals
|
||||
/obj/item/device/pda/attackby(obj/item/C, mob/user, params)
|
||||
if(istype(C, /obj/item/weapon/cartridge) && !cartridge)
|
||||
cartridge = C
|
||||
if(!user.unEquip(C))
|
||||
return
|
||||
cartridge.loc = src
|
||||
user << "<span class='notice'>You insert [cartridge] into [src].</span>"
|
||||
if(cartridge.radio)
|
||||
cartridge.radio.hostpda = src
|
||||
|
||||
else if(istype(C, /obj/item/weapon/card/id))
|
||||
var/obj/item/weapon/card/id/idcard = C
|
||||
if(!idcard.registered_name)
|
||||
user << "<span class='warning'>\The [src] rejects the ID!</span>"
|
||||
return
|
||||
if(!owner)
|
||||
owner = idcard.registered_name
|
||||
ownjob = idcard.assignment
|
||||
update_label()
|
||||
user << "<span class='notice'>Card scanned.</span>"
|
||||
else
|
||||
//Basic safety check. If either both objects are held by user or PDA is on ground and card is in hand.
|
||||
if(((src in user.contents) && (C in user.contents)) || (istype(loc, /turf) && in_range(src, user) && (C in user.contents)) )
|
||||
if(!id_check(user, 2))
|
||||
return
|
||||
user << "<span class='notice'>You put the ID into \the [src]'s slot.</span>"
|
||||
updateSelfDialog()//Update self dialog on success.
|
||||
return //Return in case of failed check or when successful.
|
||||
updateSelfDialog()//For the non-input related code.
|
||||
else if(istype(C, /obj/item/device/paicard) && !src.pai)
|
||||
if(!user.unEquip(C))
|
||||
return
|
||||
C.loc = src
|
||||
pai = C
|
||||
user << "<span class='notice'>You slot \the [C] into [src].</span>"
|
||||
updateUsrDialog()
|
||||
else if(istype(C, /obj/item/weapon/pen))
|
||||
var/obj/item/weapon/pen/O = locate() in src
|
||||
if(O)
|
||||
user << "<span class='warning'>There is already a pen in \the [src]!</span>"
|
||||
else
|
||||
if(!user.unEquip(C))
|
||||
return
|
||||
C.loc = src
|
||||
user << "<span class='notice'>You slide \the [C] into \the [src].</span>"
|
||||
else if(istype(C, /obj/item/weapon/photo))
|
||||
var/obj/item/weapon/photo/P = C
|
||||
photo = P.img
|
||||
user << "<span class='notice'>You scan \the [C].</span>"
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/device/pda/attack(mob/living/carbon/C, mob/living/user)
|
||||
if(istype(C))
|
||||
switch(scanmode)
|
||||
|
||||
if(1)
|
||||
C.visible_message("<span class='alert'>[user] has analyzed [C]'s vitals!</span>")
|
||||
healthscan(user, C, 1)
|
||||
add_fingerprint(user)
|
||||
|
||||
if(2)
|
||||
// Unused
|
||||
|
||||
if(4)
|
||||
C.visible_message("<span class='warning'>[user] has analyzed [C]'s radiation levels!</span>")
|
||||
|
||||
user.show_message("<span class='notice'>Analyzing Results for [C]:</span>")
|
||||
if(C.radiation)
|
||||
user.show_message("\green Radiation Level: \black [C.radiation]")
|
||||
else
|
||||
user.show_message("<span class='notice'>No radiation detected.</span>")
|
||||
|
||||
/obj/item/device/pda/afterattack(atom/A as mob|obj|turf|area, mob/user, proximity)
|
||||
if(!proximity) return
|
||||
switch(scanmode)
|
||||
|
||||
if(3)
|
||||
if(!isnull(A.reagents))
|
||||
if(A.reagents.reagent_list.len > 0)
|
||||
var/reagents_length = A.reagents.reagent_list.len
|
||||
user << "<span class='notice'>[reagents_length] chemical agent[reagents_length > 1 ? "s" : ""] found.</span>"
|
||||
for (var/re in A.reagents.reagent_list)
|
||||
user << "<span class='notice'>\t [re]</span>"
|
||||
else
|
||||
user << "<span class='notice'>No active chemical agents found in [A].</span>"
|
||||
else
|
||||
user << "<span class='notice'>No significant chemical agents found in [A].</span>"
|
||||
|
||||
if(5)
|
||||
if (istype(A, /obj/item/weapon/tank))
|
||||
var/obj/item/weapon/tank/T = A
|
||||
atmosanalyzer_scan(T.air_contents, user, T)
|
||||
else if (istype(A, /obj/machinery/portable_atmospherics))
|
||||
var/obj/machinery/portable_atmospherics/PA = A
|
||||
atmosanalyzer_scan(PA.air_contents, user, PA)
|
||||
else if (istype(A, /obj/machinery/atmospherics/pipe))
|
||||
var/obj/machinery/atmospherics/pipe/P = A
|
||||
atmosanalyzer_scan(P.parent.air, user, P)
|
||||
else if (istype(A, /obj/machinery/power/rad_collector))
|
||||
var/obj/machinery/power/rad_collector/RC = A
|
||||
if(RC.loaded_tank)
|
||||
atmosanalyzer_scan(RC.loaded_tank.air_contents, user, RC)
|
||||
else if (istype(A, /obj/item/weapon/flamethrower))
|
||||
var/obj/item/weapon/flamethrower/F = A
|
||||
if(F.ptank)
|
||||
atmosanalyzer_scan(F.ptank.air_contents, user, F)
|
||||
|
||||
if (!scanmode && istype(A, /obj/item/weapon/paper) && owner)
|
||||
var/obj/item/weapon/paper/PP = A
|
||||
if (!PP.info)
|
||||
user << "<span class='warning'>Unable to scan! Paper is blank.</span>"
|
||||
return
|
||||
notehtml = PP.info
|
||||
note = replacetext(notehtml, "<BR>", "\[br\]")
|
||||
note = replacetext(note, "<li>", "\[*\]")
|
||||
note = replacetext(note, "<ul>", "\[list\]")
|
||||
note = replacetext(note, "</ul>", "\[/list\]")
|
||||
note = html_encode(note)
|
||||
notescanned = 1
|
||||
user << "<span class='notice'>Paper scanned. Saved to PDA's notekeeper.</span>" //concept of scanning paper copyright brainoblivion 2009
|
||||
|
||||
|
||||
/obj/item/device/pda/proc/explode() //This needs tuning.
|
||||
if(!detonate) return
|
||||
var/turf/T = get_turf(src)
|
||||
|
||||
if (ismob(loc))
|
||||
var/mob/M = loc
|
||||
M.show_message("<span class='userdanger'>Your [src] explodes!</span>", 1)
|
||||
else
|
||||
visible_message("<span class='danger'>[src] explodes!</span>", "<span class='warning'>You hear a loud *pop*!</span>")
|
||||
|
||||
if(T)
|
||||
T.hotspot_expose(700,125)
|
||||
if(istype(cartridge, /obj/item/weapon/cartridge/syndicate))
|
||||
explosion(T, -1, 1, 3, 4)
|
||||
else
|
||||
explosion(T, -1, -1, 2, 3)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/obj/item/device/pda/Destroy()
|
||||
PDAs -= src
|
||||
return ..()
|
||||
|
||||
//AI verb and proc for sending PDA messages.
|
||||
|
||||
/mob/living/silicon/ai/proc/cmd_send_pdamesg(mob/user)
|
||||
var/list/names = list()
|
||||
var/list/plist = list()
|
||||
var/list/namecounts = list()
|
||||
|
||||
if(user.stat == 2)
|
||||
return //won't work if dead
|
||||
|
||||
if(src.aiPDA.toff)
|
||||
user << "Turn on your receiver in order to send messages."
|
||||
return
|
||||
|
||||
for (var/obj/item/device/pda/P in get_viewable_pdas())
|
||||
if (P == src)
|
||||
continue
|
||||
else if (P == src.aiPDA)
|
||||
continue
|
||||
|
||||
var/name = P.owner
|
||||
if (name in names)
|
||||
namecounts[name]++
|
||||
name = text("[name] ([namecounts[name]])")
|
||||
else
|
||||
names.Add(name)
|
||||
namecounts[name] = 1
|
||||
|
||||
plist[text("[name]")] = P
|
||||
|
||||
var/c = input(user, "Please select a PDA") as null|anything in sortList(plist)
|
||||
|
||||
if (!c)
|
||||
return
|
||||
|
||||
var/selected = plist[c]
|
||||
|
||||
if(aicamera.aipictures.len>0)
|
||||
var/add_photo = input(user,"Do you want to attach a photo?","Photo","No") as null|anything in list("Yes","No")
|
||||
if(add_photo=="Yes")
|
||||
var/datum/picture/Pic = aicamera.selectpicture(aicamera)
|
||||
src.aiPDA.photo = Pic.fields["img"]
|
||||
src.aiPDA.create_message(src, selected)
|
||||
|
||||
|
||||
/mob/living/silicon/ai/verb/cmd_toggle_pda_receiver()
|
||||
set category = "AI Commands"
|
||||
set name = "PDA - Toggle Sender/Receiver"
|
||||
if(usr.stat == 2)
|
||||
return //won't work if dead
|
||||
if(!isnull(aiPDA))
|
||||
aiPDA.toff = !aiPDA.toff
|
||||
usr << "<span class='notice'>PDA sender/receiver toggled [(aiPDA.toff ? "Off" : "On")]!</span>"
|
||||
else
|
||||
usr << "You do not have a PDA. You should make an issue report about this."
|
||||
|
||||
/mob/living/silicon/ai/verb/cmd_toggle_pda_silent()
|
||||
set category = "AI Commands"
|
||||
set name = "PDA - Toggle Ringer"
|
||||
if(usr.stat == 2)
|
||||
return //won't work if dead
|
||||
if(!isnull(aiPDA))
|
||||
//0
|
||||
aiPDA.silent = !aiPDA.silent
|
||||
usr << "<span class='notice'>PDA ringer toggled [(aiPDA.silent ? "Off" : "On")]!</span>"
|
||||
else
|
||||
usr << "You do not have a PDA. You should make an issue report about this."
|
||||
|
||||
/mob/living/silicon/ai/proc/cmd_show_message_log(mob/user)
|
||||
if(user.stat == 2)
|
||||
return //won't work if dead
|
||||
if(!isnull(aiPDA))
|
||||
var/HTML = "<html><head><title>AI PDA Message Log</title></head><body>[aiPDA.tnote]</body></html>"
|
||||
user << browse(HTML, "window=log;size=400x444;border=1;can_resize=1;can_close=1;can_minimize=0")
|
||||
else
|
||||
user << "You do not have a PDA. You should make an issue report about this."
|
||||
|
||||
//Some spare PDAs in a box
|
||||
/obj/item/weapon/storage/box/PDAs
|
||||
name = "spare PDAs"
|
||||
desc = "A box of spare PDA microcomputers."
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "pda"
|
||||
|
||||
/obj/item/weapon/storage/box/PDAs/New()
|
||||
..()
|
||||
new /obj/item/device/pda(src)
|
||||
new /obj/item/device/pda(src)
|
||||
new /obj/item/device/pda(src)
|
||||
new /obj/item/device/pda(src)
|
||||
new /obj/item/weapon/cartridge/head(src)
|
||||
|
||||
var/newcart = pick( /obj/item/weapon/cartridge/engineering,
|
||||
/obj/item/weapon/cartridge/security,
|
||||
/obj/item/weapon/cartridge/medical,
|
||||
/obj/item/weapon/cartridge/signal/toxins,
|
||||
/obj/item/weapon/cartridge/quartermaster)
|
||||
new newcart(src)
|
||||
|
||||
// Pass along the pulse to atoms in contents, largely added so pAIs are vulnerable to EMP
|
||||
/obj/item/device/pda/emp_act(severity)
|
||||
for(var/atom/A in src)
|
||||
A.emp_act(severity)
|
||||
emped += 1
|
||||
spawn(200 * severity)
|
||||
emped -= 1
|
||||
|
||||
/proc/get_viewable_pdas()
|
||||
. = list()
|
||||
// Returns a list of PDAs which can be viewed from another PDA/message monitor.
|
||||
for(var/obj/item/device/pda/P in PDAs)
|
||||
if(!P.owner || P.toff || P.hidden) continue
|
||||
. += P
|
||||
return .
|
||||
@@ -0,0 +1,200 @@
|
||||
//Clown PDA is slippery.
|
||||
/obj/item/device/pda/clown
|
||||
name = "clown PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/clown
|
||||
icon_state = "pda-clown"
|
||||
desc = "A portable microcomputer by Thinktronic Systems, LTD. The surface is coated with polytetrafluoroethylene and banana drippings."
|
||||
ttone = "honk"
|
||||
|
||||
/obj/item/device/pda/clown/Crossed(AM as mob|obj)
|
||||
if (istype(AM, /mob/living/carbon))
|
||||
var/mob/living/carbon/M = AM
|
||||
if(M.slip(0, 6, src, NO_SLIP_WHEN_WALKING))
|
||||
if (ishuman(M) && (M.real_name != src.owner))
|
||||
if (istype(src.cartridge, /obj/item/weapon/cartridge/clown))
|
||||
var/obj/item/weapon/cartridge/clown/cart = src.cartridge
|
||||
if(cart.honk_charges < 5)
|
||||
cart.honk_charges++
|
||||
|
||||
|
||||
// Special AI/pAI PDAs that cannot explode.
|
||||
/obj/item/device/pda/ai
|
||||
icon_state = "NONE"
|
||||
ttone = "data"
|
||||
fon = 0
|
||||
detonate = 0
|
||||
|
||||
/obj/item/device/pda/ai/attack_self(mob/user)
|
||||
if ((honkamt > 0) && (prob(60)))//For clown virus.
|
||||
honkamt--
|
||||
playsound(loc, 'sound/items/bikehorn.ogg', 30, 1)
|
||||
return
|
||||
|
||||
/obj/item/device/pda/ai/pai
|
||||
ttone = "assist"
|
||||
|
||||
|
||||
|
||||
/obj/item/device/pda/medical
|
||||
name = "medical PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/medical
|
||||
icon_state = "pda-medical"
|
||||
|
||||
/obj/item/device/pda/viro
|
||||
name = "virology PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/medical
|
||||
icon_state = "pda-virology"
|
||||
|
||||
/obj/item/device/pda/engineering
|
||||
name = "engineering PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/engineering
|
||||
icon_state = "pda-engineer"
|
||||
|
||||
/obj/item/device/pda/security
|
||||
name = "security PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/security
|
||||
icon_state = "pda-security"
|
||||
|
||||
/obj/item/device/pda/detective
|
||||
name = "detective PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/detective
|
||||
icon_state = "pda-detective"
|
||||
|
||||
/obj/item/device/pda/warden
|
||||
name = "warden PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/security
|
||||
icon_state = "pda-warden"
|
||||
|
||||
/obj/item/device/pda/janitor
|
||||
name = "janitor PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/janitor
|
||||
icon_state = "pda-janitor"
|
||||
ttone = "slip"
|
||||
|
||||
/obj/item/device/pda/toxins
|
||||
name = "scientist PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/signal/toxins
|
||||
icon_state = "pda-science"
|
||||
ttone = "boom"
|
||||
|
||||
/obj/item/device/pda/mime
|
||||
name = "mime PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/mime
|
||||
icon_state = "pda-mime"
|
||||
silent = 1
|
||||
ttone = "silence"
|
||||
|
||||
/obj/item/device/pda/heads
|
||||
default_cartridge = /obj/item/weapon/cartridge/head
|
||||
icon_state = "pda-hop"
|
||||
|
||||
/obj/item/device/pda/heads/hop
|
||||
name = "head of personnel PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/hop
|
||||
icon_state = "pda-hop"
|
||||
|
||||
/obj/item/device/pda/heads/hos
|
||||
name = "head of security PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/hos
|
||||
icon_state = "pda-hos"
|
||||
|
||||
/obj/item/device/pda/heads/ce
|
||||
name = "chief engineer PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/ce
|
||||
icon_state = "pda-ce"
|
||||
|
||||
/obj/item/device/pda/heads/cmo
|
||||
name = "chief medical officer PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/cmo
|
||||
icon_state = "pda-cmo"
|
||||
|
||||
/obj/item/device/pda/heads/rd
|
||||
name = "research director PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/rd
|
||||
icon_state = "pda-rd"
|
||||
|
||||
/obj/item/device/pda/captain
|
||||
name = "captain PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/captain
|
||||
icon_state = "pda-captain"
|
||||
detonate = 0
|
||||
|
||||
/obj/item/device/pda/cargo
|
||||
name = "cargo technician PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/quartermaster
|
||||
icon_state = "pda-cargo"
|
||||
|
||||
/obj/item/device/pda/quartermaster
|
||||
name = "quartermaster PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/quartermaster
|
||||
icon_state = "pda-qm"
|
||||
|
||||
/obj/item/device/pda/shaftminer
|
||||
name = "shaft miner PDA"
|
||||
icon_state = "pda-miner"
|
||||
|
||||
/obj/item/device/pda/syndicate
|
||||
default_cartridge = /obj/item/weapon/cartridge/syndicate
|
||||
icon_state = "pda-syndi"
|
||||
name = "military PDA"
|
||||
owner = "John Doe"
|
||||
hidden = 1
|
||||
|
||||
/obj/item/device/pda/chaplain
|
||||
name = "chaplain PDA"
|
||||
icon_state = "pda-chaplain"
|
||||
ttone = "holy"
|
||||
|
||||
/obj/item/device/pda/lawyer
|
||||
name = "lawyer PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/lawyer
|
||||
icon_state = "pda-lawyer"
|
||||
ttone = "objection"
|
||||
|
||||
/obj/item/device/pda/botanist
|
||||
name = "botanist PDA"
|
||||
//default_cartridge = /obj/item/weapon/cartridge/botanist
|
||||
icon_state = "pda-hydro"
|
||||
|
||||
/obj/item/device/pda/roboticist
|
||||
name = "roboticist PDA"
|
||||
icon_state = "pda-roboticist"
|
||||
default_cartridge = /obj/item/weapon/cartridge/roboticist
|
||||
|
||||
/obj/item/device/pda/librarian
|
||||
name = "librarian PDA"
|
||||
icon_state = "pda-library"
|
||||
icon_alert = "pda-r-library"
|
||||
default_cartridge = /obj/item/weapon/cartridge/librarian
|
||||
desc = "A portable microcomputer by Thinktronic Systems, LTD. This is model is a WGW-11 series e-reader."
|
||||
note = "Congratulations, your station has chosen the Thinktronic 5290 WGW-11 Series E-reader and Personal Data Assistant!"
|
||||
silent = 1 //Quiet in the library!
|
||||
|
||||
/obj/item/device/pda/clear
|
||||
name = "clear PDA"
|
||||
icon_state = "pda-clear"
|
||||
desc = "A portable microcomputer by Thinktronic Systems, LTD. This is model is a special edition with a transparent case."
|
||||
note = "Congratulations, you have chosen the Thinktronic 5230 Personal Data Assistant Deluxe Special Max Turbo Limited Edition!"
|
||||
|
||||
/obj/item/device/pda/cook
|
||||
name = "cook PDA"
|
||||
icon_state = "pda-cook"
|
||||
|
||||
/obj/item/device/pda/bar
|
||||
name = "bartender PDA"
|
||||
icon_state = "pda-bartender"
|
||||
|
||||
/obj/item/device/pda/atmos
|
||||
name = "atmospherics PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/atmos
|
||||
icon_state = "pda-atmos"
|
||||
|
||||
/obj/item/device/pda/chemist
|
||||
name = "chemist PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/chemistry
|
||||
icon_state = "pda-chemistry"
|
||||
|
||||
/obj/item/device/pda/geneticist
|
||||
name = "geneticist PDA"
|
||||
default_cartridge = /obj/item/weapon/cartridge/medical
|
||||
icon_state = "pda-genetics"
|
||||
@@ -0,0 +1,778 @@
|
||||
/obj/item/weapon/cartridge
|
||||
name = "generic cartridge"
|
||||
desc = "A data cartridge for portable microcomputers."
|
||||
icon = 'icons/obj/pda.dmi'
|
||||
icon_state = "cart"
|
||||
item_state = "electronic"
|
||||
w_class = 1
|
||||
|
||||
var/obj/item/radio/integrated/radio = null
|
||||
var/access_security = 0
|
||||
var/access_engine = 0
|
||||
var/access_atmos = 0
|
||||
var/access_medical = 0
|
||||
var/access_manifest = 0
|
||||
var/access_clown = 0
|
||||
var/access_mime = 0
|
||||
var/access_janitor = 0
|
||||
// var/access_flora = 0
|
||||
var/access_reagent_scanner = 0
|
||||
var/access_newscaster = 0
|
||||
var/access_remote_door = 0 //Control some blast doors remotely!!
|
||||
var/remote_door_id = ""
|
||||
var/access_status_display = 0
|
||||
var/access_quartermaster = 0
|
||||
var/access_hydroponics = 0
|
||||
var/bot_access_flags = 0 //Bit flags. Selection: SEC_BOT|MULE_BOT|FLOOR_BOT|CLEAN_BOT|MED_BOT
|
||||
var/spam_enabled = 0 //Enables "Send to All" Option
|
||||
|
||||
var/mode = null
|
||||
var/menu
|
||||
var/datum/data/record/active1 = null //General
|
||||
var/datum/data/record/active2 = null //Medical
|
||||
var/datum/data/record/active3 = null //Security
|
||||
var/obj/machinery/computer/monitor/powmonitor = null // Power Monitor
|
||||
var/list/powermonitors = list()
|
||||
var/message1 // used for status_displays
|
||||
var/message2
|
||||
var/list/stored_data = list()
|
||||
var/current_channel
|
||||
|
||||
var/mob/living/simple_animal/bot/active_bot
|
||||
var/list/botlist = list()
|
||||
|
||||
/obj/item/weapon/cartridge/engineering
|
||||
name = "\improper Power-ON cartridge"
|
||||
icon_state = "cart-e"
|
||||
access_engine = 1
|
||||
bot_access_flags = FLOOR_BOT
|
||||
|
||||
/obj/item/weapon/cartridge/atmos
|
||||
name = "\improper BreatheDeep cartridge"
|
||||
icon_state = "cart-a"
|
||||
access_atmos = 1
|
||||
bot_access_flags = FLOOR_BOT
|
||||
|
||||
/obj/item/weapon/cartridge/medical
|
||||
name = "\improper Med-U cartridge"
|
||||
icon_state = "cart-m"
|
||||
access_medical = 1
|
||||
bot_access_flags = MED_BOT
|
||||
|
||||
/obj/item/weapon/cartridge/chemistry
|
||||
name = "\improper ChemWhiz cartridge"
|
||||
icon_state = "cart-chem"
|
||||
access_reagent_scanner = 1
|
||||
bot_access_flags = MED_BOT
|
||||
|
||||
/obj/item/weapon/cartridge/security
|
||||
name = "\improper R.O.B.U.S.T. cartridge"
|
||||
icon_state = "cart-s"
|
||||
access_security = 1
|
||||
bot_access_flags = SEC_BOT
|
||||
|
||||
/obj/item/weapon/cartridge/detective
|
||||
name = "\improper D.E.T.E.C.T. cartridge"
|
||||
icon_state = "cart-s"
|
||||
access_security = 1
|
||||
access_medical = 1
|
||||
access_manifest = 1
|
||||
bot_access_flags = SEC_BOT
|
||||
|
||||
/obj/item/weapon/cartridge/janitor
|
||||
name = "\improper CustodiPRO cartridge"
|
||||
desc = "The ultimate in clean-room design."
|
||||
icon_state = "cart-j"
|
||||
access_janitor = 1
|
||||
bot_access_flags = CLEAN_BOT
|
||||
|
||||
/obj/item/weapon/cartridge/lawyer
|
||||
name = "\improper P.R.O.V.E. cartridge"
|
||||
icon_state = "cart-s"
|
||||
access_security = 1
|
||||
spam_enabled = 1
|
||||
|
||||
/obj/item/weapon/cartridge/clown
|
||||
name = "\improper Honkworks 5.0 cartridge"
|
||||
icon_state = "cart-clown"
|
||||
access_clown = 1
|
||||
var/honk_charges = 5
|
||||
|
||||
/obj/item/weapon/cartridge/mime
|
||||
name = "\improper Gestur-O 1000 cartridge"
|
||||
icon_state = "cart-mi"
|
||||
access_mime = 1
|
||||
var/mime_charges = 5
|
||||
|
||||
/obj/item/weapon/cartridge/librarian
|
||||
name = "\improper Lib-Tweet cartridge"
|
||||
icon_state = "cart-s"
|
||||
access_newscaster = 1
|
||||
|
||||
/*
|
||||
/obj/item/weapon/cartridge/botanist
|
||||
name = "\improper Green Thumb v4.20 cartridge"
|
||||
icon_state = "cart-b"
|
||||
access_flora = 1
|
||||
*/
|
||||
|
||||
/obj/item/weapon/cartridge/roboticist
|
||||
name = "\improper B.O.O.P. Remote Control cartridge"
|
||||
desc = "Packed with heavy duty triple-bot interlink!"
|
||||
bot_access_flags = FLOOR_BOT|CLEAN_BOT|MED_BOT
|
||||
|
||||
/obj/item/weapon/cartridge/signal
|
||||
name = "generic signaler cartridge"
|
||||
desc = "A data cartridge with an integrated radio signaler module."
|
||||
|
||||
/obj/item/weapon/cartridge/signal/toxins
|
||||
name = "\improper Signal Ace 2 cartridge"
|
||||
desc = "Complete with integrated radio signaler!"
|
||||
icon_state = "cart-tox"
|
||||
access_reagent_scanner = 1
|
||||
access_atmos = 1
|
||||
|
||||
/obj/item/weapon/cartridge/signal/New()
|
||||
..()
|
||||
radio = new /obj/item/radio/integrated/signal(src)
|
||||
|
||||
|
||||
|
||||
/obj/item/weapon/cartridge/quartermaster
|
||||
name = "space parts & space vendors cartridge"
|
||||
desc = "Perfect for the Quartermaster on the go!"
|
||||
icon_state = "cart-q"
|
||||
access_quartermaster = 1
|
||||
bot_access_flags = MULE_BOT
|
||||
|
||||
/obj/item/weapon/cartridge/head
|
||||
name = "\improper Easy-Record DELUXE cartridge"
|
||||
icon_state = "cart-h"
|
||||
access_manifest = 1
|
||||
access_status_display = 1
|
||||
|
||||
/obj/item/weapon/cartridge/hop
|
||||
name = "\improper HumanResources9001 cartridge"
|
||||
icon_state = "cart-h"
|
||||
access_manifest = 1
|
||||
access_status_display = 1
|
||||
bot_access_flags = MULE_BOT|CLEAN_BOT
|
||||
access_janitor = 1
|
||||
access_security = 1
|
||||
access_newscaster = 1
|
||||
access_quartermaster = 1
|
||||
|
||||
/obj/item/weapon/cartridge/hos
|
||||
name = "\improper R.O.B.U.S.T. DELUXE cartridge"
|
||||
icon_state = "cart-hos"
|
||||
access_manifest = 1
|
||||
access_status_display = 1
|
||||
access_security = 1
|
||||
bot_access_flags = SEC_BOT
|
||||
|
||||
|
||||
/obj/item/weapon/cartridge/ce
|
||||
name = "\improper Power-On DELUXE cartridge"
|
||||
icon_state = "cart-ce"
|
||||
access_manifest = 1
|
||||
access_status_display = 1
|
||||
access_engine = 1
|
||||
access_atmos = 1
|
||||
bot_access_flags = FLOOR_BOT
|
||||
|
||||
/obj/item/weapon/cartridge/cmo
|
||||
name = "\improper Med-U DELUXE cartridge"
|
||||
icon_state = "cart-cmo"
|
||||
access_manifest = 1
|
||||
access_status_display = 1
|
||||
access_reagent_scanner = 1
|
||||
access_medical = 1
|
||||
bot_access_flags = MED_BOT
|
||||
|
||||
/obj/item/weapon/cartridge/rd
|
||||
name = "\improper Signal Ace DELUXE cartridge"
|
||||
icon_state = "cart-rd"
|
||||
access_manifest = 1
|
||||
access_status_display = 1
|
||||
access_reagent_scanner = 1
|
||||
access_atmos = 1
|
||||
bot_access_flags = FLOOR_BOT|CLEAN_BOT|MED_BOT
|
||||
|
||||
/obj/item/weapon/cartridge/rd/New()
|
||||
..()
|
||||
radio = new /obj/item/radio/integrated/signal(src)
|
||||
|
||||
/obj/item/weapon/cartridge/captain
|
||||
name = "\improper Value-PAK cartridge"
|
||||
desc = "Now with 350% more value!" //Give the Captain...EVERYTHING! (Except Mime and Clown)
|
||||
icon_state = "cart-c"
|
||||
access_manifest = 1
|
||||
access_engine = 1
|
||||
access_security = 1
|
||||
access_medical = 1
|
||||
access_reagent_scanner = 1
|
||||
access_status_display = 1
|
||||
access_atmos = 1
|
||||
access_newscaster = 1
|
||||
access_quartermaster = 1
|
||||
access_janitor = 1
|
||||
bot_access_flags = SEC_BOT|MULE_BOT|FLOOR_BOT|CLEAN_BOT|MED_BOT
|
||||
spam_enabled = 1
|
||||
|
||||
/obj/item/weapon/cartridge/captain/New()
|
||||
..()
|
||||
radio = new /obj/item/radio/integrated/signal(src)
|
||||
|
||||
/obj/item/weapon/cartridge/syndicate
|
||||
name = "\improper Detomatix cartridge"
|
||||
icon_state = "cart"
|
||||
access_remote_door = 1
|
||||
remote_door_id = "smindicate" //Make sure this matches the syndicate shuttle's shield/door id!! //don't ask about the name, testing.
|
||||
var/shock_charges = 4
|
||||
|
||||
/obj/item/weapon/cartridge/proc/unlock()
|
||||
if (!istype(loc, /obj/item/device/pda))
|
||||
return
|
||||
|
||||
generate_menu()
|
||||
print_to_host(menu)
|
||||
return
|
||||
|
||||
/obj/item/weapon/cartridge/proc/print_to_host(text)
|
||||
if (!istype(loc, /obj/item/device/pda))
|
||||
return
|
||||
var/obj/item/device/pda/P = loc
|
||||
P.cart = text
|
||||
|
||||
for (var/mob/M in viewers(1, loc.loc))
|
||||
if (M.client && M.machine == loc)
|
||||
P.attack_self(M)
|
||||
|
||||
return
|
||||
|
||||
/obj/item/weapon/cartridge/proc/post_status(command, data1, data2)
|
||||
|
||||
var/datum/radio_frequency/frequency = SSradio.return_frequency(1435)
|
||||
|
||||
if(!frequency) return
|
||||
|
||||
var/datum/signal/status_signal = new
|
||||
status_signal.source = src
|
||||
status_signal.transmission_method = 1
|
||||
status_signal.data["command"] = command
|
||||
|
||||
switch(command)
|
||||
if("message")
|
||||
status_signal.data["msg1"] = data1
|
||||
status_signal.data["msg2"] = data2
|
||||
if("alert")
|
||||
status_signal.data["picture_state"] = data1
|
||||
|
||||
frequency.post_signal(src, status_signal)
|
||||
|
||||
|
||||
/obj/item/weapon/cartridge/proc/generate_menu(mob/user)
|
||||
switch(mode)
|
||||
if(40) //signaller
|
||||
var/obj/item/radio/integrated/signal/S = radio
|
||||
menu = "<h4><img src=pda_signaler.png> Remote Signaling System</h4>"
|
||||
|
||||
menu += {"
|
||||
<a href='byond://?src=\ref[src];choice=Send Signal'>Send Signal</A><BR>
|
||||
Frequency:
|
||||
<a href='byond://?src=\ref[src];choice=Signal Frequency;sfreq=-10'>-</a>
|
||||
<a href='byond://?src=\ref[src];choice=Signal Frequency;sfreq=-2'>-</a>
|
||||
[format_frequency(S.frequency)]
|
||||
<a href='byond://?src=\ref[src];choice=Signal Frequency;sfreq=2'>+</a>
|
||||
<a href='byond://?src=\ref[src];choice=Signal Frequency;sfreq=10'>+</a><br>
|
||||
<br>
|
||||
Code:
|
||||
<a href='byond://?src=\ref[src];choice=Signal Code;scode=-5'>-</a>
|
||||
<a href='byond://?src=\ref[src];choice=Signal Code;scode=-1'>-</a>
|
||||
[S.code]
|
||||
<a href='byond://?src=\ref[src];choice=Signal Code;scode=1'>+</a>
|
||||
<a href='byond://?src=\ref[src];choice=Signal Code;scode=5'>+</a><br>"}
|
||||
if (41) //crew manifest
|
||||
|
||||
menu = "<h4><img src=pda_notes.png> Crew Manifest</h4>"
|
||||
menu += "Entries cannot be modified from this terminal.<br><br>"
|
||||
if(data_core.general)
|
||||
for (var/datum/data/record/t in sortRecord(data_core.general))
|
||||
menu += "[t.fields["name"]] - [t.fields["rank"]]<br>"
|
||||
menu += "<br>"
|
||||
|
||||
|
||||
if (42) //status displays
|
||||
menu = "<h4><img src=pda_status.png> Station Status Display Interlink</h4>"
|
||||
|
||||
menu += "\[ <A HREF='?src=\ref[src];choice=Status;statdisp=blank'>Clear</A> \]<BR>"
|
||||
menu += "\[ <A HREF='?src=\ref[src];choice=Status;statdisp=shuttle'>Shuttle ETA</A> \]<BR>"
|
||||
menu += "\[ <A HREF='?src=\ref[src];choice=Status;statdisp=message'>Message</A> \]"
|
||||
menu += "<ul><li> Line 1: <A HREF='?src=\ref[src];choice=Status;statdisp=setmsg1'>[ message1 ? message1 : "(none)"]</A>"
|
||||
menu += "<li> Line 2: <A HREF='?src=\ref[src];choice=Status;statdisp=setmsg2'>[ message2 ? message2 : "(none)"]</A></ul><br>"
|
||||
menu += "\[ Alert: <A HREF='?src=\ref[src];choice=Status;statdisp=alert;alert=default'>None</A> |"
|
||||
menu += " <A HREF='?src=\ref[src];choice=Status;statdisp=alert;alert=redalert'>Red Alert</A> |"
|
||||
menu += " <A HREF='?src=\ref[src];choice=Status;statdisp=alert;alert=lockdown'>Lockdown</A> |"
|
||||
menu += " <A HREF='?src=\ref[src];choice=Status;statdisp=alert;alert=biohazard'>Biohazard</A> \]<BR>"
|
||||
|
||||
if (43)
|
||||
menu = "<h4><img src=pda_power.png> Power Monitors - Please select one</h4><BR>"
|
||||
powmonitor = null
|
||||
powermonitors = list()
|
||||
var/powercount = 0
|
||||
|
||||
|
||||
|
||||
for(var/obj/machinery/computer/monitor/pMon in machines)
|
||||
if(!(pMon.stat & (NOPOWER|BROKEN)) )
|
||||
powercount++
|
||||
powermonitors += pMon
|
||||
|
||||
|
||||
if(!powercount)
|
||||
menu += "<span class='danger'>No connection<BR></span>"
|
||||
else
|
||||
|
||||
menu += "<FONT SIZE=-1>"
|
||||
var/count = 0
|
||||
for(var/obj/machinery/computer/monitor/pMon in powermonitors)
|
||||
count++
|
||||
menu += "<a href='byond://?src=\ref[src];choice=Power Select;target=[count]'>[pMon] </a><BR>"
|
||||
|
||||
menu += "</FONT>"
|
||||
|
||||
if (433)
|
||||
menu = "<h4><img src=pda_power.png> Power Monitor </h4><BR>"
|
||||
if(!powmonitor)
|
||||
menu += "<span class='danger'>No connection<BR></span>"
|
||||
else
|
||||
var/list/L = list()
|
||||
for(var/obj/machinery/power/terminal/term in powmonitor.attached.powernet.nodes)
|
||||
if(istype(term.master, /obj/machinery/power/apc))
|
||||
var/obj/machinery/power/apc/A = term.master
|
||||
L += A
|
||||
|
||||
menu += "<PRE>Total power: [powmonitor.attached.powernet.viewavail] W<BR>Total load: [num2text(powmonitor.attached.powernet.viewload,10)] W<BR>"
|
||||
|
||||
menu += "<FONT SIZE=-1>"
|
||||
|
||||
if(L.len > 0)
|
||||
menu += "Area Eqp./Lgt./Env. Load Cell<HR>"
|
||||
|
||||
var/list/S = list(" Off","AOff"," On", " AOn")
|
||||
var/list/chg = list("N","C","F")
|
||||
|
||||
for(var/obj/machinery/power/apc/A in L)
|
||||
menu += copytext(add_tspace(A.area.name, 30), 1, 30)
|
||||
menu += " [S[A.equipment+1]] [S[A.lighting+1]] [S[A.environ+1]] [add_lspace(A.lastused_total, 6)] [A.cell ? "[add_lspace(round(A.cell.percent()), 3)]% [chg[A.charging+1]]" : " N/C"]<BR>"
|
||||
|
||||
menu += "</FONT></PRE>"
|
||||
|
||||
if (44) //medical records //This thing only displays a single screen so it's hard to really get the sub-menu stuff working.
|
||||
menu = "<h4><img src=pda_medical.png> Medical Record List</h4>"
|
||||
if(data_core.general)
|
||||
for(var/datum/data/record/R in sortRecord(data_core.general))
|
||||
menu += "<a href='byond://?src=\ref[src];choice=Medical Records;target=[R.fields["id"]]'>[R.fields["id"]]: [R.fields["name"]]<br>"
|
||||
menu += "<br>"
|
||||
if(441)
|
||||
menu = "<h4><img src=pda_medical.png> Medical Record</h4>"
|
||||
|
||||
if(active1 in data_core.general)
|
||||
menu += "Name: [active1.fields["name"]] ID: [active1.fields["id"]]<br>"
|
||||
menu += "Sex: [active1.fields["sex"]]<br>"
|
||||
menu += "Age: [active1.fields["age"]]<br>"
|
||||
menu += "Rank: [active1.fields["rank"]]<br>"
|
||||
menu += "Fingerprint: [active1.fields["fingerprint"]]<br>"
|
||||
menu += "Physical Status: [active1.fields["p_stat"]]<br>"
|
||||
menu += "Mental Status: [active1.fields["m_stat"]]<br>"
|
||||
else
|
||||
menu += "<b>Record Lost!</b><br>"
|
||||
|
||||
menu += "<br>"
|
||||
|
||||
menu += "<h4><img src=pda_medical.png> Medical Data</h4>"
|
||||
if(active2 in data_core.medical)
|
||||
menu += "Blood Type: [active2.fields["blood_type"]]<br><br>"
|
||||
|
||||
menu += "Minor Disabilities: [active2.fields["mi_dis"]]<br>"
|
||||
menu += "Details: [active2.fields["mi_dis_d"]]<br><br>"
|
||||
|
||||
menu += "Major Disabilities: [active2.fields["ma_dis"]]<br>"
|
||||
menu += "Details: [active2.fields["ma_dis_d"]]<br><br>"
|
||||
|
||||
menu += "Allergies: [active2.fields["alg"]]<br>"
|
||||
menu += "Details: [active2.fields["alg_d"]]<br><br>"
|
||||
|
||||
menu += "Current Diseases: [active2.fields["cdi"]]<br>"
|
||||
menu += "Details: [active2.fields["cdi_d"]]<br><br>"
|
||||
|
||||
menu += "Important Notes: [active2.fields["notes"]]<br>"
|
||||
else
|
||||
menu += "<b>Record Lost!</b><br>"
|
||||
|
||||
menu += "<br>"
|
||||
if (45) //security records
|
||||
menu = "<h4><img src=pda_cuffs.png> Security Record List</h4>"
|
||||
if(data_core.general)
|
||||
for (var/datum/data/record/R in sortRecord(data_core.general))
|
||||
menu += "<a href='byond://?src=\ref[src];choice=Security Records;target=[R.fields["id"]]'>[R.fields["id"]]: [R.fields["name"]]<br>"
|
||||
|
||||
menu += "<br>"
|
||||
if(451)
|
||||
menu = "<h4><img src=pda_cuffs.png> Security Record</h4>"
|
||||
|
||||
if(active1 in data_core.general)
|
||||
menu += "Name: [active1.fields["name"]] ID: [active1.fields["id"]]<br>"
|
||||
menu += "Sex: [active1.fields["sex"]]<br>"
|
||||
menu += "Age: [active1.fields["age"]]<br>"
|
||||
menu += "Rank: [active1.fields["rank"]]<br>"
|
||||
menu += "Fingerprint: [active1.fields["fingerprint"]]<br>"
|
||||
menu += "Physical Status: [active1.fields["p_stat"]]<br>"
|
||||
menu += "Mental Status: [active1.fields["m_stat"]]<br>"
|
||||
else
|
||||
menu += "<b>Record Lost!</b><br>"
|
||||
|
||||
menu += "<br>"
|
||||
|
||||
menu += "<h4><img src=pda_cuffs.png> Security Data</h4>"
|
||||
if(active3 in data_core.security)
|
||||
menu += "Criminal Status: [active3.fields["criminal"]]<br>"
|
||||
|
||||
menu += text("<BR>\nMinor Crimes:")
|
||||
|
||||
menu +={"<table style="text-align:center;" border="1" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<th>Crime</th>
|
||||
<th>Details</th>
|
||||
<th>Author</th>
|
||||
<th>Time Added</th>
|
||||
</tr>"}
|
||||
for(var/datum/data/crime/c in active3.fields["mi_crim"])
|
||||
menu += "<tr><td>[c.crimeName]</td>"
|
||||
menu += "<td>[c.crimeDetails]</td>"
|
||||
menu += "<td>[c.author]</td>"
|
||||
menu += "<td>[c.time]</td>"
|
||||
menu += "</tr>"
|
||||
menu += "</table>"
|
||||
|
||||
menu += text("<BR>\nMajor Crimes:")
|
||||
|
||||
menu +={"<table style="text-align:center;" border="1" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<th>Crime</th>
|
||||
<th>Details</th>
|
||||
<th>Author</th>
|
||||
<th>Time Added</th>
|
||||
</tr>"}
|
||||
for(var/datum/data/crime/c in active3.fields["ma_crim"])
|
||||
menu += "<tr><td>[c.crimeName]</td>"
|
||||
menu += "<td>[c.crimeDetails]</td>"
|
||||
menu += "<td>[c.author]</td>"
|
||||
menu += "<td>[c.time]</td>"
|
||||
menu += "</tr>"
|
||||
menu += "</table>"
|
||||
|
||||
menu += "<BR>\nImportant Notes:<br>"
|
||||
menu += "[active3.fields["notes"]]"
|
||||
else
|
||||
menu += "<b>Record Lost!</b><br>"
|
||||
|
||||
menu += "<br>"
|
||||
|
||||
if (47) //quartermaster order records
|
||||
menu = "<h4><img src=pda_crate.png> Supply Record Interlink</h4>"
|
||||
|
||||
menu += "<BR><B>Supply shuttle</B><BR>"
|
||||
menu += "Location: "
|
||||
switch(SSshuttle.supply.mode)
|
||||
if(SHUTTLE_CALL)
|
||||
menu += "Moving to "
|
||||
if(SSshuttle.supply.z != ZLEVEL_STATION)
|
||||
menu += "station"
|
||||
else
|
||||
menu += "centcomm"
|
||||
menu += " ([SSshuttle.supply.timeLeft(600)] Mins)"
|
||||
else
|
||||
menu += "At "
|
||||
if(SSshuttle.supply.z != ZLEVEL_STATION)
|
||||
menu += "centcomm"
|
||||
else
|
||||
menu += "station"
|
||||
menu += "<BR>Current approved orders: <BR><ol>"
|
||||
for(var/S in SSshuttle.shoppinglist)
|
||||
var/datum/supply_order/SO = S
|
||||
menu += "<li>#[SO.id] - [SO.pack.name] approved by [SO.orderer] [SO.reason ? "([SO.reason])":""]</li>"
|
||||
menu += "</ol>"
|
||||
|
||||
menu += "Current requests: <BR><ol>"
|
||||
for(var/S in SSshuttle.requestlist)
|
||||
var/datum/supply_order/SO = S
|
||||
menu += "<li>#[SO.id] - [SO.pack.name] requested by [SO.orderer]</li>"
|
||||
menu += "</ol><font size=\"-3\">Upgrade NOW to Space Parts & Space Vendors PLUS for full remote order control and inventory management."
|
||||
|
||||
if (49) //janitorial locator
|
||||
menu = "<h4><img src=pda_bucket.png> Persistent Custodial Object Locator</h4>"
|
||||
|
||||
var/turf/cl = get_turf(src)
|
||||
if (cl)
|
||||
menu += "Current Orbital Location: <b>\[[cl.x],[cl.y]\]</b>"
|
||||
|
||||
menu += "<h4>Located Mops:</h4>"
|
||||
|
||||
var/ldat
|
||||
for (var/obj/item/weapon/mop/M in world)
|
||||
var/turf/ml = get_turf(M)
|
||||
|
||||
if(ml)
|
||||
if (ml.z != cl.z)
|
||||
continue
|
||||
var/direction = get_dir(src, M)
|
||||
ldat += "Mop - <b>\[[ml.x],[ml.y] ([uppertext(dir2text(direction))])\]</b> - [M.reagents.total_volume ? "Wet" : "Dry"]<br>"
|
||||
|
||||
if (!ldat)
|
||||
menu += "None"
|
||||
else
|
||||
menu += "[ldat]"
|
||||
|
||||
menu += "<h4>Located Janitorial Cart:</h4>"
|
||||
|
||||
ldat = null
|
||||
for (var/obj/structure/janitorialcart/B in world)
|
||||
var/turf/bl = get_turf(B)
|
||||
|
||||
if(bl)
|
||||
if (bl.z != cl.z)
|
||||
continue
|
||||
var/direction = get_dir(src, B)
|
||||
ldat += "Cart - <b>\[[bl.x],[bl.y] ([uppertext(dir2text(direction))])\]</b> - Water level: [B.reagents.total_volume]/100<br>"
|
||||
|
||||
if (!ldat)
|
||||
menu += "None"
|
||||
else
|
||||
menu += "[ldat]"
|
||||
|
||||
menu += "<h4>Located Cleanbots:</h4>"
|
||||
|
||||
ldat = null
|
||||
for (var/mob/living/simple_animal/bot/cleanbot/B in living_mob_list)
|
||||
var/turf/bl = get_turf(B)
|
||||
|
||||
if(bl)
|
||||
if (bl.z != cl.z)
|
||||
continue
|
||||
var/direction = get_dir(src, B)
|
||||
ldat += "Cleanbot - <b>\[[bl.x],[bl.y] ([uppertext(dir2text(direction))])\]</b> - [B.on ? "Online" : "Offline"]<br>"
|
||||
|
||||
if (!ldat)
|
||||
menu += "None"
|
||||
else
|
||||
menu += "[ldat]"
|
||||
|
||||
else
|
||||
menu += "ERROR: Unable to determine current location."
|
||||
menu += "<br><br><A href='byond://?src=\ref[src];choice=49'>Refresh GPS Locator</a>"
|
||||
|
||||
if (53) // Newscaster
|
||||
menu = "<h4><img src=pda_notes.png> Newscaster Access</h4>"
|
||||
menu += "<br> Current Newsfeed: <A href='byond://?src=\ref[src];choice=Newscaster Switch Channel'>[current_channel ? current_channel : "None"]</a> <br>"
|
||||
var/datum/newscaster/feed_channel/current
|
||||
for(var/datum/newscaster/feed_channel/chan in news_network.network_channels)
|
||||
if (chan.channel_name == current_channel)
|
||||
current = chan
|
||||
if(!current)
|
||||
menu += "<h5> ERROR : NO CHANNEL FOUND </h5>"
|
||||
return
|
||||
var/i = 1
|
||||
for(var/datum/newscaster/feed_message/msg in current.messages)
|
||||
menu +="-[msg.returnBody(-1)] <BR><FONT SIZE=1>\[Story by <FONT COLOR='maroon'>[msg.returnAuthor(-1)]</FONT>\]</FONT><BR>"
|
||||
menu +="<b><font size=1>[msg.comments.len] comment[msg.comments.len > 1 ? "s" : ""]</font></b><br>"
|
||||
if(msg.img)
|
||||
user << browse_rsc(msg.img, "tmp_photo[i].png")
|
||||
menu +="<img src='tmp_photo[i].png' width = '180'><BR>"
|
||||
i++
|
||||
for(var/datum/newscaster/feed_comment/comment in msg.comments)
|
||||
menu +="<font size=1><small>[comment.body]</font><br><font size=1><small><small><small>[comment.author] [comment.time_stamp]</small></small></small></small></font><br>"
|
||||
menu += "<br> <A href='byond://?src=\ref[src];choice=Newscaster Message'>Post Message</a>"
|
||||
|
||||
if (54) // Beepsky, Medibot, Floorbot, and Cleanbot access
|
||||
menu = "<h4><img src=pda_medbot.png> Bots Interlink</h4>"
|
||||
bot_control()
|
||||
|
||||
/obj/item/weapon/cartridge/Topic(href, href_list)
|
||||
..()
|
||||
|
||||
if (!usr.canmove || usr.stat || usr.restrained() || !in_range(loc, usr))
|
||||
usr.unset_machine()
|
||||
usr << browse(null, "window=pda")
|
||||
return
|
||||
|
||||
var/obj/item/device/pda/pda = loc
|
||||
|
||||
switch(href_list["choice"])
|
||||
if("Medical Records")
|
||||
active1 = find_record("id", href_list["target"], data_core.general)
|
||||
if(active1)
|
||||
active2 = find_record("id", href_list["target"], data_core.medical)
|
||||
pda.mode = 441
|
||||
mode = 441
|
||||
if(!active2)
|
||||
active1 = null
|
||||
|
||||
if("Security Records")
|
||||
active1 = find_record("id", href_list["target"], data_core.general)
|
||||
if(active1)
|
||||
active3 = find_record("id", href_list["target"], data_core.security)
|
||||
pda.mode = 451
|
||||
mode = 451
|
||||
if(!active3)
|
||||
active1 = null
|
||||
|
||||
if("Send Signal")
|
||||
spawn( 0 )
|
||||
var/obj/item/radio/integrated/signal/S = radio
|
||||
S.send_signal("ACTIVATE")
|
||||
return
|
||||
|
||||
if("Signal Frequency")
|
||||
var/obj/item/radio/integrated/signal/S = radio
|
||||
var/new_frequency = sanitize_frequency(S.frequency + text2num(href_list["sfreq"]))
|
||||
S.set_frequency(new_frequency)
|
||||
|
||||
if("Signal Code")
|
||||
var/obj/item/radio/integrated/signal/S = radio
|
||||
S.code += text2num(href_list["scode"])
|
||||
S.code = round(S.code)
|
||||
S.code = min(100, S.code)
|
||||
S.code = max(1, S.code)
|
||||
|
||||
if("Status")
|
||||
switch(href_list["statdisp"])
|
||||
if("message")
|
||||
post_status("message", message1, message2)
|
||||
if("alert")
|
||||
post_status("alert", href_list["alert"])
|
||||
if("setmsg1")
|
||||
message1 = reject_bad_text(input("Line 1", "Enter Message Text", message1) as text|null, 40)
|
||||
updateSelfDialog()
|
||||
if("setmsg2")
|
||||
message2 = reject_bad_text(input("Line 2", "Enter Message Text", message2) as text|null, 40)
|
||||
updateSelfDialog()
|
||||
else
|
||||
post_status(href_list["statdisp"])
|
||||
if("Power Select")
|
||||
var/pnum = text2num(href_list["target"])
|
||||
powmonitor = powermonitors[pnum]
|
||||
pda.mode = 433
|
||||
mode = 433
|
||||
|
||||
if("Supply Orders")
|
||||
pda.mode =47
|
||||
mode = 47
|
||||
|
||||
if("Newscaster Access")
|
||||
mode = 53
|
||||
|
||||
if("Newscaster Message")
|
||||
var/pda_owner_name = pda.id ? "[pda.id.registered_name] ([pda.id.assignment])" : "Unknown"
|
||||
var/message = pda.msg_input()
|
||||
var/datum/newscaster/feed_channel/current
|
||||
for(var/datum/newscaster/feed_channel/chan in news_network.network_channels)
|
||||
if (chan.channel_name == current_channel)
|
||||
current = chan
|
||||
if(current.locked && current.author != pda_owner_name)
|
||||
pda.cart += "<h5> ERROR : NOT AUTHORIZED [pda.id ? "" : "- ID SLOT EMPTY"] </h5>"
|
||||
pda.Topic(null,list("choice"="Refresh"))
|
||||
return
|
||||
news_network.SubmitArticle(message,pda.owner,current_channel)
|
||||
pda.Topic(null,list("choice"=num2text(mode)))
|
||||
return
|
||||
|
||||
if("Newscaster Switch Channel")
|
||||
current_channel = pda.msg_input()
|
||||
pda.Topic(null,list("choice"=num2text(mode)))
|
||||
return
|
||||
|
||||
//Bot control section! Viciously ripped from radios for being laggy and terrible.
|
||||
if(href_list["op"])
|
||||
switch(href_list["op"])
|
||||
|
||||
if("control")
|
||||
active_bot = locate(href_list["bot"])
|
||||
|
||||
if("botlist")
|
||||
active_bot = null
|
||||
if("summon") //Args are in the correct order, they are stated here just as an easy reminder.
|
||||
active_bot.bot_control(command= "summon", user_turf= get_turf(usr), user_access= pda.GetAccess())
|
||||
else //Forward all other bot commands to the bot itself!
|
||||
active_bot.bot_control(command= href_list["op"], user= usr)
|
||||
|
||||
if(href_list["mule"]) //MULEbots are special snowflakes, and need different args due to how they work.
|
||||
|
||||
active_bot.bot_control(command= href_list["mule"], user= usr, pda= 1)
|
||||
|
||||
generate_menu(usr)
|
||||
print_to_host(menu)
|
||||
|
||||
|
||||
|
||||
/obj/item/weapon/cartridge/proc/bot_control()
|
||||
|
||||
|
||||
var/mob/living/simple_animal/bot/Bot
|
||||
|
||||
// if(!SC)
|
||||
// menu = "Interlink Error - Please reinsert cartridge."
|
||||
// return
|
||||
if(active_bot)
|
||||
menu += "<B>[active_bot]</B><BR> Status: (<A href='byond://?src=\ref[src];op=control;bot=\ref[active_bot]'><img src=pda_refresh.png><i>refresh</i></A>)<BR>"
|
||||
menu += "Model: [active_bot.model]<BR>"
|
||||
menu += "Location: [get_area(active_bot)]<BR>"
|
||||
menu += "Mode: [active_bot.get_mode()]"
|
||||
if(active_bot.allow_pai)
|
||||
menu += "<BR>pAI: "
|
||||
if(active_bot.paicard && active_bot.paicard.pai)
|
||||
menu += "[active_bot.paicard.pai.name]"
|
||||
if(active_bot.bot_core.allowed(usr))
|
||||
menu += " (<A href='byond://?src=\ref[src];op=ejectpai'><i>eject</i></A>)"
|
||||
else
|
||||
menu += "<i>none</i>"
|
||||
|
||||
//MULEs!
|
||||
if(active_bot.bot_type == MULE_BOT)
|
||||
var/mob/living/simple_animal/bot/mulebot/MULE = active_bot
|
||||
var/atom/Load = MULE.load
|
||||
menu += "<BR>Current Load: [ !Load ? "<i>none</i>" : "[Load.name] (<A href='byond://?src=\ref[src];mule=unload'><i>unload</i></A>)" ]<BR>"
|
||||
menu += "Destination: [MULE.destination ? MULE.destination : "<i>None</i>"] (<A href='byond://?src=\ref[src];mule=destination'><i>set</i></A>)<BR>"
|
||||
menu += "Set ID: [MULE.suffix] <A href='byond://?src=\ref[src];mule=setid'><i> Modify</i></A><BR>"
|
||||
menu += "Power: [MULE.cell ? MULE.cell.percent() : 0]%<BR>"
|
||||
menu += "Home: [!MULE.home_destination ? "<i>none</i>" : MULE.home_destination ]<BR>"
|
||||
menu += "Delivery Reporting: <A href='byond://?src=\ref[src];mule=report'>[MULE.report_delivery ? "(<B>On</B>)": "(<B>Off</B>)"]</A><BR>"
|
||||
menu += "Auto Return Home: <A href='byond://?src=\ref[src];mule=autoret'>[MULE.auto_return ? "(<B>On</B>)": "(<B>Off</B>)"]</A><BR>"
|
||||
menu += "Auto Pickup Crate: <A href='byond://?src=\ref[src];mule=autopick'>[MULE.auto_pickup ? "(<B>On</B>)": "(<B>Off</B>)"]</A><BR><BR>" //Hue.
|
||||
|
||||
menu += "\[<A href='byond://?src=\ref[src];mule=stop'>Stop</A>\] "
|
||||
menu += "\[<A href='byond://?src=\ref[src];mule=go'>Proceed</A>\] "
|
||||
menu += "\[<A href='byond://?src=\ref[src];mule=home'>Return Home</A>\]<BR>"
|
||||
|
||||
else
|
||||
menu += "<BR>\[<A href='byond://?src=\ref[src];op=patroloff'>Stop Patrol</A>\] " //patrolon
|
||||
menu += "\[<A href='byond://?src=\ref[src];op=patrolon'>Start Patrol</A>\] " //patroloff
|
||||
menu += "\[<A href='byond://?src=\ref[src];op=summon'>Summon Bot</A>\]<BR>" //summon
|
||||
menu += "Keep an ID inserted to upload access codes upon summoning."
|
||||
|
||||
menu += "<HR><A href='byond://?src=\ref[src];op=botlist'><img src=pda_back.png>Return to bot list</A>"
|
||||
else
|
||||
menu += "<BR><A href='byond://?src=\ref[src];op=botlist'><img src=pda_refresh.png>Scan for active bots</A><BR><BR>"
|
||||
var/turf/current_turf = get_turf(src)
|
||||
var/zlevel = current_turf.z
|
||||
var/botcount = 0
|
||||
for(Bot in living_mob_list) //Git da botz
|
||||
if(!Bot.on || Bot.z != zlevel || Bot.remote_disabled || !(bot_access_flags & Bot.bot_type)) //Only non-emagged bots on the same Z-level are detected!
|
||||
continue //Also, the PDA must have access to the bot type.
|
||||
menu += "<A href='byond://?src=\ref[src];op=control;bot=\ref[Bot]'><b>[Bot.name]</b> ([Bot.get_mode()])<BR>"
|
||||
botcount++
|
||||
if(!botcount) //No bots at all? Lame.
|
||||
menu += "No bots found.<BR>"
|
||||
return
|
||||
|
||||
return menu
|
||||
@@ -0,0 +1,70 @@
|
||||
/obj/item/radio/integrated
|
||||
name = "\improper PDA radio module"
|
||||
desc = "An electronic radio system of nanotrasen origin."
|
||||
icon = 'icons/obj/module.dmi'
|
||||
icon_state = "power_mod"
|
||||
var/obj/item/device/pda/hostpda = null
|
||||
|
||||
var/on = 0 //Are we currently active??
|
||||
var/menu_message = ""
|
||||
|
||||
/obj/item/radio/integrated/New()
|
||||
..()
|
||||
if (istype(loc.loc, /obj/item/device/pda))
|
||||
hostpda = loc.loc
|
||||
|
||||
/obj/item/radio/integrated/Destroy()
|
||||
hostpda = null
|
||||
return ..()
|
||||
|
||||
/*
|
||||
* Radio Cartridge, essentially a signaler.
|
||||
*/
|
||||
|
||||
|
||||
/obj/item/radio/integrated/signal
|
||||
var/frequency = 1457
|
||||
var/code = 30
|
||||
var/last_transmission
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/obj/item/radio/integrated/signal/New()
|
||||
..()
|
||||
if(SSradio)
|
||||
initialize()
|
||||
|
||||
/obj/item/radio/integrated/signal/Destroy()
|
||||
if(SSradio)
|
||||
SSradio.remove_object(src, frequency)
|
||||
radio_connection = null
|
||||
return ..()
|
||||
|
||||
/obj/item/radio/integrated/signal/initialize()
|
||||
if (src.frequency < 1200 || src.frequency > 1600)
|
||||
src.frequency = sanitize_frequency(src.frequency)
|
||||
|
||||
set_frequency(frequency)
|
||||
|
||||
/obj/item/radio/integrated/signal/proc/set_frequency(new_frequency)
|
||||
SSradio.remove_object(src, frequency)
|
||||
frequency = new_frequency
|
||||
radio_connection = SSradio.add_object(src, frequency)
|
||||
|
||||
/obj/item/radio/integrated/signal/proc/send_signal(message="ACTIVATE")
|
||||
|
||||
if(last_transmission && world.time < (last_transmission + 5))
|
||||
return
|
||||
last_transmission = world.time
|
||||
|
||||
var/time = time2text(world.realtime,"hh:mm:ss")
|
||||
var/turf/T = get_turf(src)
|
||||
lastsignalers.Add("[time] <B>:</B> [usr.key] used [src] @ location ([T.x],[T.y],[T.z]) <B>:</B> [format_frequency(frequency)]/[code]")
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.source = src
|
||||
signal.encryption = code
|
||||
signal.data["message"] = message
|
||||
|
||||
radio_connection.post_signal(src, signal)
|
||||
|
||||
return
|
||||
@@ -0,0 +1,85 @@
|
||||
/obj/item/device/aicard
|
||||
name = "intelliCard"
|
||||
desc = "A storage device for AIs. Patent pending."
|
||||
icon = 'icons/obj/aicards.dmi'
|
||||
icon_state = "aicard" // aicard-full
|
||||
item_state = "electronic"
|
||||
w_class = 2
|
||||
slot_flags = SLOT_BELT
|
||||
flags = NOBLUDGEON
|
||||
var/flush = FALSE
|
||||
var/mob/living/silicon/ai/AI
|
||||
origin_tech = "programming=3;materials=3"
|
||||
|
||||
/obj/item/device/aicard/afterattack(atom/target, mob/user, proximity)
|
||||
..()
|
||||
if(!proximity || !target)
|
||||
return
|
||||
if(AI) //AI is on the card, implies user wants to upload it.
|
||||
target.transfer_ai(AI_TRANS_FROM_CARD, user, AI, src)
|
||||
add_logs(user, AI, "carded", src)
|
||||
else //No AI on the card, therefore the user wants to download one.
|
||||
target.transfer_ai(AI_TRANS_TO_CARD, user, null, src)
|
||||
update_icon() //Whatever happened, update the card's state (icon, name) to match.
|
||||
|
||||
/obj/item/device/aicard/update_icon()
|
||||
if(AI)
|
||||
name = "[initial(name)]- [AI.name]"
|
||||
if(AI.stat == DEAD)
|
||||
icon_state = "aicard-404"
|
||||
else
|
||||
icon_state = "aicard-full"
|
||||
if(!AI.control_disabled)
|
||||
add_overlay(image('icons/obj/aicards.dmi', "aicard-on"))
|
||||
AI.cancel_camera()
|
||||
else
|
||||
name = initial(name)
|
||||
icon_state = initial(icon_state)
|
||||
cut_overlays()
|
||||
|
||||
/obj/item/device/aicard/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = hands_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "intellicard", name, 500, 500, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/item/device/aicard/ui_data()
|
||||
var/list/data = list()
|
||||
if(AI)
|
||||
data["name"] = AI.name
|
||||
data["laws"] = AI.laws.get_law_list(include_zeroth = 1)
|
||||
data["health"] = (AI.health + 100) / 2
|
||||
data["wireless"] = !AI.control_disabled //todo disabled->enabled
|
||||
data["radio"] = AI.radio_enabled
|
||||
data["isDead"] = AI.stat == DEAD
|
||||
data["isBraindead"] = AI.client ? TRUE : FALSE
|
||||
data["wiping"] = flush
|
||||
return data
|
||||
|
||||
/obj/item/device/aicard/ui_act(action,params)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("wipe")
|
||||
var/confirm = alert("Are you sure you want to wipe this card's memory? This cannot be undone once started.", name, "Yes", "No")
|
||||
if(confirm == "Yes" && !..())
|
||||
flush = TRUE
|
||||
if(AI && AI.loc == src)
|
||||
AI.suiciding = TRUE
|
||||
AI << "Your core files are being wiped!"
|
||||
while(AI.stat != DEAD)
|
||||
AI.adjustOxyLoss(2)
|
||||
AI.updatehealth()
|
||||
sleep(10)
|
||||
flush = FALSE
|
||||
. = TRUE
|
||||
if("wireless")
|
||||
AI.control_disabled = !AI.control_disabled
|
||||
AI << "[src]'s wireless port has been [AI.control_disabled ? "disabled" : "enabled"]!"
|
||||
. = TRUE
|
||||
if("radio")
|
||||
AI.radio_enabled = !AI.radio_enabled
|
||||
AI << "Your Subspace Transceiver has been [AI.radio_enabled ? "enabled" : "disabled"]!"
|
||||
. = TRUE
|
||||
update_icon()
|
||||
@@ -0,0 +1,282 @@
|
||||
|
||||
#define BUGMODE_LIST 0
|
||||
#define BUGMODE_MONITOR 1
|
||||
#define BUGMODE_TRACK 2
|
||||
|
||||
|
||||
|
||||
/obj/item/device/camera_bug
|
||||
name = "camera bug"
|
||||
desc = "For illicit snooping through the camera network."
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "camera_bug"
|
||||
w_class = 1
|
||||
item_state = "camera_bug"
|
||||
throw_speed = 4
|
||||
throw_range = 20
|
||||
origin_tech = "syndicate=1;engineering=3"
|
||||
flags = NOBLUDGEON
|
||||
|
||||
var/obj/machinery/camera/current = null
|
||||
|
||||
var/last_net_update = 0
|
||||
var/list/bugged_cameras = list()
|
||||
|
||||
var/track_mode = BUGMODE_LIST
|
||||
var/last_tracked = 0
|
||||
var/refresh_interval = 50
|
||||
|
||||
var/tracked_name = null
|
||||
var/atom/tracking = null
|
||||
|
||||
var/last_found = null
|
||||
var/last_seen = null
|
||||
|
||||
/obj/item/device/camera_bug/New()
|
||||
..()
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/device/camera_bug/Destroy()
|
||||
get_cameras()
|
||||
for(var/cam_tag in bugged_cameras)
|
||||
var/obj/machinery/camera/camera = bugged_cameras[cam_tag]
|
||||
if(camera.bug == src)
|
||||
camera.bug = null
|
||||
bugged_cameras = list()
|
||||
if(tracking)
|
||||
tracking = null
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/device/camera_bug/interact(mob/user = usr)
|
||||
var/datum/browser/popup = new(user, "camerabug","Camera Bug",nref=src)
|
||||
popup.set_content(menu(get_cameras()))
|
||||
popup.open()
|
||||
|
||||
/obj/item/device/camera_bug/attack_self(mob/user)
|
||||
user.set_machine(src)
|
||||
interact(user)
|
||||
|
||||
/obj/item/device/camera_bug/check_eye(mob/user)
|
||||
if ( loc != user || user.incapacitated() || user.eye_blind || !current )
|
||||
user.unset_machine()
|
||||
return
|
||||
var/turf/T = get_turf(user.loc)
|
||||
if(T.z != current.z || !current.can_use())
|
||||
user << "<span class='danger'>[src] has lost the signal.</span>"
|
||||
current = null
|
||||
user.unset_machine()
|
||||
|
||||
/obj/item/device/camera_bug/on_unset_machine(mob/user)
|
||||
user.reset_perspective(null)
|
||||
|
||||
/obj/item/device/camera_bug/proc/get_cameras()
|
||||
if( world.time > (last_net_update + 100))
|
||||
bugged_cameras = list()
|
||||
for(var/obj/machinery/camera/camera in cameranet.cameras)
|
||||
if(camera.stat || !camera.can_use())
|
||||
continue
|
||||
if(length(list("SS13","MINE")&camera.network))
|
||||
bugged_cameras[camera.c_tag] = camera
|
||||
sortList(bugged_cameras)
|
||||
return bugged_cameras
|
||||
|
||||
|
||||
/obj/item/device/camera_bug/proc/menu(list/cameras)
|
||||
if(!cameras || !cameras.len)
|
||||
return "No bugged cameras found."
|
||||
|
||||
var/html
|
||||
switch(track_mode)
|
||||
if(BUGMODE_LIST)
|
||||
html = "<h3>Select a camera:</h3> <a href='?src=\ref[src];view'>\[Cancel camera view\]</a><hr><table>"
|
||||
for(var/entry in cameras)
|
||||
var/obj/machinery/camera/C = cameras[entry]
|
||||
var/functions = ""
|
||||
if(C.bug == src)
|
||||
functions = " - <a href='?src=\ref[src];monitor=\ref[C]'>\[Monitor\]</a> <a href='?src=\ref[src];emp=\ref[C]'>\[Disable\]</a>"
|
||||
else
|
||||
functions = " - <a href='?src=\ref[src];monitor=\ref[C]'>\[Monitor\]</a>"
|
||||
html += "<tr><td><a href='?src=\ref[src];view=\ref[C]'>[entry]</a></td><td>[functions]</td></tr>"
|
||||
|
||||
if(BUGMODE_MONITOR)
|
||||
if(current)
|
||||
html = "Analyzing Camera '[current.c_tag]' <a href='?\ref[src];mode=0'>\[Select Camera\]</a><br>"
|
||||
html += camera_report()
|
||||
else
|
||||
track_mode = BUGMODE_LIST
|
||||
return .(cameras)
|
||||
if(BUGMODE_TRACK)
|
||||
if(tracking)
|
||||
html = "Tracking '[tracked_name]' <a href='?\ref[src];mode=0'>\[Cancel Tracking\]</a> <a href='?src=\ref[src];view'>\[Cancel camera view\]</a><br>"
|
||||
if(last_found)
|
||||
var/time_diff = round((world.time - last_seen) / 150)
|
||||
var/obj/machinery/camera/C = bugged_cameras[last_found]
|
||||
var/outstring
|
||||
if(C)
|
||||
outstring = "<a href='?\ref[src];view=\ref[C]'>[last_found]</a>"
|
||||
else
|
||||
outstring = last_found
|
||||
if(!time_diff)
|
||||
html += "Last seen near [outstring] (now)<br>"
|
||||
else
|
||||
// 15 second intervals ~ 1/4 minute
|
||||
var/m = round(time_diff/4)
|
||||
var/s = (time_diff - 4*m) * 15
|
||||
if(!s) s = "00"
|
||||
html += "Last seen near [outstring] ([m]:[s] minute\s ago)<br>"
|
||||
if( C && (C.bug == src)) //Checks to see if the camera has a bug
|
||||
html += "<a href='?src=\ref[src];emp=\ref[C]'>\[Disable\]</a>"
|
||||
|
||||
else
|
||||
html += "Not yet seen."
|
||||
else
|
||||
track_mode = BUGMODE_LIST
|
||||
return .(cameras)
|
||||
return html
|
||||
|
||||
/obj/item/device/camera_bug/proc/camera_report()
|
||||
// this should only be called if current exists
|
||||
var/dat = ""
|
||||
if(current && current.can_use())
|
||||
var/list/seen = current.can_see()
|
||||
var/list/names = list()
|
||||
for(var/obj/singularity/S in seen) // god help you if you see more than one
|
||||
if(S.name in names)
|
||||
names[S.name]++
|
||||
dat += "[S.name] ([names[S.name]])"
|
||||
else
|
||||
names[S.name] = 1
|
||||
dat += "[S.name]"
|
||||
var/stage = round(S.current_size / 2)+1
|
||||
dat += " (Stage [stage])"
|
||||
dat += " <a href='?\ref[src];track=\ref[S]'>\[Track\]</a><br>"
|
||||
|
||||
for(var/obj/mecha/M in seen)
|
||||
if(M.name in names)
|
||||
names[M.name]++
|
||||
dat += "[M.name] ([names[M.name]])"
|
||||
else
|
||||
names[M.name] = 1
|
||||
dat += "[M.name]"
|
||||
dat += " <a href='?\ref[src];track=\ref[M]'>\[Track\]</a><br>"
|
||||
|
||||
|
||||
for(var/mob/living/M in seen)
|
||||
if(M.name in names)
|
||||
names[M.name]++
|
||||
dat += "[M.name] ([names[M.name]])"
|
||||
else
|
||||
names[M.name] = 1
|
||||
dat += "[M.name]"
|
||||
if(M.buckled && !M.lying)
|
||||
dat += " (Sitting)"
|
||||
if(M.lying)
|
||||
dat += " (Laying down)"
|
||||
dat += " <a href='?\ref[src];track=\ref[M]'>\[Track\]</a><br>"
|
||||
if(length(dat) == 0)
|
||||
dat += "No motion detected."
|
||||
return dat
|
||||
else
|
||||
return "Camera Offline<br>"
|
||||
|
||||
/obj/item/device/camera_bug/Topic(href,list/href_list)
|
||||
if(usr != loc)
|
||||
usr.unset_machine()
|
||||
usr << browse(null, "window=camerabug")
|
||||
return
|
||||
usr.set_machine(src)
|
||||
if("mode" in href_list)
|
||||
track_mode = text2num(href_list["mode"])
|
||||
if("monitor" in href_list)
|
||||
var/obj/machinery/camera/C = locate(href_list["monitor"])
|
||||
if(C)
|
||||
track_mode = BUGMODE_MONITOR
|
||||
current = C
|
||||
usr.reset_perspective(null)
|
||||
interact()
|
||||
if("track" in href_list)
|
||||
var/atom/A = locate(href_list["track"])
|
||||
if(A)
|
||||
tracking = A
|
||||
tracked_name = A.name
|
||||
last_found = current.c_tag
|
||||
last_seen = world.time
|
||||
track_mode = BUGMODE_TRACK
|
||||
if("emp" in href_list)
|
||||
var/obj/machinery/camera/C = locate(href_list["emp"])
|
||||
if(istype(C) && C.bug == src)
|
||||
C.emp_act(1)
|
||||
C.bug = null
|
||||
bugged_cameras -= C.c_tag
|
||||
interact()
|
||||
return
|
||||
if("close" in href_list)
|
||||
usr.unset_machine()
|
||||
current = null
|
||||
return
|
||||
if("view" in href_list)
|
||||
var/obj/machinery/camera/C = locate(href_list["view"])
|
||||
if(istype(C))
|
||||
if(!C.can_use())
|
||||
usr << "<span class='warning'>Something's wrong with that camera! You can't get a feed.</span>"
|
||||
return
|
||||
var/turf/T = get_turf(loc)
|
||||
if(!T || C.z != T.z)
|
||||
usr << "<span class='warning'>You can't get a signal!</span>"
|
||||
return
|
||||
current = C
|
||||
spawn(6)
|
||||
if(src.check_eye(usr))
|
||||
usr.reset_perspective(C)
|
||||
interact()
|
||||
else
|
||||
usr.unset_machine()
|
||||
usr << browse(null, "window=camerabug")
|
||||
return
|
||||
else
|
||||
usr.unset_machine()
|
||||
|
||||
interact()
|
||||
|
||||
/obj/item/device/camera_bug/process()
|
||||
if(track_mode == BUGMODE_LIST || (world.time < (last_tracked + refresh_interval)))
|
||||
return
|
||||
last_tracked = world.time
|
||||
if(track_mode == BUGMODE_TRACK ) // search for user
|
||||
// Note that it will be tricked if your name appears to change.
|
||||
// This is not optimal but it is better than tracking you relentlessly despite everything.
|
||||
if(!tracking)
|
||||
src.updateSelfDialog()
|
||||
return
|
||||
|
||||
if(tracking.name != tracked_name) // Hiding their identity, tricksy
|
||||
var/mob/M = tracking
|
||||
if(istype(M))
|
||||
if(!(tracked_name == "Unknown" && findtext(tracking.name,"Unknown"))) // we saw then disguised before
|
||||
if(!(tracked_name == M.real_name && findtext(tracking.name,M.real_name))) // or they're still ID'd
|
||||
src.updateSelfDialog()//But if it's neither of those cases
|
||||
return // you won't find em on the cameras
|
||||
else
|
||||
src.updateSelfDialog()
|
||||
return
|
||||
|
||||
var/list/tracking_cams = list()
|
||||
var/list/b_cams = get_cameras()
|
||||
for(var/entry in b_cams)
|
||||
tracking_cams += b_cams[entry]
|
||||
var/list/target_region = view(tracking)
|
||||
|
||||
for(var/obj/machinery/camera/C in (target_region & tracking_cams))
|
||||
if(!can_see(C,tracking)) // target may have xray, that doesn't make them visible to cameras
|
||||
continue
|
||||
if(C.can_use())
|
||||
last_found = C.c_tag
|
||||
last_seen = world.time
|
||||
break
|
||||
src.updateSelfDialog()
|
||||
|
||||
|
||||
#undef BUGMODE_LIST
|
||||
#undef BUGMODE_MONITOR
|
||||
#undef BUGMODE_TRACK
|
||||
@@ -0,0 +1,138 @@
|
||||
/obj/item/device/chameleon
|
||||
name = "chameleon-projector"
|
||||
icon_state = "shield0"
|
||||
flags = CONDUCT | NOBLUDGEON
|
||||
slot_flags = SLOT_BELT
|
||||
item_state = "electronic"
|
||||
throwforce = 5
|
||||
throw_speed = 3
|
||||
throw_range = 5
|
||||
w_class = 2
|
||||
origin_tech = "syndicate=4;magnets=4"
|
||||
var/can_use = 1
|
||||
var/obj/effect/dummy/chameleon/active_dummy = null
|
||||
var/saved_appearance = null
|
||||
|
||||
/obj/item/device/chameleon/New()
|
||||
..()
|
||||
var/obj/item/weapon/cigbutt/butt = /obj/item/weapon/cigbutt
|
||||
saved_appearance = initial(butt.appearance)
|
||||
|
||||
/obj/item/device/chameleon/dropped()
|
||||
..()
|
||||
disrupt()
|
||||
|
||||
/obj/item/device/chameleon/equipped()
|
||||
disrupt()
|
||||
|
||||
/obj/item/device/chameleon/attack_self()
|
||||
toggle()
|
||||
|
||||
/obj/item/device/chameleon/afterattack(atom/target, mob/user , proximity)
|
||||
if(!proximity) return
|
||||
if(!active_dummy)
|
||||
if(istype(target,/obj/item) && !istype(target, /obj/item/weapon/disk/nuclear))
|
||||
playsound(get_turf(src), 'sound/weapons/flash.ogg', 100, 1, -6)
|
||||
user << "<span class='notice'>Scanned [target].</span>"
|
||||
var/obj/temp = new/obj()
|
||||
temp.appearance = target.appearance
|
||||
temp.layer = initial(target.layer) // scanning things in your inventory
|
||||
saved_appearance = temp.appearance
|
||||
|
||||
/obj/item/device/chameleon/proc/toggle()
|
||||
if(!can_use || !saved_appearance) return
|
||||
if(active_dummy)
|
||||
eject_all()
|
||||
playsound(get_turf(src), 'sound/effects/pop.ogg', 100, 1, -6)
|
||||
qdel(active_dummy)
|
||||
active_dummy = null
|
||||
usr << "<span class='notice'>You deactivate \the [src].</span>"
|
||||
PoolOrNew(/obj/effect/overlay/temp/emp/pulse, get_turf(src))
|
||||
else
|
||||
playsound(get_turf(src), 'sound/effects/pop.ogg', 100, 1, -6)
|
||||
var/obj/effect/dummy/chameleon/C = new/obj/effect/dummy/chameleon(usr.loc)
|
||||
C.activate(usr, saved_appearance, src)
|
||||
usr << "<span class='notice'>You activate \the [src].</span>"
|
||||
PoolOrNew(/obj/effect/overlay/temp/emp/pulse, get_turf(src))
|
||||
|
||||
/obj/item/device/chameleon/proc/disrupt(delete_dummy = 1)
|
||||
if(active_dummy)
|
||||
for(var/mob/M in active_dummy)
|
||||
M << "<span class='danger'>Your chameleon-projector deactivates.</span>"
|
||||
var/datum/effect_system/spark_spread/spark_system = new /datum/effect_system/spark_spread
|
||||
spark_system.set_up(5, 0, src)
|
||||
spark_system.attach(src)
|
||||
spark_system.start()
|
||||
eject_all()
|
||||
if(delete_dummy)
|
||||
qdel(active_dummy)
|
||||
active_dummy = null
|
||||
can_use = 0
|
||||
spawn(50) can_use = 1
|
||||
|
||||
/obj/item/device/chameleon/proc/eject_all()
|
||||
for(var/atom/movable/A in active_dummy)
|
||||
A.loc = active_dummy.loc
|
||||
if(ismob(A))
|
||||
var/mob/M = A
|
||||
M.reset_perspective(null)
|
||||
|
||||
/obj/effect/dummy/chameleon
|
||||
name = ""
|
||||
desc = ""
|
||||
density = 0
|
||||
var/can_move = 1
|
||||
var/obj/item/device/chameleon/master = null
|
||||
|
||||
/obj/effect/dummy/chameleon/proc/activate(mob/M, saved_appearance, obj/item/device/chameleon/C)
|
||||
appearance = saved_appearance
|
||||
M.loc = src
|
||||
master = C
|
||||
master.active_dummy = src
|
||||
|
||||
/obj/effect/dummy/chameleon/attackby()
|
||||
master.disrupt()
|
||||
|
||||
/obj/effect/dummy/chameleon/attack_hand()
|
||||
master.disrupt()
|
||||
|
||||
/obj/effect/dummy/chameleon/attack_animal()
|
||||
master.disrupt()
|
||||
|
||||
/obj/effect/dummy/chameleon/attack_slime()
|
||||
master.disrupt()
|
||||
|
||||
/obj/effect/dummy/chameleon/attack_alien()
|
||||
master.disrupt()
|
||||
|
||||
/obj/effect/dummy/chameleon/ex_act(S, T)
|
||||
contents_explosion(S, T)
|
||||
master.disrupt()
|
||||
|
||||
/obj/effect/dummy/chameleon/bullet_act()
|
||||
..()
|
||||
master.disrupt()
|
||||
|
||||
/obj/effect/dummy/chameleon/relaymove(mob/user, direction)
|
||||
if(istype(loc, /turf/open/space) || !direction)
|
||||
return //No magical space movement!
|
||||
|
||||
if(can_move)
|
||||
can_move = 0
|
||||
switch(user.bodytemperature)
|
||||
if(300 to INFINITY)
|
||||
spawn(10) can_move = 1
|
||||
if(295 to 300)
|
||||
spawn(13) can_move = 1
|
||||
if(280 to 295)
|
||||
spawn(16) can_move = 1
|
||||
if(260 to 280)
|
||||
spawn(20) can_move = 1
|
||||
else
|
||||
spawn(25) can_move = 1
|
||||
step(src, direction)
|
||||
return
|
||||
|
||||
/obj/effect/dummy/chameleon/Destroy()
|
||||
master.disrupt(0)
|
||||
return ..()
|
||||
@@ -0,0 +1,33 @@
|
||||
/obj/item/device/doorCharge
|
||||
name = "airlock charge"
|
||||
desc = null //Different examine for traitors
|
||||
item_state = "electronic"
|
||||
icon_state = "doorCharge"
|
||||
w_class = 2
|
||||
throw_range = 4
|
||||
throw_speed = 1
|
||||
flags = NOBLUDGEON
|
||||
force = 3
|
||||
attack_verb = list("blown up", "exploded", "detonated")
|
||||
materials = list(MAT_METAL=50, MAT_GLASS=30)
|
||||
origin_tech = "syndicate=1;combat=3;engineering=3"
|
||||
|
||||
/obj/item/device/doorCharge/ex_act(severity, target)
|
||||
switch(severity)
|
||||
if(1)
|
||||
visible_message("<span class='warning'>[src] detonates!</span>")
|
||||
explosion(src.loc,0,2,1,flame_range = 4)
|
||||
qdel(src)
|
||||
if(2)
|
||||
if(prob(50))
|
||||
ex_act(1)
|
||||
if(3)
|
||||
if(prob(25))
|
||||
ex_act(1)
|
||||
|
||||
/obj/item/device/doorCharge/examine(mob/user)
|
||||
..()
|
||||
if(user.mind in ticker.mode.traitors) //No nuke ops because the device is excluded from nuclear
|
||||
user << "A small explosive device that can be used to sabotage airlocks to cause an explosion upon opening. To apply, remove the airlock's maintenance panel and place it within."
|
||||
else
|
||||
user << "A small, suspicious object that feels lukewarm when held."
|
||||
@@ -0,0 +1,324 @@
|
||||
/obj/item/device/flashlight
|
||||
name = "flashlight"
|
||||
desc = "A hand-held emergency light."
|
||||
icon = 'icons/obj/lighting.dmi'
|
||||
icon_state = "flashlight"
|
||||
item_state = "flashlight"
|
||||
w_class = 2
|
||||
flags = CONDUCT
|
||||
slot_flags = SLOT_BELT
|
||||
materials = list(MAT_METAL=50, MAT_GLASS=20)
|
||||
actions_types = list(/datum/action/item_action/toggle_light)
|
||||
var/on = 0
|
||||
var/brightness_on = 4 //luminosity when on
|
||||
|
||||
/obj/item/device/flashlight/initialize()
|
||||
..()
|
||||
if(on)
|
||||
icon_state = "[initial(icon_state)]-on"
|
||||
SetLuminosity(brightness_on)
|
||||
else
|
||||
icon_state = initial(icon_state)
|
||||
SetLuminosity(0)
|
||||
|
||||
/obj/item/device/flashlight/proc/update_brightness(mob/user = null)
|
||||
if(on)
|
||||
icon_state = "[initial(icon_state)]-on"
|
||||
if(loc == user)
|
||||
user.AddLuminosity(brightness_on)
|
||||
else if(isturf(loc))
|
||||
SetLuminosity(brightness_on)
|
||||
else
|
||||
icon_state = initial(icon_state)
|
||||
if(loc == user)
|
||||
user.AddLuminosity(-brightness_on)
|
||||
else if(isturf(loc))
|
||||
SetLuminosity(0)
|
||||
|
||||
/obj/item/device/flashlight/attack_self(mob/user)
|
||||
if(!isturf(user.loc))
|
||||
user << "<span class='warning'>You cannot turn the light on while in this [user.loc]!</span>" //To prevent some lighting anomalities.
|
||||
return 0
|
||||
on = !on
|
||||
update_brightness(user)
|
||||
for(var/X in actions)
|
||||
var/datum/action/A = X
|
||||
A.UpdateButtonIcon()
|
||||
return 1
|
||||
|
||||
|
||||
/obj/item/device/flashlight/attack(mob/living/carbon/human/M, mob/living/carbon/human/user)
|
||||
add_fingerprint(user)
|
||||
if(on && user.zone_selected == "eyes")
|
||||
|
||||
if((user.disabilities & CLUMSY || user.getBrainLoss() >= 60) && prob(50)) //too dumb to use flashlight properly
|
||||
return ..() //just hit them in the head
|
||||
|
||||
if(!user.IsAdvancedToolUser())
|
||||
user << "<span class='warning'>You don't have the dexterity to do this!</span>"
|
||||
return
|
||||
|
||||
var/mob/living/carbon/human/H = M //mob has protective eyewear
|
||||
if(istype(M, /mob/living/carbon/human) && ((H.head && H.head.flags_cover & HEADCOVERSEYES) || (H.wear_mask && H.wear_mask.flags_cover & MASKCOVERSEYES) || (H.glasses && H.glasses.flags_cover & GLASSESCOVERSEYES)))
|
||||
user << "<span class='notice'>You're going to need to remove that [(H.head && H.head.flags_cover & HEADCOVERSEYES) ? "helmet" : (H.wear_mask && H.wear_mask.flags_cover & MASKCOVERSEYES) ? "mask": "glasses"] first.</span>"
|
||||
return
|
||||
|
||||
if(M == user) //they're using it on themselves
|
||||
if(M.flash_eyes(visual = 1))
|
||||
M.visible_message("[M] directs [src] to \his eyes.", \
|
||||
"<span class='notice'>You wave the light in front of your eyes! Trippy!</span>")
|
||||
else
|
||||
M.visible_message("[M] directs [src] to \his eyes.", \
|
||||
"<span class='notice'>You wave the light in front of your eyes.</span>")
|
||||
else
|
||||
user.visible_message("<span class='warning'>[user] directs [src] to [M]'s eyes.</span>", \
|
||||
"<span class='danger'>You direct [src] to [M]'s eyes.</span>")
|
||||
var/mob/living/carbon/C = M
|
||||
if(istype(C))
|
||||
if(C.stat == DEAD || (C.disabilities & BLIND)) //mob is dead or fully blind
|
||||
user << "<span class='warning'>[C] pupils don't react to the light!</span>"
|
||||
else if(C.dna.check_mutation(XRAY)) //mob has X-RAY vision
|
||||
user << "<span class='danger'>[C] pupils give an eerie glow!</span>"
|
||||
else //they're okay!
|
||||
if(C.flash_eyes(visual = 1))
|
||||
user << "<span class='notice'>[C]'s pupils narrow.</span>"
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/device/flashlight/pickup(mob/user)
|
||||
..()
|
||||
if(on)
|
||||
user.AddLuminosity(brightness_on)
|
||||
SetLuminosity(0)
|
||||
|
||||
|
||||
/obj/item/device/flashlight/dropped(mob/user)
|
||||
..()
|
||||
if(on)
|
||||
user.AddLuminosity(-brightness_on)
|
||||
SetLuminosity(brightness_on)
|
||||
|
||||
|
||||
/obj/item/device/flashlight/pen
|
||||
name = "penlight"
|
||||
desc = "A pen-sized light, used by medical staff. It can also be used to create a hologram to alert people of incoming medical assistance."
|
||||
icon_state = "penlight"
|
||||
item_state = ""
|
||||
flags = CONDUCT
|
||||
brightness_on = 2
|
||||
var/holo_cooldown = 0
|
||||
|
||||
/obj/item/device/flashlight/pen/afterattack(atom/target, mob/user, proximity_flag)
|
||||
if(!proximity_flag)
|
||||
if(holo_cooldown > world.time)
|
||||
user << "<span class='warning'>[src] is not ready yet!</span>"
|
||||
return
|
||||
var/T = get_turf(target)
|
||||
if(locate(/mob/living) in T)
|
||||
PoolOrNew(/obj/effect/overlay/temp/medical_holosign, list(T,user)) //produce a holographic glow
|
||||
holo_cooldown = world.time + 100
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/effect/overlay/temp/medical_holosign
|
||||
name = "medical holosign"
|
||||
desc = "A small holographic glow that indicates a medic is coming to treat a patient."
|
||||
icon_state = "medi_holo"
|
||||
duration = 30
|
||||
|
||||
/obj/effect/overlay/temp/medical_holosign/New(loc, creator)
|
||||
..()
|
||||
playsound(loc, 'sound/machines/ping.ogg', 50, 0) //make some noise!
|
||||
if(creator)
|
||||
visible_message("<span class='danger'>[creator] created a medical hologram!</span>")
|
||||
|
||||
|
||||
/obj/item/device/flashlight/seclite
|
||||
name = "seclite"
|
||||
desc = "A robust flashlight used by security."
|
||||
icon_state = "seclite"
|
||||
item_state = "seclite"
|
||||
force = 9 // Not as good as a stun baton.
|
||||
brightness_on = 5 // A little better than the standard flashlight.
|
||||
hitsound = 'sound/weapons/genhit1.ogg'
|
||||
|
||||
// the desk lamps are a bit special
|
||||
/obj/item/device/flashlight/lamp
|
||||
name = "desk lamp"
|
||||
desc = "A desk lamp with an adjustable mount."
|
||||
icon_state = "lamp"
|
||||
item_state = "lamp"
|
||||
brightness_on = 5
|
||||
w_class = 4
|
||||
flags = CONDUCT
|
||||
materials = list()
|
||||
on = 1
|
||||
|
||||
|
||||
// green-shaded desk lamp
|
||||
/obj/item/device/flashlight/lamp/green
|
||||
desc = "A classic green-shaded desk lamp."
|
||||
icon_state = "lampgreen"
|
||||
item_state = "lampgreen"
|
||||
|
||||
|
||||
|
||||
/obj/item/device/flashlight/lamp/verb/toggle_light()
|
||||
set name = "Toggle light"
|
||||
set category = "Object"
|
||||
set src in oview(1)
|
||||
|
||||
if(!usr.stat)
|
||||
attack_self(usr)
|
||||
|
||||
//Bananalamp
|
||||
obj/item/device/flashlight/lamp/bananalamp
|
||||
name = "banana lamp"
|
||||
desc = "Only a clown would think to make a ghetto banana-shaped lamp. Even has a goofy pullstring."
|
||||
icon_state = "bananalamp"
|
||||
item_state = "bananalamp"
|
||||
|
||||
// FLARES
|
||||
|
||||
/obj/item/device/flashlight/flare
|
||||
name = "flare"
|
||||
desc = "A red Nanotrasen issued flare. There are instructions on the side, it reads 'pull cord, make light'."
|
||||
w_class = 2
|
||||
brightness_on = 7 // Pretty bright.
|
||||
icon_state = "flare"
|
||||
item_state = "flare"
|
||||
actions_types = list()
|
||||
var/fuel = 0
|
||||
var/on_damage = 7
|
||||
var/produce_heat = 1500
|
||||
heat = 1000
|
||||
|
||||
/obj/item/device/flashlight/flare/New()
|
||||
fuel = rand(800, 1000) // Sorry for changing this so much but I keep under-estimating how long X number of ticks last in seconds.
|
||||
..()
|
||||
|
||||
/obj/item/device/flashlight/flare/process()
|
||||
var/turf/pos = get_turf(src)
|
||||
if(pos)
|
||||
pos.hotspot_expose(produce_heat, 5)
|
||||
fuel = max(fuel - 1, 0)
|
||||
if(!fuel || !on)
|
||||
turn_off()
|
||||
if(!fuel)
|
||||
icon_state = "[initial(icon_state)]-empty"
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/device/flashlight/flare/proc/turn_off()
|
||||
on = 0
|
||||
force = initial(src.force)
|
||||
damtype = initial(src.damtype)
|
||||
if(ismob(loc))
|
||||
var/mob/U = loc
|
||||
update_brightness(U)
|
||||
else
|
||||
update_brightness(null)
|
||||
|
||||
/obj/item/device/flashlight/flare/update_brightness(mob/user = null)
|
||||
..()
|
||||
if(on)
|
||||
item_state = "[initial(item_state)]-on"
|
||||
else
|
||||
item_state = "[initial(item_state)]"
|
||||
|
||||
/obj/item/device/flashlight/flare/attack_self(mob/user)
|
||||
|
||||
// Usual checks
|
||||
if(!fuel)
|
||||
user << "<span class='warning'>It's out of fuel!</span>"
|
||||
return
|
||||
if(on)
|
||||
return
|
||||
|
||||
. = ..()
|
||||
// All good, turn it on.
|
||||
if(.)
|
||||
user.visible_message("<span class='notice'>[user] lights \the [src].</span>", "<span class='notice'>You light \the [src]!</span>")
|
||||
force = on_damage
|
||||
damtype = "fire"
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/device/flashlight/flare/is_hot()
|
||||
return on * heat
|
||||
|
||||
/obj/item/device/flashlight/flare/torch
|
||||
name = "torch"
|
||||
desc = "A torch fashioned from some leaves and a log."
|
||||
w_class = 4
|
||||
brightness_on = 4
|
||||
icon_state = "torch"
|
||||
item_state = "torch"
|
||||
on_damage = 10
|
||||
slot_flags = null
|
||||
|
||||
/obj/item/device/flashlight/lantern
|
||||
name = "lantern"
|
||||
icon_state = "lantern"
|
||||
item_state = "lantern"
|
||||
desc = "A mining lantern."
|
||||
brightness_on = 6 // luminosity when on
|
||||
|
||||
|
||||
/obj/item/device/flashlight/slime
|
||||
gender = PLURAL
|
||||
name = "glowing slime extract"
|
||||
desc = "Extract from a yellow slime. It emits a strong light when squeezed."
|
||||
icon = 'icons/obj/lighting.dmi'
|
||||
icon_state = "slime"
|
||||
item_state = "slime"
|
||||
w_class = 2
|
||||
slot_flags = SLOT_BELT
|
||||
materials = list()
|
||||
brightness_on = 6 //luminosity when on
|
||||
|
||||
/obj/item/device/flashlight/emp
|
||||
origin_tech = "magnets=3;syndicate=´1"
|
||||
var/emp_max_charges = 4
|
||||
var/emp_cur_charges = 4
|
||||
var/charge_tick = 0
|
||||
|
||||
|
||||
/obj/item/device/flashlight/emp/New()
|
||||
..()
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/device/flashlight/emp/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return ..()
|
||||
|
||||
/obj/item/device/flashlight/emp/process()
|
||||
charge_tick++
|
||||
if(charge_tick < 10) return 0
|
||||
charge_tick = 0
|
||||
emp_cur_charges = min(emp_cur_charges+1, emp_max_charges)
|
||||
return 1
|
||||
|
||||
/obj/item/device/flashlight/emp/attack(mob/living/M, mob/living/user)
|
||||
if(on && user.zone_selected == "eyes") // call original attack proc only if aiming at the eyes
|
||||
..()
|
||||
return
|
||||
|
||||
/obj/item/device/flashlight/emp/afterattack(atom/movable/A, mob/user, proximity)
|
||||
if(!proximity)
|
||||
return
|
||||
|
||||
if(emp_cur_charges > 0)
|
||||
emp_cur_charges -= 1
|
||||
|
||||
if(ismob(A))
|
||||
var/mob/M = A
|
||||
add_logs(user, M, "attacked", "EMP-light")
|
||||
M.visible_message("<span class='danger'>[user] blinks \the [src] at \the [A].", \
|
||||
"<span class='userdanger'>[user] blinks \the [src] at you.")
|
||||
else
|
||||
A.visible_message("<span class='danger'>[user] blinks \the [src] at \the [A].")
|
||||
user << "\The [src] now has [emp_cur_charges] charge\s."
|
||||
A.emp_act(1)
|
||||
else
|
||||
user << "<span class='warning'>\The [src] needs time to recharge!</span>"
|
||||
return
|
||||
@@ -0,0 +1,158 @@
|
||||
#define RAD_LEVEL_NORMAL 10
|
||||
#define RAD_LEVEL_MODERATE 30
|
||||
#define RAD_LEVEL_HIGH 75
|
||||
#define RAD_LEVEL_VERY_HIGH 125
|
||||
#define RAD_LEVEL_CRITICAL 200
|
||||
|
||||
/obj/item/device/geiger_counter //DISCLAIMER: I know nothing about how real-life Geiger counters work. This will not be realistic. ~Xhuis
|
||||
name = "geiger counter"
|
||||
desc = "A handheld device used for detecting and measuring radiation pulses."
|
||||
icon_state = "geiger_off"
|
||||
item_state = "multitool"
|
||||
w_class = 2
|
||||
slot_flags = SLOT_BELT
|
||||
materials = list(MAT_METAL = 150, MAT_GLASS = 150)
|
||||
var/scanning = 0
|
||||
var/radiation_count = 0
|
||||
var/emagged = 0
|
||||
|
||||
/obj/item/device/geiger_counter/New()
|
||||
..()
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/device/geiger_counter/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
..()
|
||||
|
||||
/obj/item/device/geiger_counter/process()
|
||||
if(emagged)
|
||||
if(radiation_count < 20)
|
||||
radiation_count++
|
||||
return 0
|
||||
if(radiation_count > 0)
|
||||
radiation_count--
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/geiger_counter/examine(mob/user)
|
||||
..()
|
||||
if(!scanning)
|
||||
return 1
|
||||
user << "<span class='info'>Alt-click it to clear stored radiation levels.</span>"
|
||||
if(emagged)
|
||||
user << "<span class='warning'>The display seems to be incomprehensible.</span>"
|
||||
return 1
|
||||
switch(radiation_count)
|
||||
if(-INFINITY to RAD_LEVEL_NORMAL)
|
||||
user << "<span class='notice'>Ambient radiation level count reports that all is well.</span>"
|
||||
if(RAD_LEVEL_NORMAL + 1 to RAD_LEVEL_MODERATE)
|
||||
user << "<span class='disarm'>Ambient radiation levels slightly above average.</span>"
|
||||
if(RAD_LEVEL_MODERATE + 1 to RAD_LEVEL_HIGH)
|
||||
user << "<span class='warning'>Ambient radiation levels above average.</span>"
|
||||
if(RAD_LEVEL_HIGH + 1 to RAD_LEVEL_VERY_HIGH)
|
||||
user << "<span class='danger'>Ambient radiation levels highly above average.</span>"
|
||||
if(RAD_LEVEL_VERY_HIGH + 1 to RAD_LEVEL_CRITICAL)
|
||||
user << "<span class='suicide'>Ambient radiation levels nearing critical level.</span>"
|
||||
if(RAD_LEVEL_CRITICAL + 1 to INFINITY)
|
||||
user << "<span class='boldannounce'>Ambient radiation levels above critical level!</span>"
|
||||
|
||||
/obj/item/device/geiger_counter/update_icon()
|
||||
if(!scanning)
|
||||
icon_state = "geiger_off"
|
||||
return 1
|
||||
if(emagged)
|
||||
icon_state = "geiger_on_emag"
|
||||
return 1
|
||||
switch(radiation_count)
|
||||
if(-INFINITY to RAD_LEVEL_NORMAL)
|
||||
icon_state = "geiger_on_1"
|
||||
if(RAD_LEVEL_NORMAL + 1 to RAD_LEVEL_MODERATE)
|
||||
icon_state = "geiger_on_2"
|
||||
if(RAD_LEVEL_MODERATE + 1 to RAD_LEVEL_HIGH)
|
||||
icon_state = "geiger_on_3"
|
||||
if(RAD_LEVEL_HIGH + 1 to RAD_LEVEL_VERY_HIGH)
|
||||
icon_state = "geiger_on_4"
|
||||
if(RAD_LEVEL_VERY_HIGH + 1 to RAD_LEVEL_CRITICAL)
|
||||
icon_state = "geiger_on_4"
|
||||
if(RAD_LEVEL_CRITICAL + 1 to INFINITY)
|
||||
icon_state = "geiger_on_5"
|
||||
..()
|
||||
|
||||
/obj/item/device/geiger_counter/rad_act(amount)
|
||||
if(!amount && scanning)
|
||||
return 0
|
||||
if(emagged)
|
||||
amount = Clamp(amount, 0, 25) //Emagged geiger counters can only accept 25 radiation at a time
|
||||
radiation_count += amount
|
||||
if(isliving(loc))
|
||||
var/mob/living/M = loc
|
||||
if(!emagged)
|
||||
M << "<span class='boldannounce'>\icon[src] RADIATION PULSE DETECTED.</span>"
|
||||
M << "<span class='boldannounce'>\icon[src] Severity: [amount]</span>"
|
||||
else
|
||||
M << "<span class='boldannounce'>\icon[src] !@%$AT!(N P!LS! D/TEC?ED.</span>"
|
||||
M << "<span class='boldannounce'>\icon[src] &!F2rity: <=[amount]#1</span>"
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/geiger_counter/attack_self(mob/user)
|
||||
scanning = !scanning
|
||||
update_icon()
|
||||
user << "<span class='notice'>\icon[src] You switch [scanning ? "on" : "off"] [src].</span>"
|
||||
|
||||
/obj/item/device/geiger_counter/attack(mob/living/M, mob/user)
|
||||
if(user.a_intent == "help")
|
||||
if(!emagged)
|
||||
user.visible_message("<span class='notice'>[user] scans [M] with [src].</span>", "<span class='notice'>You scan [M]'s radiation levels with [src]...</span>")
|
||||
if(!M.radiation)
|
||||
user << "<span class='notice'>\icon[src] Radiation levels within normal boundaries.</span>"
|
||||
return 1
|
||||
else
|
||||
user << "<span class='boldannounce'>\icon[src] Subject is irradiated. Radiation levels: [M.radiation].</span>"
|
||||
return 1
|
||||
else
|
||||
user.visible_message("<span class='notice'>[user] scans [M] with [src].</span>", "<span class='danger'>You project [src]'s stored radiation into [M]'s body!</span>")
|
||||
M.rad_act(radiation_count)
|
||||
radiation_count = 0
|
||||
return 1
|
||||
..()
|
||||
|
||||
/obj/item/device/geiger_counter/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/weapon/screwdriver) && emagged)
|
||||
if(scanning)
|
||||
user << "<span class='warning'>Turn off [src] before you perform this action!</span>"
|
||||
return 0
|
||||
user.visible_message("<span class='notice'>[user] unscrews [src]'s maintenance panel and begins fiddling with its innards...</span>", "<span class='notice'>You begin resetting [src]...</span>")
|
||||
playsound(user, 'sound/items/Screwdriver.ogg', 50, 1)
|
||||
if(!do_after(user, 40/I.toolspeed, target = user))
|
||||
return 0
|
||||
user.visible_message("<span class='notice'>[user] refastens [src]'s maintenance panel!</span>", "<span class='notice'>You reset [src] to its factory settings!</span>")
|
||||
playsound(user, 'sound/items/Screwdriver2.ogg', 50, 1)
|
||||
emagged = 0
|
||||
radiation_count = 0
|
||||
update_icon()
|
||||
return 1
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/device/geiger_counter/AltClick(mob/living/user)
|
||||
if(!istype(user) || user.incapacitated())
|
||||
return ..()
|
||||
if(!scanning)
|
||||
usr << "<span class='warning'>[src] must be on to reset its radiation level!</span>"
|
||||
return 0
|
||||
radiation_count = 0
|
||||
usr << "<span class='notice'>You flush [src]'s radiation counts, resetting it to normal.</span>"
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/geiger_counter/emag_act(mob/user)
|
||||
if(!emagged)
|
||||
if(scanning)
|
||||
user << "<span class='warning'>Turn off [src] before you perform this action!</span>"
|
||||
return 0
|
||||
user << "<span class='warning'>You override [src]'s radiation storing protocols. It will now generate small doses of radiation, and stored rads are now projected into creatures you scan.</span>"
|
||||
emagged = 1
|
||||
|
||||
#undef RAD_LEVEL_NORMAL
|
||||
#undef RAD_LEVEL_MODERATE
|
||||
#undef RAD_LEVEL_HIGH
|
||||
#undef RAD_LEVEL_VERY_HIGH
|
||||
#undef RAD_LEVEL_CRITICAL
|
||||
@@ -0,0 +1,73 @@
|
||||
//copy pasta of the space piano, don't hurt me -Pete
|
||||
/obj/item/device/instrument
|
||||
name = "generic instrument"
|
||||
burn_state = FLAMMABLE
|
||||
burntime = 20
|
||||
var/datum/song/handheld/song
|
||||
var/instrumentId = "generic"
|
||||
var/instrumentExt = "ogg"
|
||||
|
||||
/obj/item/device/instrument/New()
|
||||
song = new(instrumentId, src)
|
||||
song.instrumentExt = instrumentExt
|
||||
|
||||
/obj/item/device/instrument/Destroy()
|
||||
qdel(song)
|
||||
song = null
|
||||
return ..()
|
||||
|
||||
/obj/item/device/instrument/suicide_act(mob/user)
|
||||
user.visible_message("<span class='suicide'>[user] begins to play 'Gloomy Sunday'! It looks like \he's trying to commit suicide..</span>")
|
||||
return (BRUTELOSS)
|
||||
|
||||
/obj/item/device/instrument/initialize()
|
||||
song.tempo = song.sanitize_tempo(song.tempo) // tick_lag isn't set when the map is loaded
|
||||
..()
|
||||
|
||||
/obj/item/device/instrument/attack_self(mob/user)
|
||||
if(!user.IsAdvancedToolUser())
|
||||
user << "<span class='warning'>You don't have the dexterity to do this!</span>"
|
||||
return 1
|
||||
interact(user)
|
||||
|
||||
/obj/item/device/instrument/interact(mob/user)
|
||||
if(!user)
|
||||
return
|
||||
|
||||
if(!isliving(user) || user.stat || user.restrained() || user.lying)
|
||||
return
|
||||
|
||||
user.set_machine(src)
|
||||
song.interact(user)
|
||||
|
||||
/obj/item/device/instrument/violin
|
||||
name = "space violin"
|
||||
desc = "A wooden musical instrument with four strings and a bow. \"The devil went down to space, he was looking for an assistant to grief.\""
|
||||
icon = 'icons/obj/musician.dmi'
|
||||
icon_state = "violin"
|
||||
item_state = "violin"
|
||||
force = 10
|
||||
hitsound = "swing_hit"
|
||||
instrumentId = "violin"
|
||||
|
||||
/obj/item/device/instrument/guitar
|
||||
name = "guitar"
|
||||
desc = "It's made of wood and has bronze strings."
|
||||
icon = 'icons/obj/musician.dmi'
|
||||
icon_state = "guitar"
|
||||
item_state = "guitar"
|
||||
force = 10
|
||||
attack_verb = list("played metal on", "serenaded", "crashed", "smashed")
|
||||
hitsound = 'sound/weapons/stringsmash.ogg'
|
||||
instrumentId = "guitar"
|
||||
|
||||
/obj/item/device/instrument/eguitar
|
||||
name = "eletric guitar"
|
||||
desc = "Makes all your shredding needs possible."
|
||||
icon = 'icons/obj/musician.dmi'
|
||||
icon_state = "eguitar"
|
||||
item_state = "eguitar"
|
||||
force = 12
|
||||
attack_verb = list("played metal on", "shredded", "crashed", "smashed")
|
||||
hitsound = 'sound/weapons/stringsmash.ogg'
|
||||
instrumentId = "eguitar"
|
||||
@@ -0,0 +1,172 @@
|
||||
/obj/item/device/laser_pointer
|
||||
name = "laser pointer"
|
||||
desc = "Don't shine it in your eyes!"
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "pointer"
|
||||
item_state = "pen"
|
||||
var/pointer_icon_state
|
||||
flags = CONDUCT | NOBLUDGEON
|
||||
slot_flags = SLOT_BELT
|
||||
materials = list(MAT_METAL=500, MAT_GLASS=500)
|
||||
w_class = 2 //Increased to 2, because diodes are w_class 2. Conservation of matter.
|
||||
origin_tech = "combat=1;magnets=2"
|
||||
var/turf/pointer_loc
|
||||
var/energy = 5
|
||||
var/max_energy = 5
|
||||
var/effectchance = 33
|
||||
var/recharging = 0
|
||||
var/recharge_locked = 0
|
||||
var/obj/item/weapon/stock_parts/micro_laser/diode //used for upgrading!
|
||||
|
||||
|
||||
/obj/item/device/laser_pointer/red
|
||||
pointer_icon_state = "red_laser"
|
||||
/obj/item/device/laser_pointer/green
|
||||
pointer_icon_state = "green_laser"
|
||||
/obj/item/device/laser_pointer/blue
|
||||
pointer_icon_state = "blue_laser"
|
||||
/obj/item/device/laser_pointer/purple
|
||||
pointer_icon_state = "purple_laser"
|
||||
|
||||
/obj/item/device/laser_pointer/New()
|
||||
..()
|
||||
diode = new(src)
|
||||
if(!pointer_icon_state)
|
||||
pointer_icon_state = pick("red_laser","green_laser","blue_laser","purple_laser")
|
||||
|
||||
/obj/item/device/laser_pointer/upgraded/New()
|
||||
..()
|
||||
diode = new /obj/item/weapon/stock_parts/micro_laser/ultra
|
||||
|
||||
/obj/item/device/laser_pointer/attackby(obj/item/W, mob/user, params)
|
||||
if(istype(W, /obj/item/weapon/stock_parts/micro_laser))
|
||||
if(!diode)
|
||||
if(!user.unEquip(W))
|
||||
return
|
||||
W.loc = src
|
||||
diode = W
|
||||
user << "<span class='notice'>You install a [diode.name] in [src].</span>"
|
||||
else
|
||||
user << "<span class='notice'>[src] already has a diode installed.</span>"
|
||||
|
||||
else if(istype(W, /obj/item/weapon/screwdriver))
|
||||
if(diode)
|
||||
user << "<span class='notice'>You remove the [diode.name] from \the [src].</span>"
|
||||
diode.loc = get_turf(src.loc)
|
||||
diode = null
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/device/laser_pointer/afterattack(atom/target, mob/living/user, flag, params)
|
||||
laser_act(target, user, params)
|
||||
|
||||
/obj/item/device/laser_pointer/proc/laser_act(atom/target, mob/living/user, params)
|
||||
if( !(user in (viewers(7,target))) )
|
||||
return
|
||||
if (!diode)
|
||||
user << "<span class='notice'>You point [src] at [target], but nothing happens!</span>"
|
||||
return
|
||||
if (!user.IsAdvancedToolUser())
|
||||
user << "<span class='warning'>You don't have the dexterity to do this!</span>"
|
||||
return
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.dna.check_mutation(HULK) || (NOGUNS in H.dna.species.specflags))
|
||||
user << "<span class='warning'>Your fingers can't press the button!</span>"
|
||||
return
|
||||
|
||||
add_fingerprint(user)
|
||||
|
||||
//nothing happens if the battery is drained
|
||||
if(recharge_locked)
|
||||
user << "<span class='notice'>You point [src] at [target], but it's still charging.</span>"
|
||||
return
|
||||
|
||||
var/outmsg
|
||||
var/turf/targloc = get_turf(target)
|
||||
|
||||
//human/alien mobs
|
||||
if(iscarbon(target))
|
||||
var/mob/living/carbon/C = target
|
||||
if(user.zone_selected == "eyes")
|
||||
add_logs(user, C, "shone in the eyes", src)
|
||||
|
||||
var/severity = 1
|
||||
if(prob(33))
|
||||
severity = 2
|
||||
else if(prob(50))
|
||||
severity = 0
|
||||
|
||||
//20% chance to actually hit the eyes
|
||||
if(prob(effectchance * diode.rating) && C.flash_eyes(severity))
|
||||
outmsg = "<span class='notice'>You blind [C] by shining [src] in their eyes.</span>"
|
||||
if(C.weakeyes)
|
||||
C.Stun(1)
|
||||
else
|
||||
outmsg = "<span class='warning'>You fail to blind [C] by shining [src] at their eyes!</span>"
|
||||
|
||||
//robots
|
||||
else if(isrobot(target))
|
||||
var/mob/living/silicon/S = target
|
||||
//20% chance to actually hit the sensors
|
||||
if(prob(effectchance * diode.rating))
|
||||
S.flash_eyes(affect_silicon = 1)
|
||||
S.Weaken(rand(5,10))
|
||||
S << "<span class='danger'>Your sensors were overloaded by a laser!</span>"
|
||||
outmsg = "<span class='notice'>You overload [S] by shining [src] at their sensors.</span>"
|
||||
add_logs(user, S, "shone in the sensors", src)
|
||||
else
|
||||
outmsg = "<span class='warning'>You fail to overload [S] by shining [src] at their sensors!</span>"
|
||||
|
||||
//cameras
|
||||
else if(istype(target, /obj/machinery/camera))
|
||||
var/obj/machinery/camera/C = target
|
||||
if(prob(effectchance * diode.rating))
|
||||
C.emp_act(1)
|
||||
outmsg = "<span class='notice'>You hit the lens of [C] with [src], temporarily disabling the camera!</span>"
|
||||
add_logs(user, C, "EMPed", src)
|
||||
else
|
||||
outmsg = "<span class='warning'>You miss the lens of [C] with [src]!</span>"
|
||||
|
||||
//laser pointer image
|
||||
icon_state = "pointer_[pointer_icon_state]"
|
||||
var/list/showto = list()
|
||||
for(var/mob/M in viewers(7,targloc))
|
||||
if(M.client)
|
||||
showto.Add(M.client)
|
||||
var/image/I = image('icons/obj/projectiles.dmi',targloc,pointer_icon_state,10)
|
||||
var/list/click_params = params2list(params)
|
||||
if(click_params)
|
||||
if(click_params["icon-x"])
|
||||
I.pixel_x = (text2num(click_params["icon-x"]) - 16)
|
||||
if(click_params["icon-y"])
|
||||
I.pixel_y = (text2num(click_params["icon-y"]) - 16)
|
||||
else
|
||||
I.pixel_x = target.pixel_x + rand(-5,5)
|
||||
I.pixel_y = target.pixel_y + rand(-5,5)
|
||||
|
||||
if(outmsg)
|
||||
user << outmsg
|
||||
else
|
||||
user << "<span class='info'>You point [src] at [target].</span>"
|
||||
|
||||
energy -= 1
|
||||
if(energy <= max_energy)
|
||||
if(!recharging)
|
||||
recharging = 1
|
||||
START_PROCESSING(SSobj, src)
|
||||
if(energy <= 0)
|
||||
user << "<span class='warning'>[src]'s battery is overused, it needs time to recharge!</span>"
|
||||
recharge_locked = 1
|
||||
|
||||
flick_overlay(I, showto, 10)
|
||||
icon_state = "pointer"
|
||||
|
||||
/obj/item/device/laser_pointer/process()
|
||||
if(prob(20 - recharge_locked*5))
|
||||
energy += 1
|
||||
if(energy >= max_energy)
|
||||
energy = max_energy
|
||||
recharging = 0
|
||||
recharge_locked = 0
|
||||
..()
|
||||
@@ -0,0 +1,264 @@
|
||||
|
||||
// Light Replacer (LR)
|
||||
//
|
||||
// ABOUT THE DEVICE
|
||||
//
|
||||
// This is a device supposedly to be used by Janitors and Janitor Cyborgs which will
|
||||
// allow them to easily replace lights. This was mostly designed for Janitor Cyborgs since
|
||||
// they don't have hands or a way to replace lightbulbs.
|
||||
//
|
||||
// HOW IT WORKS
|
||||
//
|
||||
// You attack a light fixture with it, if the light fixture is broken it will replace the
|
||||
// light fixture with a working light; the broken light is then placed on the floor for the
|
||||
// user to then pickup with a trash bag. If it's empty then it will just place a light in the fixture.
|
||||
//
|
||||
// HOW TO REFILL THE DEVICE
|
||||
//
|
||||
// It will need to be manually refilled with lights.
|
||||
// If it's part of a robot module, it will charge when the Robot is inside a Recharge Station.
|
||||
//
|
||||
// EMAGGED FEATURES
|
||||
//
|
||||
// NOTICE: The Cyborg cannot use the emagged Light Replacer and the light's explosion was nerfed. It cannot create holes in the station anymore.
|
||||
//
|
||||
// I'm not sure everyone will react the emag's features so please say what your opinions are of it.
|
||||
//
|
||||
// When emagged it will rig every light it replaces, which will explode when the light is on.
|
||||
// This is VERY noticable, even the device's name changes when you emag it so if anyone
|
||||
// examines you when you're holding it in your hand, you will be discovered.
|
||||
// It will also be very obvious who is setting all these lights off, since only Janitor Borgs and Janitors have easy
|
||||
// access to them, and only one of them can emag their device.
|
||||
//
|
||||
// The explosion cannot insta-kill anyone with 30% or more health.
|
||||
|
||||
#define LIGHT_OK 0
|
||||
#define LIGHT_EMPTY 1
|
||||
#define LIGHT_BROKEN 2
|
||||
#define LIGHT_BURNED 3
|
||||
|
||||
|
||||
/obj/item/device/lightreplacer
|
||||
|
||||
name = "light replacer"
|
||||
desc = "A device to automatically replace lights. Refill with broken or working lightbulbs, or sheets of glass."
|
||||
|
||||
icon = 'icons/obj/janitor.dmi'
|
||||
icon_state = "lightreplacer0"
|
||||
item_state = "electronic"
|
||||
|
||||
flags = CONDUCT
|
||||
slot_flags = SLOT_BELT
|
||||
origin_tech = "magnets=3;engineering=4"
|
||||
|
||||
var/max_uses = 20
|
||||
var/uses = 0
|
||||
var/emagged = 0
|
||||
var/failmsg = ""
|
||||
// How much to increase per each glass?
|
||||
var/increment = 5
|
||||
// How much to take from the glass?
|
||||
var/decrement = 1
|
||||
var/charge = 1
|
||||
|
||||
// Eating used bulbs gives us bulb shards
|
||||
var/bulb_shards = 0
|
||||
// when we get this many shards, we get a free bulb.
|
||||
var/shards_required = 4
|
||||
|
||||
/obj/item/device/lightreplacer/New()
|
||||
uses = max_uses / 2
|
||||
failmsg = "The [name]'s refill light blinks red."
|
||||
..()
|
||||
|
||||
/obj/item/device/lightreplacer/examine(mob/user)
|
||||
..()
|
||||
user << status_string()
|
||||
|
||||
/obj/item/device/lightreplacer/attackby(obj/item/W, mob/user, params)
|
||||
|
||||
if(istype(W, /obj/item/stack/sheet/glass))
|
||||
var/obj/item/stack/sheet/glass/G = W
|
||||
if(uses >= max_uses)
|
||||
user << "<span class='warning'>[src.name] is full.</span>"
|
||||
return
|
||||
else if(G.use(decrement))
|
||||
AddUses(increment)
|
||||
user << "<span class='notice'>You insert a piece of glass into the [src.name]. You have [uses] light\s remaining.</span>"
|
||||
return
|
||||
else
|
||||
user << "<span class='warning'>You need one sheet of glass to replace lights!</span>"
|
||||
|
||||
if(istype(W, /obj/item/weapon/light))
|
||||
var/new_bulbs = 0
|
||||
var/obj/item/weapon/light/L = W
|
||||
if(L.status == 0) // LIGHT OKAY
|
||||
if(uses < max_uses)
|
||||
if(!user.unEquip(W))
|
||||
return
|
||||
AddUses(1)
|
||||
qdel(L)
|
||||
else
|
||||
if(!user.unEquip(W))
|
||||
return
|
||||
new_bulbs += AddShards(1)
|
||||
qdel(L)
|
||||
if(new_bulbs != 0)
|
||||
playsound(src.loc, 'sound/machines/ding.ogg', 50, 1)
|
||||
user << "<span class='notice'>You insert the [L.name] into the [src.name]. " + status_string() + "</span>"
|
||||
return
|
||||
|
||||
if(istype(W, /obj/item/weapon/storage))
|
||||
var/obj/item/weapon/storage/S = W
|
||||
var/found_lightbulbs = FALSE
|
||||
var/replaced_something = TRUE
|
||||
|
||||
for(var/obj/item/I in S.contents)
|
||||
if(istype(I,/obj/item/weapon/light))
|
||||
var/obj/item/weapon/light/L = I
|
||||
found_lightbulbs = TRUE
|
||||
if(src.uses >= max_uses)
|
||||
break
|
||||
if(L.status == LIGHT_OK)
|
||||
replaced_something = TRUE
|
||||
AddUses(1)
|
||||
qdel(L)
|
||||
|
||||
else if(L.status == LIGHT_BROKEN || L.status == LIGHT_BURNED)
|
||||
replaced_something = TRUE
|
||||
AddShards(1)
|
||||
qdel(L)
|
||||
|
||||
if(!found_lightbulbs)
|
||||
user << "<span class='warning'>\The [S] contains no bulbs.</span>"
|
||||
return
|
||||
|
||||
if(!replaced_something && src.uses == max_uses)
|
||||
user << "<span class='warning'>\The [src] is full!</span>"
|
||||
return
|
||||
|
||||
user << "<span class='notice'>You fill \the [src] with lights from \the [S]. " + status_string() + "</span>"
|
||||
|
||||
/obj/item/device/lightreplacer/emag_act()
|
||||
if(!emagged)
|
||||
Emag()
|
||||
|
||||
/obj/item/device/lightreplacer/attack_self(mob/user)
|
||||
user << status_string()
|
||||
|
||||
|
||||
/obj/item/device/lightreplacer/update_icon()
|
||||
icon_state = "lightreplacer[emagged]"
|
||||
|
||||
/obj/item/device/lightreplacer/proc/status_string()
|
||||
return "It has [uses] light\s remaining (plus [bulb_shards] fragment\s)."
|
||||
|
||||
/obj/item/device/lightreplacer/proc/Use(mob/user)
|
||||
|
||||
playsound(src.loc, 'sound/machines/click.ogg', 50, 1)
|
||||
AddUses(-1)
|
||||
return 1
|
||||
|
||||
// Negative numbers will subtract
|
||||
/obj/item/device/lightreplacer/proc/AddUses(amount = 1)
|
||||
uses = Clamp(uses + amount, 0, max_uses)
|
||||
|
||||
/obj/item/device/lightreplacer/proc/AddShards(amount = 1)
|
||||
bulb_shards += amount
|
||||
var/new_bulbs = round(bulb_shards / shards_required)
|
||||
if(new_bulbs > 0)
|
||||
AddUses(new_bulbs)
|
||||
bulb_shards = bulb_shards % shards_required
|
||||
return new_bulbs
|
||||
|
||||
/obj/item/device/lightreplacer/proc/Charge(var/mob/user)
|
||||
charge += 1
|
||||
if(charge > 3)
|
||||
AddUses(1)
|
||||
charge = 1
|
||||
|
||||
/obj/item/device/lightreplacer/proc/ReplaceLight(obj/machinery/light/target, mob/living/U)
|
||||
|
||||
if(target.status != LIGHT_OK)
|
||||
if(CanUse(U))
|
||||
if(!Use(U)) return
|
||||
U << "<span class='notice'>You replace the [target.fitting] with \the [src].</span>"
|
||||
|
||||
if(target.status != LIGHT_EMPTY)
|
||||
var/new_bulbs = AddShards(1)
|
||||
if(new_bulbs != 0)
|
||||
U << "<span class='notice'>\The [src] has fabricated a new bulb from the broken bulbs it has stored. It now has [uses] uses.</span>"
|
||||
playsound(src.loc, 'sound/machines/ding.ogg', 50, 1)
|
||||
|
||||
target.status = LIGHT_EMPTY
|
||||
target.update()
|
||||
|
||||
var/obj/item/weapon/light/L2 = new target.light_type()
|
||||
|
||||
target.status = L2.status
|
||||
target.switchcount = L2.switchcount
|
||||
target.rigged = emagged
|
||||
target.brightness = L2.brightness
|
||||
target.on = target.has_power()
|
||||
target.update()
|
||||
qdel(L2)
|
||||
|
||||
if(target.on && target.rigged)
|
||||
target.explode()
|
||||
return
|
||||
|
||||
else
|
||||
U << failmsg
|
||||
return
|
||||
else
|
||||
U << "<span class='warning'>There is a working [target.fitting] already inserted!</span>"
|
||||
return
|
||||
|
||||
/obj/item/device/lightreplacer/proc/Emag()
|
||||
emagged = !emagged
|
||||
playsound(src.loc, "sparks", 100, 1)
|
||||
if(emagged)
|
||||
name = "shortcircuited [initial(name)]"
|
||||
else
|
||||
name = initial(name)
|
||||
update_icon()
|
||||
|
||||
//Can you use it?
|
||||
|
||||
/obj/item/device/lightreplacer/proc/CanUse(mob/living/user)
|
||||
src.add_fingerprint(user)
|
||||
//Not sure what else to check for. Maybe if clumsy?
|
||||
if(uses > 0)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
/obj/item/device/lightreplacer/afterattack(atom/T, mob/U, proximity)
|
||||
if(!proximity)
|
||||
return
|
||||
if(!isturf(T))
|
||||
return
|
||||
|
||||
var/used = FALSE
|
||||
for(var/atom/A in T)
|
||||
if(!CanUse(U))
|
||||
break
|
||||
used = TRUE
|
||||
if(istype(A, /obj/machinery/light))
|
||||
ReplaceLight(A, U)
|
||||
|
||||
if(!used)
|
||||
U << failmsg
|
||||
|
||||
/obj/item/device/lightreplacer/proc/janicart_insert(mob/user, obj/structure/janitorialcart/J)
|
||||
J.put_in_cart(src, user)
|
||||
J.myreplacer = src
|
||||
J.update_icon()
|
||||
|
||||
/obj/item/device/lightreplacer/cyborg/janicart_insert(mob/user, obj/structure/janitorialcart/J)
|
||||
return
|
||||
|
||||
#undef LIGHT_OK
|
||||
#undef LIGHT_EMPTY
|
||||
#undef LIGHT_BROKEN
|
||||
#undef LIGHT_BURNED
|
||||
@@ -0,0 +1,7 @@
|
||||
/obj/item/device/machineprototype
|
||||
name = "machine prototype"
|
||||
desc = "A complicated machine prototype. You have no idea how it works."
|
||||
icon = 'icons/obj/machineprototype.dmi'
|
||||
icon_state = "machineprototype"
|
||||
materials = list(MAT_METAL=1000, MAT_GLASS=500)
|
||||
origin_tech = "engineering=6"
|
||||
@@ -0,0 +1,74 @@
|
||||
/obj/item/device/megaphone
|
||||
name = "megaphone"
|
||||
desc = "A device used to project your voice. Loudly."
|
||||
icon_state = "megaphone"
|
||||
item_state = "radio"
|
||||
w_class = 2
|
||||
flags = FPRINT
|
||||
siemens_coefficient = 1
|
||||
|
||||
var/spamcheck = 0
|
||||
var/emagged = 0
|
||||
var/insults = 0
|
||||
var/voicespan = "command_headset" // sic
|
||||
var/list/insultmsg = list("FUCK EVERYONE!", "DEATH TO LIZARDS!", "ALL SECURITY TO SHOOT ME ON SIGHT!", "I HAVE A BOMB!", "CAPTAIN IS A COMDOM!", "FOR THE SYNDICATE!", "VIVA!", "HONK!")
|
||||
|
||||
/obj/item/device/megaphone/attack_self(mob/living/carbon/human/user)
|
||||
if(user.client)
|
||||
if(user.client.prefs.muted & MUTE_IC)
|
||||
src << "<span class='warning'>You cannot speak in IC (muted).</span>"
|
||||
return
|
||||
|
||||
if(!ishuman(user))
|
||||
user << "<span class='warning'>You don't know how to use this!</span>"
|
||||
return
|
||||
|
||||
if(spamcheck > world.time)
|
||||
user << "<span class='warning'>\The [src] needs to recharge!</span>"
|
||||
return
|
||||
|
||||
var/message = copytext(sanitize(input(user, "Shout a message?", "Megaphone", null) as text),1,MAX_MESSAGE_LEN)
|
||||
if(!message)
|
||||
return
|
||||
|
||||
message = capitalize(message)
|
||||
if(!user.can_speak(message))
|
||||
user << "<span class='warning'>You find yourself unable to speak at all!</span>"
|
||||
return
|
||||
|
||||
if ((src.loc == user && user.stat == 0))
|
||||
if(emagged)
|
||||
if(insults)
|
||||
user.say(pick(insultmsg),"machine", list(voicespan))
|
||||
insults--
|
||||
else
|
||||
user << "<span class='warning'>*BZZZZzzzzzt*</span>"
|
||||
else
|
||||
user.say(message,"machine", list(voicespan))
|
||||
|
||||
playsound(loc, 'sound/items/megaphone.ogg', 100, 0, 1)
|
||||
spamcheck = world.time + 50
|
||||
return
|
||||
|
||||
/obj/item/device/megaphone/emag_act(mob/user)
|
||||
user << "<span class='warning'>You overload \the [src]'s voice synthesizer.</span>"
|
||||
emagged = 1
|
||||
insults = rand(1, 3) //to prevent dickflooding
|
||||
|
||||
/obj/item/device/megaphone/sec
|
||||
name = "security megaphone"
|
||||
icon_state = "megaphone-sec"
|
||||
|
||||
/obj/item/device/megaphone/command
|
||||
name = "command megaphone"
|
||||
icon_state = "megaphone-command"
|
||||
|
||||
/obj/item/device/megaphone/cargo
|
||||
name = "supply megaphone"
|
||||
icon_state = "megaphone-cargo"
|
||||
|
||||
/obj/item/device/megaphone/clown
|
||||
name = "clown's megaphone"
|
||||
desc = "Something that should not exist."
|
||||
icon_state = "megaphone-clown"
|
||||
voicespan = "clown"
|
||||
@@ -0,0 +1,35 @@
|
||||
/obj/item/modkit
|
||||
name = "modification kit"
|
||||
desc = "A one-use kit, which enables kinetic accelerators to retain their \
|
||||
charge when away from a bioelectric source, renders them immune to \
|
||||
interference with other accelerators, as well as allowing less \
|
||||
dextrous races to use the tool."
|
||||
icon = 'icons/obj/objects.dmi'
|
||||
icon_state = "modkit"
|
||||
origin_tech = "programming=2;materials=2;magnets=4"
|
||||
var/uses = 1
|
||||
|
||||
/obj/item/modkit/afterattack(obj/item/weapon/gun/energy/kinetic_accelerator/C, mob/user)
|
||||
..()
|
||||
if(!uses)
|
||||
qdel(src)
|
||||
return
|
||||
if(!istype(C))
|
||||
user << "<span class='warning'>This kit can only modify kinetic \
|
||||
accelerators!</span>"
|
||||
return ..()
|
||||
// RIP the 'improved improved improved improved kinetic accelerator
|
||||
if(C.holds_charge && C.unique_frequency)
|
||||
user << "<span class='warning'>This kinetic accelerator already has \
|
||||
these upgrades.</span>"
|
||||
return ..()
|
||||
|
||||
user <<"<span class='notice'>You modify the [C], adjusting the trigger \
|
||||
guard and internal capacitor.</span>"
|
||||
C.name = "improved [C.name]"
|
||||
C.holds_charge = TRUE
|
||||
C.unique_frequency = TRUE
|
||||
C.trigger_guard = TRIGGER_GUARD_ALLOW_ALL
|
||||
uses--
|
||||
if(!uses)
|
||||
qdel(src)
|
||||
@@ -0,0 +1,92 @@
|
||||
#define PROXIMITY_NONE ""
|
||||
#define PROXIMITY_ON_SCREEN "_red"
|
||||
#define PROXIMITY_NEAR "_yellow"
|
||||
|
||||
/**
|
||||
* Multitool -- A multitool is used for hacking electronic devices.
|
||||
* TO-DO -- Using it as a power measurement tool for cables etc. Nannek.
|
||||
*
|
||||
*/
|
||||
|
||||
/obj/item/device/multitool
|
||||
name = "multitool"
|
||||
desc = "Used for pulsing wires to test which to cut. Not recommended by doctors."
|
||||
icon_state = "multitool"
|
||||
force = 5
|
||||
w_class = 2
|
||||
throwforce = 0
|
||||
throw_range = 7
|
||||
throw_speed = 3
|
||||
materials = list(MAT_METAL=50, MAT_GLASS=20)
|
||||
origin_tech = "magnets=1;engineering=2"
|
||||
var/obj/machinery/buffer // simple machine buffer for device linkage
|
||||
hitsound = 'sound/weapons/tap.ogg'
|
||||
toolspeed = 1
|
||||
|
||||
|
||||
// Syndicate device disguised as a multitool; it will turn red when an AI camera is nearby.
|
||||
|
||||
|
||||
/obj/item/device/multitool/ai_detect
|
||||
var/track_cooldown = 0
|
||||
var/track_delay = 10 //How often it checks for proximity
|
||||
var/detect_state = PROXIMITY_NONE
|
||||
var/rangealert = 8 //Glows red when inside
|
||||
var/rangewarning = 20 //Glows yellow when inside
|
||||
origin_tech = "magnets=1;engineering=2;syndicate=1"
|
||||
|
||||
/obj/item/device/multitool/ai_detect/New()
|
||||
..()
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/device/multitool/ai_detect/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return ..()
|
||||
|
||||
/obj/item/device/multitool/ai_detect/process()
|
||||
if(track_cooldown > world.time)
|
||||
return
|
||||
detect_state = PROXIMITY_NONE
|
||||
multitool_detect()
|
||||
icon_state = "[initial(icon_state)][detect_state]"
|
||||
track_cooldown = world.time + track_delay
|
||||
|
||||
/obj/item/device/multitool/ai_detect/proc/multitool_detect()
|
||||
var/turf/our_turf = get_turf(src)
|
||||
for(var/mob/living/silicon/ai/AI in ai_list)
|
||||
if(AI.cameraFollow == src)
|
||||
detect_state = PROXIMITY_ON_SCREEN
|
||||
break
|
||||
|
||||
if(!detect_state && cameranet.chunkGenerated(our_turf.x, our_turf.y, our_turf.z))
|
||||
var/datum/camerachunk/chunk = cameranet.getCameraChunk(our_turf.x, our_turf.y, our_turf.z)
|
||||
if(chunk)
|
||||
if(chunk.seenby.len)
|
||||
for(var/mob/camera/aiEye/A in chunk.seenby)
|
||||
var/turf/detect_turf = get_turf(A)
|
||||
if(get_dist(our_turf, detect_turf) < rangealert)
|
||||
detect_state = PROXIMITY_ON_SCREEN
|
||||
break
|
||||
if(get_dist(our_turf, detect_turf) < rangewarning)
|
||||
detect_state = PROXIMITY_NEAR
|
||||
break
|
||||
|
||||
/obj/item/device/multitool/ai_detect/admin
|
||||
desc = "Used for pulsing wires to test which to cut. Not recommended by doctors. Has a strange tag that says 'Grief in Safety'" //What else should I say for a meme item?
|
||||
track_delay = 5
|
||||
|
||||
/obj/item/device/multitool/ai_detect/admin/multitool_detect()
|
||||
var/turf/our_turf = get_turf(src)
|
||||
for(var/mob/J in urange(rangewarning,our_turf))
|
||||
if(admin_datums[J.ckey])
|
||||
detect_state = PROXIMITY_NEAR
|
||||
var/turf/detect_turf = get_turf(J)
|
||||
if(get_dist(our_turf, detect_turf) < rangealert)
|
||||
detect_state = PROXIMITY_ON_SCREEN
|
||||
break
|
||||
|
||||
/obj/item/device/multitool/cyborg
|
||||
name = "multitool"
|
||||
desc = "Optimised and stripped-down version of a regular multitool."
|
||||
icon = 'icons/obj/items_cyborg.dmi'
|
||||
toolspeed = 2
|
||||
@@ -0,0 +1,140 @@
|
||||
/obj/item/device/paicard
|
||||
name = "personal AI device"
|
||||
icon = 'icons/obj/aicards.dmi'
|
||||
icon_state = "pai"
|
||||
item_state = "electronic"
|
||||
w_class = 2
|
||||
slot_flags = SLOT_BELT
|
||||
origin_tech = "programming=2"
|
||||
var/obj/item/device/radio/radio
|
||||
var/looking_for_personality = 0
|
||||
var/mob/living/silicon/pai/pai
|
||||
|
||||
/obj/item/device/paicard/New()
|
||||
..()
|
||||
add_overlay("pai-off")
|
||||
|
||||
/obj/item/device/paicard/Destroy()
|
||||
//Will stop people throwing friend pAIs into the singularity so they can respawn
|
||||
if(!isnull(pai))
|
||||
pai.death(0)
|
||||
return ..()
|
||||
|
||||
/obj/item/device/paicard/attack_self(mob/user)
|
||||
if (!in_range(src, user))
|
||||
return
|
||||
user.set_machine(src)
|
||||
var/dat = "<TT><B>Personal AI Device</B><BR>"
|
||||
if(pai && (!pai.master_dna || !pai.master))
|
||||
dat += "<a href='byond://?src=\ref[src];setdna=1'>Imprint Master DNA</a><br>"
|
||||
if(pai)
|
||||
dat += "Installed Personality: [pai.name]<br>"
|
||||
dat += "Prime directive: <br>[pai.laws.zeroth]<br>"
|
||||
for(var/slaws in pai.laws.supplied)
|
||||
dat += "Additional directives: <br>[slaws]<br>"
|
||||
dat += "<a href='byond://?src=\ref[src];setlaws=1'>Configure Directives</a><br>"
|
||||
dat += "<br>"
|
||||
dat += "<h3>Device Settings</h3><br>"
|
||||
if(radio)
|
||||
dat += "<b>Radio Uplink</b><br>"
|
||||
dat += "Transmit: <A href='byond://?src=\ref[src];wires=[WIRE_TX]'>[(radio.wires.is_cut(WIRE_TX)) ? "Disabled" : "Enabled"]</A><br>"
|
||||
dat += "Receive: <A href='byond://?src=\ref[src];wires=[WIRE_RX]'>[(radio.wires.is_cut(WIRE_RX)) ? "Disabled" : "Enabled"]</A><br>"
|
||||
else
|
||||
dat += "<b>Radio Uplink</b><br>"
|
||||
dat += "<font color=red><i>Radio firmware not loaded. Please install a pAI personality to load firmware.</i></font><br>"
|
||||
dat += "<A href='byond://?src=\ref[src];wipe=1'>\[Wipe current pAI personality\]</a><br>"
|
||||
else
|
||||
if(looking_for_personality)
|
||||
dat += "Searching for a personality..."
|
||||
dat += "<A href='byond://?src=\ref[src];request=1'>\[View available personalities\]</a><br>"
|
||||
else
|
||||
dat += "No personality is installed.<br>"
|
||||
dat += "<A href='byond://?src=\ref[src];request=1'>\[Request personal AI personality\]</a><br>"
|
||||
dat += "Each time this button is pressed, a request will be sent out to any available personalities. Check back often and give a lot of time for personalities to respond. This process could take anywhere from 15 seconds to several minutes, depending on the available personalities' timeliness."
|
||||
user << browse(dat, "window=paicard")
|
||||
onclose(user, "paicard")
|
||||
return
|
||||
|
||||
/obj/item/device/paicard/Topic(href, href_list)
|
||||
|
||||
if(!usr || usr.stat)
|
||||
return
|
||||
|
||||
if(href_list["request"])
|
||||
src.looking_for_personality = 1
|
||||
SSpai.findPAI(src, usr)
|
||||
|
||||
if(pai)
|
||||
if(href_list["setdna"])
|
||||
if(pai.master_dna)
|
||||
return
|
||||
if(!istype(usr, /mob/living/carbon))
|
||||
usr << "<span class='warning'>You don't have any DNA, or your DNA is incompatible with this device!</span>"
|
||||
else
|
||||
var/mob/living/carbon/M = usr
|
||||
pai.master = M.real_name
|
||||
pai.master_dna = M.dna.unique_enzymes
|
||||
pai << "<span class='notice'>You have been bound to a new master.</span>"
|
||||
if(href_list["wipe"])
|
||||
var/confirm = input("Are you CERTAIN you wish to delete the current personality? This action cannot be undone.", "Personality Wipe") in list("Yes", "No")
|
||||
if(confirm == "Yes")
|
||||
if(pai)
|
||||
pai << "<span class='warning'>You feel yourself slipping away from reality.</span>"
|
||||
pai << "<span class='danger'>Byte by byte you lose your sense of self.</span>"
|
||||
pai << "<span class='userdanger'>Your mental faculties leave you.</span>"
|
||||
pai << "<span class='rose'>oblivion... </span>"
|
||||
pai.death(0)
|
||||
removePersonality()
|
||||
if(href_list["wires"])
|
||||
var/wire = text2num(href_list["wires"])
|
||||
if(radio)
|
||||
radio.wires.cut(wire)
|
||||
if(href_list["setlaws"])
|
||||
var/newlaws = copytext(sanitize(input("Enter any additional directives you would like your pAI personality to follow. Note that these directives will not override the personality's allegiance to its imprinted master. Conflicting directives will be ignored.", "pAI Directive Configuration", pai.laws.supplied[1]) as message),1,MAX_MESSAGE_LEN)
|
||||
if(newlaws && pai)
|
||||
pai.add_supplied_law(0,newlaws)
|
||||
pai << "Your supplemental directives have been updated. Your new directives are:"
|
||||
pai << "Prime Directive : <br>[pai.laws.zeroth]"
|
||||
for(var/slaws in pai.laws.supplied)
|
||||
pai << "Supplemental Directives: <br>[slaws]"
|
||||
attack_self(usr)
|
||||
|
||||
// WIRE_SIGNAL = 1
|
||||
// WIRE_RECEIVE = 2
|
||||
// WIRE_TRANSMIT = 4
|
||||
|
||||
/obj/item/device/paicard/proc/setPersonality(mob/living/silicon/pai/personality)
|
||||
src.pai = personality
|
||||
src.add_overlay("pai-null")
|
||||
|
||||
playsound(loc, 'sound/effects/pai_boot.ogg', 50, 1, -1)
|
||||
audible_message("\The [src] plays a cheerful startup noise!")
|
||||
|
||||
/obj/item/device/paicard/proc/removePersonality()
|
||||
src.pai = null
|
||||
src.cut_overlays()
|
||||
src.add_overlay("pai-off")
|
||||
|
||||
/obj/item/device/paicard/proc/setEmotion(emotion)
|
||||
if(pai)
|
||||
src.cut_overlays()
|
||||
switch(emotion)
|
||||
if(1) src.add_overlay("pai-happy")
|
||||
if(2) src.add_overlay("pai-cat")
|
||||
if(3) src.add_overlay("pai-extremely-happy")
|
||||
if(4) src.add_overlay("pai-face")
|
||||
if(5) src.add_overlay("pai-laugh")
|
||||
if(6) src.add_overlay("pai-off")
|
||||
if(7) src.add_overlay("pai-sad")
|
||||
if(8) src.add_overlay("pai-angry")
|
||||
if(9) src.add_overlay("pai-what")
|
||||
if(10) src.add_overlay("pai-null")
|
||||
|
||||
/obj/item/device/paicard/proc/alertUpdate()
|
||||
visible_message("<span class ='info'>[src] flashes a message across its screen, \"Additional personalities available for download.\"", "<span class='notice'>[src] bleeps electronically.</span>")
|
||||
|
||||
/obj/item/device/paicard/emp_act(severity)
|
||||
if(pai)
|
||||
pai.emp_act(severity)
|
||||
..()
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
/obj/item/device/pipe_painter
|
||||
name = "pipe painter"
|
||||
icon = 'icons/obj/bureaucracy.dmi'
|
||||
icon_state = "labeler1"
|
||||
item_state = "flight"
|
||||
flags = NOBLUDGEON
|
||||
var/list/modes = list(
|
||||
"grey" = rgb(255,255,255),
|
||||
"red" = rgb(255,0,0),
|
||||
"blue" = rgb(0,0,255),
|
||||
"cyan" = rgb(0,256,249),
|
||||
"green" = rgb(30,255,0),
|
||||
"yellow" = rgb(255,198,0),
|
||||
"purple" = rgb(130,43,255)
|
||||
)
|
||||
var/mode = "grey"
|
||||
|
||||
materials = list(MAT_METAL=5000, MAT_GLASS=2000)
|
||||
|
||||
/obj/item/device/pipe_painter/afterattack(atom/A, mob/user, proximity_flag)
|
||||
//Make sure we only paint adjacent items
|
||||
if(!proximity_flag)
|
||||
return
|
||||
|
||||
if(!istype(A,/obj/machinery/atmospherics/pipe))
|
||||
return
|
||||
|
||||
var/obj/machinery/atmospherics/pipe/P = A
|
||||
P.color = modes[mode]
|
||||
P.pipe_color = modes[mode]
|
||||
P.stored.color = modes[mode]
|
||||
user.visible_message("<span class='notice'>[user] paints \the [P] [mode].</span>","<span class='notice'>You paint \the [P] [mode].</span>")
|
||||
P.update_node_icon() //updates the neighbors
|
||||
|
||||
/obj/item/device/pipe_painter/attack_self(mob/user)
|
||||
mode = input("Which colour do you want to use?","Pipe painter") in modes
|
||||
|
||||
/obj/item/device/pipe_painter/examine()
|
||||
..()
|
||||
usr << "It is set to [mode]."
|
||||
@@ -0,0 +1,145 @@
|
||||
// Powersink - used to drain station power
|
||||
|
||||
/obj/item/device/powersink
|
||||
desc = "A nulling power sink which drains energy from electrical systems."
|
||||
name = "power sink"
|
||||
icon_state = "powersink0"
|
||||
item_state = "electronic"
|
||||
w_class = 4
|
||||
flags = CONDUCT
|
||||
throwforce = 5
|
||||
throw_speed = 1
|
||||
throw_range = 2
|
||||
materials = list(MAT_METAL=750)
|
||||
origin_tech = "powerstorage=5;syndicate=5"
|
||||
var/drain_rate = 1600000 // amount of power to drain per tick
|
||||
var/power_drained = 0 // has drained this much power
|
||||
var/max_power = 1e10 // maximum power that can be drained before exploding
|
||||
var/mode = 0 // 0 = off, 1=clamped (off), 2=operating
|
||||
var/admins_warned = 0 // stop spam, only warn the admins once that we are about to boom
|
||||
|
||||
var/const/DISCONNECTED = 0
|
||||
var/const/CLAMPED_OFF = 1
|
||||
var/const/OPERATING = 2
|
||||
|
||||
var/obj/structure/cable/attached // the attached cable
|
||||
|
||||
/obj/item/device/powersink/update_icon()
|
||||
icon_state = "powersink[mode == OPERATING]"
|
||||
|
||||
/obj/item/device/powersink/proc/set_mode(value)
|
||||
if(value == mode)
|
||||
return
|
||||
switch(value)
|
||||
if(DISCONNECTED)
|
||||
attached = null
|
||||
if(mode == OPERATING)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
anchored = 0
|
||||
|
||||
if(CLAMPED_OFF)
|
||||
if(!attached)
|
||||
return
|
||||
if(mode == OPERATING)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
anchored = 1
|
||||
|
||||
if(OPERATING)
|
||||
if(!attached)
|
||||
return
|
||||
START_PROCESSING(SSobj, src)
|
||||
anchored = 1
|
||||
|
||||
mode = value
|
||||
update_icon()
|
||||
SetLuminosity(0)
|
||||
|
||||
/obj/item/device/powersink/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/weapon/screwdriver))
|
||||
if(mode == DISCONNECTED)
|
||||
var/turf/T = loc
|
||||
if(isturf(T) && !T.intact)
|
||||
attached = locate() in T
|
||||
if(!attached)
|
||||
user << "<span class='warning'>This device must be placed over an exposed, powered cable node!</span>"
|
||||
else
|
||||
set_mode(CLAMPED_OFF)
|
||||
user.visible_message( \
|
||||
"[user] attaches \the [src] to the cable.", \
|
||||
"<span class='notice'>You attach \the [src] to the cable.</span>",
|
||||
"<span class='italics'>You hear some wires being connected to something.</span>")
|
||||
else
|
||||
user << "<span class='warning'>This device must be placed over an exposed, powered cable node!</span>"
|
||||
else
|
||||
set_mode(DISCONNECTED)
|
||||
user.visible_message( \
|
||||
"[user] detaches \the [src] from the cable.", \
|
||||
"<span class='notice'>You detach \the [src] from the cable.</span>",
|
||||
"<span class='italics'>You hear some wires being disconnected from something.</span>")
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/device/powersink/attack_paw()
|
||||
return
|
||||
|
||||
/obj/item/device/powersink/attack_ai()
|
||||
return
|
||||
|
||||
/obj/item/device/powersink/attack_hand(mob/user)
|
||||
switch(mode)
|
||||
if(DISCONNECTED)
|
||||
..()
|
||||
|
||||
if(CLAMPED_OFF)
|
||||
user.visible_message( \
|
||||
"[user] activates \the [src]!", \
|
||||
"<span class='notice'>You activate \the [src].</span>",
|
||||
"<span class='italics'>You hear a click.</span>")
|
||||
message_admins("Power sink activated by [key_name_admin(user)](<A HREF='?_src_=holder;adminmoreinfo=\ref[user]'>?</A>) (<A HREF='?_src_=holder;adminplayerobservefollow=\ref[user]'>FLW</A>) at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>)")
|
||||
log_game("Power sink activated by [key_name(user)] at ([x],[y],[z])")
|
||||
set_mode(OPERATING)
|
||||
|
||||
if(OPERATING)
|
||||
user.visible_message( \
|
||||
"[user] deactivates \the [src]!", \
|
||||
"<span class='notice'>You deactivate \the [src].</span>",
|
||||
"<span class='italics'>You hear a click.</span>")
|
||||
set_mode(CLAMPED_OFF)
|
||||
|
||||
/obj/item/device/powersink/process()
|
||||
if(!attached)
|
||||
set_mode(DISCONNECTED)
|
||||
return
|
||||
|
||||
var/datum/powernet/PN = attached.powernet
|
||||
if(PN)
|
||||
SetLuminosity(5)
|
||||
|
||||
// found a powernet, so drain up to max power from it
|
||||
|
||||
var/drained = min ( drain_rate, PN.avail )
|
||||
PN.load += drained
|
||||
power_drained += drained
|
||||
|
||||
// if tried to drain more than available on powernet
|
||||
// now look for APCs and drain their cells
|
||||
if(drained < drain_rate)
|
||||
for(var/obj/machinery/power/terminal/T in PN.nodes)
|
||||
if(istype(T.master, /obj/machinery/power/apc))
|
||||
var/obj/machinery/power/apc/A = T.master
|
||||
if(A.operating && A.cell)
|
||||
A.cell.charge = max(0, A.cell.charge - 50)
|
||||
power_drained += 50
|
||||
if(A.charging == 2) // If the cell was full
|
||||
A.charging = 1 // It's no longer full
|
||||
|
||||
if(power_drained > max_power * 0.98)
|
||||
if (!admins_warned)
|
||||
admins_warned = 1
|
||||
message_admins("Power sink at ([x],[y],[z] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>JMP</a>) is 95% full. Explosion imminent.")
|
||||
playsound(src, 'sound/effects/screech.ogg', 100, 1, 1)
|
||||
|
||||
if(power_drained >= max_power)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
explosion(src.loc, 4,8,16,32)
|
||||
qdel(src)
|
||||
@@ -0,0 +1,33 @@
|
||||
/obj/item/device/radio/beacon
|
||||
name = "tracking beacon"
|
||||
desc = "A beacon used by a teleporter."
|
||||
icon_state = "beacon"
|
||||
item_state = "beacon"
|
||||
var/code = "electronic"
|
||||
origin_tech = "bluespace=1"
|
||||
dog_fashion = null
|
||||
|
||||
/obj/item/device/radio/beacon/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, list/spans)
|
||||
return
|
||||
|
||||
/obj/item/device/radio/beacon/send_hear()
|
||||
return null
|
||||
|
||||
|
||||
/obj/item/device/radio/beacon/verb/alter_signal(t as text)
|
||||
set name = "Alter Beacon's Signal"
|
||||
set category = "Object"
|
||||
set src in usr
|
||||
|
||||
if ((usr.canmove && !( usr.restrained() )))
|
||||
src.code = t
|
||||
if (!( src.code ))
|
||||
src.code = "beacon"
|
||||
src.add_fingerprint(usr)
|
||||
return
|
||||
|
||||
/*
|
||||
//Probably a better way of doing this, I'm lazy.
|
||||
/obj/item/device/radio/beacon/bacon/proc/digest_delay()
|
||||
spawn(600)
|
||||
qdel(src)*/ //Bacon beacons are no more rip in peace
|
||||
@@ -0,0 +1,147 @@
|
||||
/obj/item/device/electropack
|
||||
name = "electropack"
|
||||
desc = "Dance my monkeys! DANCE!!!"
|
||||
icon = 'icons/obj/radio.dmi'
|
||||
icon_state = "electropack0"
|
||||
item_state = "electropack"
|
||||
flags = CONDUCT
|
||||
slot_flags = SLOT_BACK
|
||||
w_class = 5
|
||||
materials = list(MAT_METAL=10000, MAT_GLASS=2500)
|
||||
var/on = 1
|
||||
var/code = 2
|
||||
var/frequency = 1449
|
||||
var/shock_cooldown = 0
|
||||
|
||||
/obj/item/device/electropack/suicide_act(mob/user)
|
||||
user.visible_message("<span class='suicide'>[user] hooks \himself to the electropack and spams the trigger! It looks like \he's trying to commit suicide..</span>")
|
||||
return (FIRELOSS)
|
||||
|
||||
/obj/item/device/electropack/initialize()
|
||||
if(SSradio)
|
||||
SSradio.add_object(src, frequency, RADIO_CHAT)
|
||||
|
||||
/obj/item/device/electropack/Destroy()
|
||||
if(SSradio)
|
||||
SSradio.remove_object(src, frequency)
|
||||
return ..()
|
||||
|
||||
/obj/item/device/electropack/attack_hand(mob/user)
|
||||
if(iscarbon(user))
|
||||
var/mob/living/carbon/C = user
|
||||
if(src == C.back)
|
||||
user << "<span class='warning'>You need help taking this off!</span>"
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/device/electropack/attackby(obj/item/weapon/W, mob/user, params)
|
||||
if(istype(W, /obj/item/clothing/head/helmet))
|
||||
var/obj/item/assembly/shock_kit/A = new /obj/item/assembly/shock_kit( user )
|
||||
A.icon = 'icons/obj/assemblies.dmi'
|
||||
|
||||
if(!user.unEquip(W))
|
||||
user << "<span class='warning'>\the [W] is stuck to your hand, you cannot attach it to \the [src]!</span>"
|
||||
return
|
||||
W.loc = A
|
||||
W.master = A
|
||||
A.part1 = W
|
||||
|
||||
user.unEquip(src)
|
||||
loc = A
|
||||
master = A
|
||||
A.part2 = src
|
||||
|
||||
user.put_in_hands(A)
|
||||
A.add_fingerprint(user)
|
||||
if(src.flags & NODROP)
|
||||
A.flags |= NODROP
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/device/electropack/Topic(href, href_list)
|
||||
//..()
|
||||
var/mob/living/carbon/C = usr
|
||||
if(usr.stat || usr.restrained() || C.back == src)
|
||||
return
|
||||
if(((istype(usr, /mob/living/carbon/human) && ((!( ticker ) || (ticker && ticker.mode != "monkey")) && usr.contents.Find(src))) || (usr.contents.Find(master) || (in_range(src, usr) && istype(loc, /turf)))))
|
||||
usr.set_machine(src)
|
||||
if(href_list["freq"])
|
||||
SSradio.remove_object(src, frequency)
|
||||
frequency = sanitize_frequency(frequency + text2num(href_list["freq"]))
|
||||
SSradio.add_object(src, frequency, RADIO_CHAT)
|
||||
else
|
||||
if(href_list["code"])
|
||||
code += text2num(href_list["code"])
|
||||
code = round(code)
|
||||
code = min(100, code)
|
||||
code = max(1, code)
|
||||
else
|
||||
if(href_list["power"])
|
||||
on = !( on )
|
||||
icon_state = "electropack[on]"
|
||||
if(!( master ))
|
||||
if(istype(loc, /mob))
|
||||
attack_self(loc)
|
||||
else
|
||||
for(var/mob/M in viewers(1, src))
|
||||
if(M.client)
|
||||
attack_self(M)
|
||||
else
|
||||
if(istype(master.loc, /mob))
|
||||
attack_self(master.loc)
|
||||
else
|
||||
for(var/mob/M in viewers(1, master))
|
||||
if(M.client)
|
||||
attack_self(M)
|
||||
else
|
||||
usr << browse(null, "window=radio")
|
||||
return
|
||||
return
|
||||
|
||||
/obj/item/device/electropack/receive_signal(datum/signal/signal)
|
||||
if(!signal || signal.encryption != code)
|
||||
return
|
||||
|
||||
if(ismob(loc) && on)
|
||||
if(shock_cooldown != 0)
|
||||
return
|
||||
shock_cooldown = 1
|
||||
spawn(100)
|
||||
shock_cooldown = 0
|
||||
var/mob/M = loc
|
||||
step(M, pick(cardinal))
|
||||
|
||||
M << "<span class='danger'>You feel a sharp shock!</span>"
|
||||
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
|
||||
s.set_up(3, 1, M)
|
||||
s.start()
|
||||
|
||||
M.Weaken(5)
|
||||
|
||||
if(master)
|
||||
master.receive_signal()
|
||||
return
|
||||
|
||||
/obj/item/device/electropack/attack_self(mob/user)
|
||||
|
||||
if(!istype(user, /mob/living/carbon/human))
|
||||
return
|
||||
user.set_machine(src)
|
||||
var/dat = {"<TT>Turned [on ? "On" : "Off"] -
|
||||
<A href='?src=\ref[src];power=1'>Toggle</A><BR>
|
||||
<B>Frequency/Code</B> for electropack:<BR>
|
||||
Frequency:
|
||||
<A href='byond://?src=\ref[src];freq=-10'>-</A>
|
||||
<A href='byond://?src=\ref[src];freq=-2'>-</A> [format_frequency(frequency)]
|
||||
<A href='byond://?src=\ref[src];freq=2'>+</A>
|
||||
<A href='byond://?src=\ref[src];freq=10'>+</A><BR>
|
||||
|
||||
Code:
|
||||
<A href='byond://?src=\ref[src];code=-5'>-</A>
|
||||
<A href='byond://?src=\ref[src];code=-1'>-</A> [code]
|
||||
<A href='byond://?src=\ref[src];code=1'>+</A>
|
||||
<A href='byond://?src=\ref[src];code=5'>+</A><BR>
|
||||
</TT>"}
|
||||
user << browse(dat, "window=radio")
|
||||
onclose(user, "radio")
|
||||
return
|
||||
@@ -0,0 +1,129 @@
|
||||
|
||||
/obj/item/device/encryptionkey/
|
||||
name = "standard encryption key"
|
||||
desc = "An encryption key for a radio headset. Has no special codes in it. WHY DOES IT EXIST? ASK NANOTRASEN."
|
||||
icon = 'icons/obj/radio.dmi'
|
||||
icon_state = "cypherkey"
|
||||
w_class = 1
|
||||
origin_tech = "engineering=2;bluespace=1"
|
||||
var/translate_binary = 0
|
||||
var/translate_hive = 0
|
||||
var/syndie = 0
|
||||
var/centcom = 0
|
||||
var/list/channels = list()
|
||||
|
||||
/obj/item/device/encryptionkey/syndicate
|
||||
icon_state = "cypherkey"
|
||||
channels = list("Syndicate" = 1)
|
||||
origin_tech = "syndicate=1;engineering=3;bluespace=2"
|
||||
syndie = 1//Signifies that it de-crypts Syndicate transmissions
|
||||
|
||||
/obj/item/device/encryptionkey/binary
|
||||
name = "binary translator key"
|
||||
desc = "An encryption key for a radio headset. To access the binary channel, use :b."
|
||||
icon_state = "cypherkey"
|
||||
translate_binary = 1
|
||||
origin_tech = "syndicate=3;engineering=4;bluespace=3"
|
||||
|
||||
/obj/item/device/encryptionkey/headset_sec
|
||||
name = "security radio encryption key"
|
||||
desc = "An encryption key for a radio headset. To access the security channel, use :s."
|
||||
icon_state = "sec_cypherkey"
|
||||
channels = list("Security" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/headset_eng
|
||||
name = "engineering radio encryption key"
|
||||
desc = "An encryption key for a radio headset. To access the engineering channel, use :e."
|
||||
icon_state = "eng_cypherkey"
|
||||
channels = list("Engineering" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/headset_rob
|
||||
name = "robotics radio encryption key"
|
||||
desc = "An encryption key for a radio headset. To access the engineering channel, use :e. For research, use :n."
|
||||
icon_state = "rob_cypherkey"
|
||||
channels = list("Science" = 1, "Engineering" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/headset_med
|
||||
name = "medical radio encryption key"
|
||||
desc = "An encryption key for a radio headset. To access the medical channel, use :m."
|
||||
icon_state = "med_cypherkey"
|
||||
channels = list("Medical" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/headset_sci
|
||||
name = "science radio encryption key"
|
||||
desc = "An encryption key for a radio headset. To access the science channel, use :n."
|
||||
icon_state = "sci_cypherkey"
|
||||
channels = list("Science" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/headset_medsci
|
||||
name = "medical research radio encryption key"
|
||||
desc = "An encryption key for a radio headset. To access the medical channel, use :m. For science, use :n."
|
||||
icon_state = "medsci_cypherkey"
|
||||
channels = list("Science" = 1, "Medical" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/headset_com
|
||||
name = "command radio encryption key"
|
||||
desc = "An encryption key for a radio headset. To access the command channel, use :c."
|
||||
icon_state = "com_cypherkey"
|
||||
channels = list("Command" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/heads/captain
|
||||
name = "\proper the captain's encryption key"
|
||||
desc = "An encryption key for a radio headset. Channels are as follows: :c - command, :s - security, :e - engineering, :u - supply, :v - service, :m - medical, :n - science."
|
||||
icon_state = "cap_cypherkey"
|
||||
channels = list("Command" = 1, "Security" = 1, "Engineering" = 0, "Science" = 0, "Medical" = 0, "Supply" = 0, "Service" = 0)
|
||||
|
||||
/obj/item/device/encryptionkey/heads/rd
|
||||
name = "\proper the research director's encryption key"
|
||||
desc = "An encryption key for a radio headset. To access the science channel, use :n. For command, use :c."
|
||||
icon_state = "rd_cypherkey"
|
||||
channels = list("Science" = 1, "Command" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/heads/hos
|
||||
name = "\proper the head of security's encryption key"
|
||||
desc = "An encryption key for a radio headset. To access the security channel, use :s. For command, use :c."
|
||||
icon_state = "hos_cypherkey"
|
||||
channels = list("Security" = 1, "Command" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/heads/ce
|
||||
name = "\proper the chief engineer's encryption key"
|
||||
desc = "An encryption key for a radio headset. To access the engineering channel, use :e. For command, use :c."
|
||||
icon_state = "ce_cypherkey"
|
||||
channels = list("Engineering" = 1, "Command" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/heads/cmo
|
||||
name = "\proper the chief medical officer's encryption key"
|
||||
desc = "An encryption key for a radio headset. To access the medical channel, use :m. For command, use :c."
|
||||
icon_state = "cmo_cypherkey"
|
||||
channels = list("Medical" = 1, "Command" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/heads/hop
|
||||
name = "\proper the head of personnel's encryption key"
|
||||
desc = "An encryption key for a radio headset. Channels are as follows: :u - supply, :v - service, :c - command."
|
||||
icon_state = "hop_cypherkey"
|
||||
channels = list("Supply" = 1, "Service" = 1, "Command" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/headset_cargo
|
||||
name = "supply radio encryption key"
|
||||
desc = "An encryption key for a radio headset. To access the supply channel, use :u."
|
||||
icon_state = "cargo_cypherkey"
|
||||
channels = list("Supply" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/headset_service
|
||||
name = "service radio encryption key"
|
||||
desc = "An encryption key for a radio headset. To access the service channel, use :v."
|
||||
icon_state = "srv_cypherkey"
|
||||
channels = list("Service" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/headset_cent
|
||||
name = "centcom radio encryption key"
|
||||
desc = "An encryption key for a radio headset. To access the centcom channel, use :y."
|
||||
icon_state = "cent_cypherkey"
|
||||
centcom = 1
|
||||
channels = list("Centcom" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/ai //ported from NT, this goes 'inside' the AI.
|
||||
channels = list("Command" = 1, "Security" = 1, "Engineering" = 1, "Science" = 1, "Medical" = 1, "Supply" = 1, "Service" = 1, "AI Private" = 1)
|
||||
|
||||
/obj/item/device/encryptionkey/secbot
|
||||
channels = list("AI Private"=1,"Security"=1)
|
||||
@@ -0,0 +1,290 @@
|
||||
/obj/item/device/radio/headset
|
||||
name = "radio headset"
|
||||
desc = "An updated, modular intercom that fits over the head. Takes encryption keys. \nTo speak on the general radio frequency, use ; before speaking."
|
||||
icon_state = "headset"
|
||||
item_state = "headset"
|
||||
materials = list(MAT_METAL=75)
|
||||
subspace_transmission = 1
|
||||
canhear_range = 0 // can't hear headsets from very far away
|
||||
|
||||
slot_flags = SLOT_EARS
|
||||
var/obj/item/device/encryptionkey/keyslot2 = null
|
||||
dog_fashion = null
|
||||
|
||||
/obj/item/device/radio/headset/New()
|
||||
..()
|
||||
recalculateChannels()
|
||||
|
||||
/obj/item/device/radio/headset/Destroy()
|
||||
qdel(keyslot)
|
||||
qdel(keyslot2)
|
||||
keyslot = null
|
||||
keyslot2 = null
|
||||
return ..()
|
||||
|
||||
/obj/item/device/radio/headset/talk_into(mob/living/M, message, channel, list/spans)
|
||||
if (!listening)
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/device/radio/headset/receive_range(freq, level, AIuser)
|
||||
if(ishuman(src.loc))
|
||||
var/mob/living/carbon/human/H = src.loc
|
||||
if(H.ears == src)
|
||||
return ..(freq, level)
|
||||
else if(AIuser)
|
||||
return ..(freq, level)
|
||||
return -1
|
||||
|
||||
/obj/item/device/radio/headset/syndicate //disguised to look like a normal headset for stealth ops
|
||||
origin_tech = "syndicate=3"
|
||||
|
||||
/obj/item/device/radio/headset/syndicate/alt //undisguised bowman with flash protection
|
||||
name = "syndicate headset"
|
||||
desc = "A syndicate headset that can be used to hear all radio frequencies. Protects ears from flashbangs. \nTo access the syndicate channel, use ; before speaking."
|
||||
flags = EARBANGPROTECT
|
||||
origin_tech = "syndicate=3"
|
||||
icon_state = "syndie_headset"
|
||||
item_state = "syndie_headset"
|
||||
|
||||
/obj/item/device/radio/headset/syndicate/alt/leader
|
||||
name = "team leader headset"
|
||||
command = TRUE
|
||||
|
||||
/obj/item/device/radio/headset/syndicate/New()
|
||||
..()
|
||||
make_syndie()
|
||||
|
||||
/obj/item/device/radio/headset/binary
|
||||
origin_tech = "syndicate=3"
|
||||
/obj/item/device/radio/headset/binary/New()
|
||||
..()
|
||||
qdel(keyslot)
|
||||
keyslot = new /obj/item/device/encryptionkey/binary
|
||||
recalculateChannels()
|
||||
|
||||
/obj/item/device/radio/headset/headset_sec
|
||||
name = "security radio headset"
|
||||
desc = "This is used by your elite security force. \nTo access the security channel, use :s."
|
||||
icon_state = "sec_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/headset_sec
|
||||
|
||||
/obj/item/device/radio/headset/headset_sec/alt
|
||||
name = "security bowman headset"
|
||||
desc = "This is used by your elite security force. Protects ears from flashbangs. \nTo access the security channel, use :s."
|
||||
flags = EARBANGPROTECT
|
||||
icon_state = "sec_headset_alt"
|
||||
item_state = "sec_headset_alt"
|
||||
|
||||
/obj/item/device/radio/headset/headset_eng
|
||||
name = "engineering radio headset"
|
||||
desc = "When the engineers wish to chat like girls. \nTo access the engineering channel, use :e. "
|
||||
icon_state = "eng_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/headset_eng
|
||||
|
||||
/obj/item/device/radio/headset/headset_rob
|
||||
name = "robotics radio headset"
|
||||
desc = "Made specifically for the roboticists, who cannot decide between departments. \nTo access the engineering channel, use :e. For research, use :n."
|
||||
icon_state = "rob_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/headset_rob
|
||||
|
||||
/obj/item/device/radio/headset/headset_med
|
||||
name = "medical radio headset"
|
||||
desc = "A headset for the trained staff of the medbay. \nTo access the medical channel, use :m."
|
||||
icon_state = "med_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/headset_med
|
||||
|
||||
/obj/item/device/radio/headset/headset_sci
|
||||
name = "science radio headset"
|
||||
desc = "A sciency headset. Like usual. \nTo access the science channel, use :n."
|
||||
icon_state = "sci_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/headset_sci
|
||||
|
||||
/obj/item/device/radio/headset/headset_medsci
|
||||
name = "medical research radio headset"
|
||||
desc = "A headset that is a result of the mating between medical and science. \nTo access the medical channel, use :m. For science, use :n."
|
||||
icon_state = "medsci_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/headset_medsci
|
||||
|
||||
/obj/item/device/radio/headset/headset_com
|
||||
name = "command radio headset"
|
||||
desc = "A headset with a commanding channel. \nTo access the command channel, use :c."
|
||||
icon_state = "com_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/headset_com
|
||||
|
||||
/obj/item/device/radio/headset/heads
|
||||
command = TRUE
|
||||
|
||||
/obj/item/device/radio/headset/heads/captain
|
||||
name = "\proper the captain's headset"
|
||||
desc = "The headset of the king. \nChannels are as follows: :c - command, :s - security, :e - engineering, :u - supply, :v - service, :m - medical, :n - science."
|
||||
icon_state = "com_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/heads/captain
|
||||
|
||||
/obj/item/device/radio/headset/heads/captain/alt
|
||||
name = "\proper the captain's bowman headset"
|
||||
desc = "The headset of the boss. Protects ears from flashbangs. \nChannels are as follows: :c - command, :s - security, :e - engineering, :u - supply, :v - service, :m - medical, :n - science."
|
||||
flags = EARBANGPROTECT
|
||||
icon_state = "com_headset_alt"
|
||||
item_state = "com_headset_alt"
|
||||
|
||||
/obj/item/device/radio/headset/heads/rd
|
||||
name = "\proper the research director's headset"
|
||||
desc = "Headset of the fellow who keeps society marching towards technological singularity. \nTo access the science channel, use :n. For command, use :c."
|
||||
icon_state = "com_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/heads/rd
|
||||
|
||||
/obj/item/device/radio/headset/heads/hos
|
||||
name = "\proper the head of security's headset"
|
||||
desc = "The headset of the man in charge of keeping order and protecting the station. \nTo access the security channel, use :s. For command, use :c."
|
||||
icon_state = "com_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/heads/hos
|
||||
|
||||
/obj/item/device/radio/headset/heads/hos/alt
|
||||
name = "\proper the head of security's bowman headset"
|
||||
desc = "The headset of the man in charge of keeping order and protecting the station. Protects ears from flashbangs. \nTo access the security channel, use :s. For command, use :c."
|
||||
flags = EARBANGPROTECT
|
||||
icon_state = "com_headset_alt"
|
||||
item_state = "com_headset_alt"
|
||||
|
||||
/obj/item/device/radio/headset/heads/ce
|
||||
name = "\proper the chief engineer's headset"
|
||||
desc = "The headset of the guy in charge of keeping the station powered and undamaged. \nTo access the engineering channel, use :e. For command, use :c."
|
||||
icon_state = "com_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/heads/ce
|
||||
|
||||
/obj/item/device/radio/headset/heads/cmo
|
||||
name = "\proper the chief medical officer's headset"
|
||||
desc = "The headset of the highly trained medical chief. \nTo access the medical channel, use :m. For command, use :c."
|
||||
icon_state = "com_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/heads/cmo
|
||||
|
||||
/obj/item/device/radio/headset/heads/hop
|
||||
name = "\proper the head of personnel's headset"
|
||||
desc = "The headset of the guy who will one day be captain. \nChannels are as follows: :u - supply, :v - service, :c - command."
|
||||
icon_state = "com_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/heads/hop
|
||||
|
||||
/obj/item/device/radio/headset/headset_cargo
|
||||
name = "supply radio headset"
|
||||
desc = "A headset used by the QM and his slaves. \nTo access the supply channel, use :u."
|
||||
icon_state = "cargo_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/headset_cargo
|
||||
|
||||
/obj/item/device/radio/headset/headset_cargo/mining
|
||||
name = "mining radio headset"
|
||||
desc = "Headset used by shaft miners. \nTo access the supply channel, use :u."
|
||||
icon_state = "mine_headset"
|
||||
|
||||
/obj/item/device/radio/headset/headset_srv
|
||||
name = "service radio headset"
|
||||
desc = "Headset used by the service staff, tasked with keeping the station full, happy and clean. \nTo access the service channel, use :v."
|
||||
icon_state = "srv_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/headset_service
|
||||
|
||||
/obj/item/device/radio/headset/headset_cent
|
||||
name = "\improper Centcom headset"
|
||||
desc = "A headset used by the upper echelons of Nanotrasen. \nTo access the centcom channel, use :y."
|
||||
icon_state = "cent_headset"
|
||||
keyslot = new /obj/item/device/encryptionkey/headset_com
|
||||
keyslot2 = new /obj/item/device/encryptionkey/headset_cent
|
||||
|
||||
/obj/item/device/radio/headset/headset_cent/commander
|
||||
keyslot = new /obj/item/device/encryptionkey/heads/captain
|
||||
|
||||
/obj/item/device/radio/headset/headset_cent/alt
|
||||
name = "\improper Centcom bowman headset"
|
||||
desc = "A headset especially for emergency response personnel. Protects ears from flashbangs. \nTo access the centcom channel, use :y."
|
||||
flags = EARBANGPROTECT
|
||||
icon_state = "cent_headset_alt"
|
||||
item_state = "cent_headset_alt"
|
||||
keyslot = null
|
||||
|
||||
/obj/item/device/radio/headset/ai
|
||||
name = "\proper Integrated Subspace Transceiver "
|
||||
keyslot2 = new /obj/item/device/encryptionkey/ai
|
||||
|
||||
/obj/item/device/radio/headset/ai/receive_range(freq, level)
|
||||
return ..(freq, level, 1)
|
||||
|
||||
/obj/item/device/radio/headset/attackby(obj/item/weapon/W, mob/user, params)
|
||||
user.set_machine(src)
|
||||
|
||||
if(istype(W, /obj/item/weapon/screwdriver))
|
||||
if(keyslot || keyslot2)
|
||||
|
||||
|
||||
for(var/ch_name in channels)
|
||||
SSradio.remove_object(src, radiochannels[ch_name])
|
||||
secure_radio_connections[ch_name] = null
|
||||
|
||||
|
||||
if(keyslot)
|
||||
var/turf/T = get_turf(user)
|
||||
if(T)
|
||||
keyslot.loc = T
|
||||
keyslot = null
|
||||
|
||||
|
||||
|
||||
if(keyslot2)
|
||||
var/turf/T = get_turf(user)
|
||||
if(T)
|
||||
keyslot2.loc = T
|
||||
keyslot2 = null
|
||||
|
||||
recalculateChannels()
|
||||
user << "<span class='notice'>You pop out the encryption keys in the headset.</span>"
|
||||
|
||||
else
|
||||
user << "<span class='warning'>This headset doesn't have any unique encryption keys! How useless...</span>"
|
||||
|
||||
else if(istype(W, /obj/item/device/encryptionkey/))
|
||||
if(keyslot && keyslot2)
|
||||
user << "<span class='warning'>The headset can't hold another key!</span>"
|
||||
return
|
||||
|
||||
if(!keyslot)
|
||||
if(!user.unEquip(W))
|
||||
return
|
||||
W.loc = src
|
||||
keyslot = W
|
||||
|
||||
else
|
||||
if(!user.unEquip(W))
|
||||
return
|
||||
W.loc = src
|
||||
keyslot2 = W
|
||||
|
||||
|
||||
recalculateChannels()
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/device/radio/headset/recalculateChannels()
|
||||
..()
|
||||
if(keyslot2)
|
||||
for(var/ch_name in keyslot2.channels)
|
||||
if(ch_name in src.channels)
|
||||
continue
|
||||
src.channels += ch_name
|
||||
src.channels[ch_name] = keyslot2.channels[ch_name]
|
||||
|
||||
if(keyslot2.translate_binary)
|
||||
src.translate_binary = 1
|
||||
|
||||
if(keyslot2.translate_hive)
|
||||
src.translate_hive = 1
|
||||
|
||||
if(keyslot2.syndie)
|
||||
src.syndie = 1
|
||||
|
||||
if (keyslot2.centcom)
|
||||
centcom = 1
|
||||
|
||||
|
||||
for(var/ch_name in channels)
|
||||
secure_radio_connections[ch_name] = add_radio(src, radiochannels[ch_name])
|
||||
|
||||
return
|
||||
@@ -0,0 +1,71 @@
|
||||
/obj/item/device/radio/intercom
|
||||
name = "station intercom"
|
||||
desc = "Talk through this."
|
||||
icon_state = "intercom"
|
||||
anchored = 1
|
||||
w_class = 4
|
||||
canhear_range = 2
|
||||
var/number = 0
|
||||
var/anyai = 1
|
||||
var/mob/living/silicon/ai/ai = list()
|
||||
var/last_tick //used to delay the powercheck
|
||||
dog_fashion = null
|
||||
|
||||
/obj/item/device/radio/intercom/New()
|
||||
..()
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/device/radio/intercom/Destroy()
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return ..()
|
||||
|
||||
/obj/item/device/radio/intercom/attack_ai(mob/user)
|
||||
interact(user)
|
||||
|
||||
/obj/item/device/radio/intercom/attack_hand(mob/user)
|
||||
interact(user)
|
||||
|
||||
/obj/item/device/radio/intercom/interact(mob/user)
|
||||
..()
|
||||
ui_interact(user, state = default_state)
|
||||
|
||||
/obj/item/device/radio/intercom/receive_range(freq, level)
|
||||
if(!on)
|
||||
return -1
|
||||
if(wires.is_cut(WIRE_RX))
|
||||
return -1
|
||||
if(!(0 in level))
|
||||
var/turf/position = get_turf(src)
|
||||
if(isnull(position) || !(position.z in level))
|
||||
return -1
|
||||
if(!src.listening)
|
||||
return -1
|
||||
if(freq == SYND_FREQ)
|
||||
if(!(src.syndie))
|
||||
return -1//Prevents broadcast of messages over devices lacking the encryption
|
||||
|
||||
return canhear_range
|
||||
|
||||
|
||||
/obj/item/device/radio/intercom/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, list/spans)
|
||||
if(!anyai && !(speaker in ai))
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/item/device/radio/intercom/process()
|
||||
if(((world.timeofday - last_tick) > 30) || ((world.timeofday - last_tick) < 0))
|
||||
last_tick = world.timeofday
|
||||
|
||||
var/area/A = get_area_master(src)
|
||||
if(!A || emped)
|
||||
on = 0
|
||||
else
|
||||
on = A.powered(EQUIP) // set "on" to the power status
|
||||
|
||||
if(!on)
|
||||
icon_state = "intercom-p"
|
||||
else
|
||||
icon_state = "intercom"
|
||||
|
||||
/obj/item/device/radio/intercom/add_blood(list/blood_dna)
|
||||
return 0
|
||||
@@ -0,0 +1,591 @@
|
||||
/obj/item/device/radio
|
||||
icon = 'icons/obj/radio.dmi'
|
||||
name = "station bounced radio"
|
||||
suffix = "\[3\]"
|
||||
icon_state = "walkietalkie"
|
||||
item_state = "walkietalkie"
|
||||
dog_fashion = /datum/dog_fashion/back
|
||||
var/on = 1 // 0 for off
|
||||
var/last_transmission
|
||||
var/frequency = 1459 //common chat
|
||||
var/traitor_frequency = 0 //tune to frequency to unlock traitor supplies
|
||||
var/canhear_range = 3 // the range which mobs can hear this radio from
|
||||
var/obj/item/device/radio/patch_link = null
|
||||
var/list/secure_radio_connections
|
||||
var/prison_radio = 0
|
||||
var/b_stat = 0
|
||||
var/broadcasting = 0
|
||||
var/listening = 1
|
||||
var/translate_binary = 0
|
||||
var/translate_hive = 0
|
||||
var/freerange = 0 // 0 - Sanitize frequencies, 1 - Full range
|
||||
var/list/channels = list() //see communications.dm for full list. First channes is a "default" for :h
|
||||
var/obj/item/device/encryptionkey/keyslot //To allow the radio to accept encryption keys.
|
||||
var/subspace_switchable = 0
|
||||
var/subspace_transmission = 0
|
||||
var/syndie = 0//Holder to see if it's a syndicate encrpyed radio
|
||||
var/centcom = 0//Bleh, more dirty booleans
|
||||
var/freqlock = 0 //Frequency lock to stop the user from untuning specialist radios.
|
||||
var/emped = 0 //Highjacked to track the number of consecutive EMPs on the radio, allowing consecutive EMP's to stack properly.
|
||||
// "Example" = FREQ_LISTENING|FREQ_BROADCASTING
|
||||
flags = CONDUCT | HEAR
|
||||
slot_flags = SLOT_BELT
|
||||
languages_spoken = HUMAN | ROBOT
|
||||
languages_understood = HUMAN | ROBOT
|
||||
throw_speed = 3
|
||||
throw_range = 7
|
||||
w_class = 2
|
||||
materials = list(MAT_METAL=75, MAT_GLASS=25)
|
||||
|
||||
var/const/TRANSMISSION_DELAY = 5 // only 2/second/radio
|
||||
var/const/FREQ_LISTENING = 1
|
||||
//FREQ_BROADCASTING = 2
|
||||
|
||||
var/command = FALSE //If we are speaking into a command headset, our text can be BOLD
|
||||
var/use_command = FALSE
|
||||
|
||||
/obj/item/device/radio/proc/set_frequency(new_frequency)
|
||||
remove_radio(src, frequency)
|
||||
frequency = add_radio(src, new_frequency)
|
||||
|
||||
/obj/item/device/radio/New()
|
||||
wires = new /datum/wires/radio(src)
|
||||
if(prison_radio)
|
||||
wires.cut(WIRE_TX) // OH GOD WHY
|
||||
secure_radio_connections = new
|
||||
..()
|
||||
if(SSradio)
|
||||
initialize()
|
||||
|
||||
/obj/item/device/radio/proc/recalculateChannels()
|
||||
channels = list()
|
||||
translate_binary = 0
|
||||
translate_hive = 0
|
||||
syndie = 0
|
||||
centcom = 0
|
||||
|
||||
if(keyslot)
|
||||
for(var/ch_name in keyslot.channels)
|
||||
if(ch_name in src.channels)
|
||||
continue
|
||||
channels += ch_name
|
||||
channels[ch_name] = keyslot.channels[ch_name]
|
||||
|
||||
if(keyslot.translate_binary)
|
||||
translate_binary = 1
|
||||
|
||||
if(keyslot.translate_hive)
|
||||
translate_hive = 1
|
||||
|
||||
if(keyslot.syndie)
|
||||
syndie = 1
|
||||
|
||||
if(keyslot.centcom)
|
||||
centcom = 1
|
||||
|
||||
for(var/ch_name in channels)
|
||||
secure_radio_connections[ch_name] = add_radio(src, radiochannels[ch_name])
|
||||
|
||||
/obj/item/device/radio/proc/make_syndie() // Turns normal radios into Syndicate radios!
|
||||
qdel(keyslot)
|
||||
keyslot = new /obj/item/device/encryptionkey/syndicate
|
||||
syndie = 1
|
||||
recalculateChannels()
|
||||
|
||||
/obj/item/device/radio/Destroy()
|
||||
qdel(wires)
|
||||
wires = null
|
||||
remove_radio_all(src) //Just to be sure
|
||||
patch_link = null
|
||||
keyslot = null
|
||||
return ..()
|
||||
|
||||
/obj/item/device/radio/initialize()
|
||||
frequency = sanitize_frequency(frequency, freerange)
|
||||
set_frequency(frequency)
|
||||
|
||||
for(var/ch_name in channels)
|
||||
secure_radio_connections[ch_name] = add_radio(src, radiochannels[ch_name])
|
||||
|
||||
/obj/item/device/radio/interact(mob/user)
|
||||
if (..())
|
||||
return
|
||||
if(b_stat && !istype(user, /mob/living/silicon/ai))
|
||||
wires.interact(user)
|
||||
else
|
||||
ui_interact(user)
|
||||
|
||||
/obj/item/device/radio/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = inventory_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "radio", name, 370, 220 + channels.len * 22, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/item/device/radio/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["broadcasting"] = broadcasting
|
||||
data["listening"] = listening
|
||||
data["frequency"] = frequency
|
||||
data["minFrequency"] = freerange ? MIN_FREE_FREQ : MIN_FREQ
|
||||
data["maxFrequency"] = freerange ? MAX_FREE_FREQ : MAX_FREQ
|
||||
data["freqlock"] = freqlock
|
||||
data["channels"] = list()
|
||||
for(var/channel in channels)
|
||||
data["channels"][channel] = channels[channel] & FREQ_LISTENING
|
||||
data["command"] = command
|
||||
data["useCommand"] = use_command
|
||||
data["subspace"] = subspace_transmission
|
||||
data["subspaceSwitchable"] = subspace_switchable
|
||||
data["headset"] = istype(src, /obj/item/device/radio/headset)
|
||||
|
||||
return data
|
||||
|
||||
/obj/item/device/radio/ui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("frequency")
|
||||
if(freqlock)
|
||||
return
|
||||
var/tune = params["tune"]
|
||||
var/adjust = text2num(params["adjust"])
|
||||
if(tune == "input")
|
||||
var/min = format_frequency(freerange ? MIN_FREE_FREQ : MIN_FREQ)
|
||||
var/max = format_frequency(freerange ? MAX_FREE_FREQ : MAX_FREQ)
|
||||
tune = input("Tune frequency ([min]-[max]):", name, format_frequency(frequency)) as null|num
|
||||
if(!isnull(tune) && !..())
|
||||
. = TRUE
|
||||
else if(adjust)
|
||||
tune = frequency + adjust * 10
|
||||
. = TRUE
|
||||
else if(text2num(tune) != null)
|
||||
tune = tune * 10
|
||||
. = TRUE
|
||||
if(.)
|
||||
frequency = sanitize_frequency(tune, freerange)
|
||||
set_frequency(frequency)
|
||||
if(frequency == traitor_frequency && hidden_uplink)
|
||||
hidden_uplink.interact(usr)
|
||||
ui.close()
|
||||
if("listen")
|
||||
listening = !listening
|
||||
. = TRUE
|
||||
if("broadcast")
|
||||
broadcasting = !broadcasting
|
||||
. = TRUE
|
||||
if("channel")
|
||||
var/channel = params["channel"]
|
||||
if(!(channel in channels))
|
||||
return
|
||||
if(channels[channel] & FREQ_LISTENING)
|
||||
channels[channel] &= ~FREQ_LISTENING
|
||||
else
|
||||
channels[channel] |= FREQ_LISTENING
|
||||
. = TRUE
|
||||
if("command")
|
||||
use_command = !use_command
|
||||
. = TRUE
|
||||
if("subspace")
|
||||
if(subspace_switchable)
|
||||
subspace_transmission = !subspace_transmission
|
||||
if(!subspace_transmission)
|
||||
channels = list()
|
||||
else
|
||||
recalculateChannels()
|
||||
. = TRUE
|
||||
|
||||
/obj/item/device/radio/talk_into(atom/movable/M, message, channel, list/spans)
|
||||
if(!on) return // the device has to be on
|
||||
// Fix for permacell radios, but kinda eh about actually fixing them.
|
||||
if(!M || !message) return
|
||||
|
||||
if(wires.is_cut(WIRE_TX))
|
||||
return
|
||||
|
||||
if(!M.IsVocal())
|
||||
return
|
||||
|
||||
if(use_command)
|
||||
spans |= SPAN_COMMAND
|
||||
|
||||
/* Quick introduction:
|
||||
This new radio system uses a very robust FTL signaling technology unoriginally
|
||||
dubbed "subspace" which is somewhat similar to 'blue-space' but can't
|
||||
actually transmit large mass. Headsets are the only radio devices capable
|
||||
of sending subspace transmissions to the Communications Satellite.
|
||||
|
||||
A headset sends a signal to a subspace listener/reciever elsewhere in space,
|
||||
the signal gets processed and logged, and an audible transmission gets sent
|
||||
to each individual headset.
|
||||
*/
|
||||
|
||||
/*
|
||||
be prepared to disregard any comments in all of tcomms code. i tried my best to keep them somewhat up-to-date, but eh
|
||||
*/
|
||||
|
||||
//get the frequency you buttface. radios no longer use the SSradio. confusing for future generations, convenient for me.
|
||||
var/freq
|
||||
if(channel && channels && channels.len > 0)
|
||||
if(channel == "department")
|
||||
channel = channels[1]
|
||||
freq = secure_radio_connections[channel]
|
||||
if (!channels[channel]) // if the channel is turned off, don't broadcast
|
||||
return
|
||||
else
|
||||
freq = frequency
|
||||
channel = null
|
||||
|
||||
var/freqnum = text2num(freq) //Why should we call text2num three times when we can just do it here?
|
||||
var/turf/position = get_turf(src)
|
||||
|
||||
//#### Tagging the signal with all appropriate identity values ####//
|
||||
|
||||
// ||-- The mob's name identity --||
|
||||
var/real_name = M.name // mob's real name
|
||||
var/mobkey = "none" // player key associated with mob
|
||||
var/voicemask = 0 // the speaker is wearing a voice mask
|
||||
var/voice = M.GetVoice() // Why reinvent the wheel when there is a proc that does nice things already
|
||||
if(ismob(M))
|
||||
var/mob/speaker = M
|
||||
real_name = speaker.real_name
|
||||
if(speaker.client)
|
||||
mobkey = speaker.key // assign the mob's key
|
||||
|
||||
|
||||
var/jobname // the mob's "job"
|
||||
|
||||
|
||||
// --- Human: use their job as seen on the crew manifest - makes it unneeded to carry an ID for an AI to see their job
|
||||
if(ishuman(M))
|
||||
var/datum/data/record/findjob = find_record("name", voice, data_core.general)
|
||||
|
||||
if(voice != real_name)
|
||||
voicemask = 1
|
||||
if(findjob)
|
||||
jobname = findjob.fields["rank"]
|
||||
else
|
||||
jobname = "Unknown"
|
||||
|
||||
// --- Carbon Nonhuman ---
|
||||
else if(iscarbon(M)) // Nonhuman carbon mob
|
||||
jobname = "No id"
|
||||
|
||||
// --- AI ---
|
||||
else if(isAI(M))
|
||||
jobname = "AI"
|
||||
|
||||
// --- Cyborg ---
|
||||
else if(isrobot(M))
|
||||
var/mob/living/silicon/robot/B = M
|
||||
jobname = "[B.designation] Cyborg"
|
||||
|
||||
// --- Personal AI (pAI) ---
|
||||
else if(istype(M, /mob/living/silicon/pai))
|
||||
jobname = "Personal AI"
|
||||
|
||||
// --- Cold, emotionless machines. ---
|
||||
else if(isobj(M))
|
||||
jobname = "Machine"
|
||||
|
||||
// --- Unidentifiable mob ---
|
||||
else
|
||||
jobname = "Unknown"
|
||||
|
||||
/* ###### Centcom channel bypasses all comms relays. ###### */
|
||||
|
||||
if (freqnum == CENTCOM_FREQ && centcom)
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 2
|
||||
signal.data = list(
|
||||
"mob" = M, // store a reference to the mob
|
||||
"mobtype" = M.type, // the mob's type
|
||||
"realname" = real_name, // the mob's real name
|
||||
"name" = voice, // the mob's voice name
|
||||
"job" = jobname, // the mob's job
|
||||
"key" = mobkey, // the mob's key
|
||||
"vmask" = voicemask, // 1 if the mob is using a voice gas mas
|
||||
|
||||
"compression" = 0, // uncompressed radio signal
|
||||
"message" = message, // the actual sent message
|
||||
"radio" = src, // stores the radio used for transmission
|
||||
"slow" = 0,
|
||||
"traffic" = 0,
|
||||
"type" = 0,
|
||||
"server" = null,
|
||||
"reject" = 0,
|
||||
"level" = 0,
|
||||
"languages" = languages_spoken,
|
||||
"spans" = spans,
|
||||
"verb_say" = M.verb_say,
|
||||
"verb_ask" = M.verb_ask,
|
||||
"verb_exclaim" = M.verb_exclaim,
|
||||
"verb_yell" = M.verb_yell
|
||||
)
|
||||
signal.frequency = freqnum // Quick frequency set
|
||||
Broadcast_Message(M, voicemask,
|
||||
src, message, voice, jobname, real_name,
|
||||
5, signal.data["compression"], list(position.z, 0), freq, spans,
|
||||
verb_say, verb_ask, verb_exclaim, verb_yell)
|
||||
return
|
||||
|
||||
/* ###### Radio headsets can only broadcast through subspace ###### */
|
||||
|
||||
if(subspace_transmission)
|
||||
// First, we want to generate a new radio signal
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 2 // 2 would be a subspace transmission.
|
||||
// transmission_method could probably be enumerated through #define. Would be neater.
|
||||
// --- Finally, tag the actual signal with the appropriate values ---
|
||||
signal.data = list(
|
||||
// Identity-associated tags:
|
||||
"mob" = M, // store a reference to the mob
|
||||
"mobtype" = M.type, // the mob's type
|
||||
"realname" = real_name, // the mob's real name
|
||||
"name" = voice, // the mob's voice name
|
||||
"job" = jobname, // the mob's job
|
||||
"key" = mobkey, // the mob's key
|
||||
"vmask" = voicemask, // 1 if the mob is using a voice gas mask
|
||||
|
||||
// We store things that would otherwise be kept in the actual mob
|
||||
// so that they can be logged even AFTER the mob is deleted or something
|
||||
|
||||
// Other tags:
|
||||
"compression" = rand(35,65), // compressed radio signal
|
||||
"message" = message, // the actual sent message
|
||||
"radio" = src, // stores the radio used for transmission
|
||||
"slow" = 0, // how much to sleep() before broadcasting - simulates net lag
|
||||
"traffic" = 0, // dictates the total traffic sum that the signal went through
|
||||
"type" = 0, // determines what type of radio input it is: normal broadcast
|
||||
"server" = null, // the last server to log this signal
|
||||
"reject" = 0, // if nonzero, the signal will not be accepted by any broadcasting machinery
|
||||
"level" = position.z, // The source's z level
|
||||
"languages" = M.languages_spoken, //The languages M is talking in.
|
||||
"spans" = spans, //the span classes of this message.
|
||||
"verb_say" = M.verb_say, //the verb used when talking normally
|
||||
"verb_ask" = M.verb_ask, //the verb used when asking
|
||||
"verb_exclaim" = M.verb_exclaim, //the verb used when exclaiming
|
||||
"verb_yell" = M.verb_yell //the verb used when yelling
|
||||
)
|
||||
signal.frequency = freq
|
||||
|
||||
//#### Sending the signal to all subspace receivers ####//
|
||||
|
||||
for(var/obj/machinery/telecomms/receiver/R in telecomms_list)
|
||||
R.receive_signal(signal)
|
||||
|
||||
// Allinone can act as receivers.
|
||||
for(var/obj/machinery/telecomms/allinone/R in telecomms_list)
|
||||
R.receive_signal(signal)
|
||||
|
||||
// Receiving code can be located in Telecommunications.dm
|
||||
return
|
||||
|
||||
|
||||
/* ###### Intercoms and station-bounced radios ###### */
|
||||
|
||||
var/filter_type = 2
|
||||
|
||||
var/datum/signal/signal = new
|
||||
signal.transmission_method = 2
|
||||
|
||||
|
||||
/* --- Try to send a normal subspace broadcast first */
|
||||
|
||||
signal.data = list(
|
||||
"mob" = M, // store a reference to the mob
|
||||
"mobtype" = M.type, // the mob's type
|
||||
"realname" = real_name, // the mob's real name
|
||||
"name" = voice, // the mob's voice name
|
||||
"job" = jobname, // the mob's job
|
||||
"key" = mobkey, // the mob's key
|
||||
"vmask" = voicemask, // 1 if the mob is using a voice gas mas
|
||||
|
||||
"compression" = 0, // uncompressed radio signal
|
||||
"message" = message, // the actual sent message
|
||||
"radio" = src, // stores the radio used for transmission
|
||||
"slow" = 0,
|
||||
"traffic" = 0,
|
||||
"type" = 0,
|
||||
"server" = null,
|
||||
"reject" = 0,
|
||||
"level" = position.z,
|
||||
"languages" = languages_spoken,
|
||||
"spans" = spans,
|
||||
"verb_say" = M.verb_say,
|
||||
"verb_ask" = M.verb_ask,
|
||||
"verb_exclaim" = M.verb_exclaim,
|
||||
"verb_yell" = M.verb_yell
|
||||
)
|
||||
signal.frequency = freqnum // Quick frequency set
|
||||
for(var/obj/machinery/telecomms/receiver/R in telecomms_list)
|
||||
R.receive_signal(signal)
|
||||
|
||||
|
||||
spawn(20) // wait a little...
|
||||
|
||||
if(signal.data["done"] && position.z in signal.data["level"])
|
||||
// we're done here.
|
||||
return
|
||||
|
||||
// Oh my god; the comms are down or something because the signal hasn't been broadcasted yet in our level.
|
||||
// Send a mundane broadcast with limited targets:
|
||||
Broadcast_Message(M, voicemask,
|
||||
src, message, voice, jobname, real_name,
|
||||
filter_type, signal.data["compression"], list(position.z), freq, spans,
|
||||
verb_say, verb_ask, verb_exclaim, verb_yell)
|
||||
|
||||
/obj/item/device/radio/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, list/spans)
|
||||
if(radio_freq)
|
||||
return
|
||||
if(broadcasting)
|
||||
if(get_dist(src, speaker) <= canhear_range)
|
||||
talk_into(speaker, raw_message, , spans)
|
||||
/*
|
||||
/obj/item/device/radio/proc/accept_rad(obj/item/device/radio/R as obj, message)
|
||||
|
||||
if ((R.frequency == frequency && message))
|
||||
return 1
|
||||
else if
|
||||
|
||||
else
|
||||
return null
|
||||
return
|
||||
*/
|
||||
|
||||
|
||||
/obj/item/device/radio/proc/receive_range(freq, level)
|
||||
// check if this radio can receive on the given frequency, and if so,
|
||||
// what the range is in which mobs will hear the radio
|
||||
// returns: -1 if can't receive, range otherwise
|
||||
|
||||
if (wires.is_cut(WIRE_RX))
|
||||
return -1
|
||||
if(!listening)
|
||||
return -1
|
||||
if(!(0 in level))
|
||||
var/turf/position = get_turf(src)
|
||||
if(!position || !(position.z in level))
|
||||
return -1
|
||||
if(freq == SYND_FREQ)
|
||||
if(!(src.syndie)) //Checks to see if it's allowed on that frequency, based on the encryption keys
|
||||
return -1
|
||||
if(freq == CENTCOM_FREQ)
|
||||
if (!(src.centcom))
|
||||
return -1
|
||||
if (!on)
|
||||
return -1
|
||||
if (!freq) //received on main frequency
|
||||
if (!listening)
|
||||
return -1
|
||||
else
|
||||
var/accept = (freq==frequency && listening)
|
||||
if (!accept)
|
||||
for(var/ch_name in channels)
|
||||
if(channels[ch_name] & FREQ_LISTENING)
|
||||
if(radiochannels[ch_name] == text2num(freq) || syndie) //the radiochannels list is located in communications.dm
|
||||
accept = 1
|
||||
break
|
||||
if (!accept)
|
||||
return -1
|
||||
return canhear_range
|
||||
|
||||
/obj/item/device/radio/proc/send_hear(freq, level)
|
||||
|
||||
var/range = receive_range(freq, level)
|
||||
if(range > -1)
|
||||
return get_hearers_in_view(canhear_range, src)
|
||||
|
||||
|
||||
/obj/item/device/radio/examine(mob/user)
|
||||
..()
|
||||
if (b_stat)
|
||||
user << "<span class='notice'>[name] can be attached and modified.</span>"
|
||||
else
|
||||
user << "<span class='notice'>[name] can not be modified or attached.</span>"
|
||||
|
||||
/obj/item/device/radio/attackby(obj/item/weapon/W, mob/user, params)
|
||||
add_fingerprint(user)
|
||||
if(istype(W, /obj/item/weapon/screwdriver))
|
||||
b_stat = !b_stat
|
||||
if(b_stat)
|
||||
user << "<span class='notice'>The radio can now be attached and modified!</span>"
|
||||
else
|
||||
user << "<span class='notice'>The radio can no longer be modified or attached!</span>"
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/item/device/radio/emp_act(severity)
|
||||
emped++ //There's been an EMP; better count it
|
||||
var/curremp = emped //Remember which EMP this was
|
||||
if (listening && ismob(loc)) // if the radio is turned on and on someone's person they notice
|
||||
loc << "<span class='warning'>\The [src] overloads.</span>"
|
||||
broadcasting = 0
|
||||
listening = 0
|
||||
for (var/ch_name in channels)
|
||||
channels[ch_name] = 0
|
||||
on = 0
|
||||
spawn(200)
|
||||
if(emped == curremp) //Don't fix it if it's been EMP'd again
|
||||
emped = 0
|
||||
if (!istype(src, /obj/item/device/radio/intercom)) // intercoms will turn back on on their own
|
||||
on = 1
|
||||
..()
|
||||
|
||||
///////////////////////////////
|
||||
//////////Borg Radios//////////
|
||||
///////////////////////////////
|
||||
//Giving borgs their own radio to have some more room to work with -Sieve
|
||||
|
||||
/obj/item/device/radio/borg
|
||||
name = "cyborg radio"
|
||||
subspace_switchable = 1
|
||||
dog_fashion = null
|
||||
|
||||
/obj/item/device/radio/borg/syndicate
|
||||
syndie = 1
|
||||
keyslot = new /obj/item/device/encryptionkey/syndicate
|
||||
|
||||
/obj/item/device/radio/borg/syndicate/New()
|
||||
..()
|
||||
set_frequency(SYND_FREQ)
|
||||
|
||||
/obj/item/device/radio/borg/attackby(obj/item/weapon/W, mob/user, params)
|
||||
|
||||
if(istype(W, /obj/item/weapon/screwdriver))
|
||||
if(keyslot)
|
||||
for(var/ch_name in channels)
|
||||
SSradio.remove_object(src, radiochannels[ch_name])
|
||||
secure_radio_connections[ch_name] = null
|
||||
|
||||
|
||||
if(keyslot)
|
||||
var/turf/T = get_turf(user)
|
||||
if(T)
|
||||
keyslot.loc = T
|
||||
keyslot = null
|
||||
|
||||
recalculateChannels()
|
||||
user << "<span class='notice'>You pop out the encryption key in the radio.</span>"
|
||||
|
||||
else
|
||||
user << "<span class='warning'>This radio doesn't have any encryption keys!</span>"
|
||||
|
||||
else if(istype(W, /obj/item/device/encryptionkey/))
|
||||
if(keyslot)
|
||||
user << "<span class='warning'>The radio can't hold another key!</span>"
|
||||
return
|
||||
|
||||
if(!keyslot)
|
||||
if(!user.unEquip(W))
|
||||
return
|
||||
W.loc = src
|
||||
keyslot = W
|
||||
|
||||
recalculateChannels()
|
||||
|
||||
|
||||
/obj/item/device/radio/off // Station bounced radios, their only difference is spawning with the speakers off, this was made to help the lag.
|
||||
listening = 0 // And it's nice to have a subtype too for future features.
|
||||
dog_fashion = /datum/dog_fashion/back
|
||||
@@ -0,0 +1,423 @@
|
||||
|
||||
/*
|
||||
CONTAINS:
|
||||
T-RAY
|
||||
DETECTIVE SCANNER
|
||||
HEALTH ANALYZER
|
||||
GAS ANALYZER
|
||||
MASS SPECTROMETER
|
||||
|
||||
*/
|
||||
/obj/item/device/t_scanner
|
||||
name = "\improper T-ray scanner"
|
||||
desc = "A terahertz-ray emitter and scanner used to detect underfloor objects such as cables and pipes."
|
||||
icon_state = "t-ray0"
|
||||
var/on = 0
|
||||
slot_flags = SLOT_BELT
|
||||
w_class = 2
|
||||
item_state = "electronic"
|
||||
materials = list(MAT_METAL=150)
|
||||
origin_tech = "magnets=1;engineering=1"
|
||||
|
||||
/obj/item/device/t_scanner/attack_self(mob/user)
|
||||
|
||||
on = !on
|
||||
icon_state = copytext(icon_state, 1, length(icon_state))+"[on]"
|
||||
|
||||
if(on)
|
||||
START_PROCESSING(SSobj, src)
|
||||
|
||||
/obj/item/device/t_scanner/proc/flick_sonar(obj/pipe)
|
||||
var/image/I = image('icons/effects/effects.dmi', pipe, "blip", pipe.layer+1)
|
||||
I.alpha = 128
|
||||
var/list/nearby = list()
|
||||
for(var/mob/M in viewers(pipe))
|
||||
if(M.client)
|
||||
nearby |= M.client
|
||||
flick_overlay(I,nearby,8)
|
||||
|
||||
/obj/item/device/t_scanner/process()
|
||||
if(!on)
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
return null
|
||||
scan()
|
||||
|
||||
/obj/item/device/t_scanner/proc/scan()
|
||||
|
||||
for(var/turf/T in range(2, src.loc) )
|
||||
for(var/obj/O in T.contents)
|
||||
|
||||
if(O.level != 1)
|
||||
continue
|
||||
|
||||
var/mob/living/L = locate() in O
|
||||
|
||||
if(O.invisibility == INVISIBILITY_MAXIMUM)
|
||||
O.invisibility = 0
|
||||
if(L)
|
||||
flick_sonar(O)
|
||||
spawn(10)
|
||||
if(O && O.loc)
|
||||
var/turf/U = O.loc
|
||||
if(U.intact)
|
||||
O.invisibility = INVISIBILITY_MAXIMUM
|
||||
else
|
||||
if(L)
|
||||
flick_sonar(O)
|
||||
|
||||
|
||||
/obj/item/device/healthanalyzer
|
||||
name = "health analyzer"
|
||||
icon_state = "health"
|
||||
item_state = "analyzer"
|
||||
desc = "A hand-held body scanner able to distinguish vital signs of the subject."
|
||||
flags = CONDUCT | NOBLUDGEON
|
||||
slot_flags = SLOT_BELT
|
||||
throwforce = 3
|
||||
w_class = 1
|
||||
throw_speed = 3
|
||||
throw_range = 7
|
||||
materials = list(MAT_METAL=200)
|
||||
origin_tech = "magnets=1;biotech=1"
|
||||
var/mode = 1
|
||||
var/scanmode = 0
|
||||
|
||||
/obj/item/device/healthanalyzer/attack_self(mob/user)
|
||||
if(!scanmode)
|
||||
user << "<span class='notice'>You switch the health analyzer to scan chemical contents.</span>"
|
||||
scanmode = 1
|
||||
else
|
||||
user << "<span class='notice'>You switch the health analyzer to check physical health.</span>"
|
||||
scanmode = 0
|
||||
|
||||
/obj/item/device/healthanalyzer/attack(mob/living/M, mob/living/carbon/human/user)
|
||||
|
||||
// Clumsiness/brain damage check
|
||||
if ((user.disabilities & CLUMSY || user.getBrainLoss() >= 60) && prob(50))
|
||||
user << "<span class='notice'>You stupidly try to analyze the floor's vitals!</span>"
|
||||
user.visible_message("<span class='warning'>[user] has analyzed the floor's vitals!</span>")
|
||||
user << "<span class='info'>Analyzing results for The floor:\n\tOverall status: <b>Healthy</b>"
|
||||
user << "<span class='info'>Key: <font color='blue'>Suffocation</font>/<font color='green'>Toxin</font>/<font color='#FF8000'>Burn</font>/<font color='red'>Brute</font></span>"
|
||||
user << "<span class='info'>\tDamage specifics: <font color='blue'>0</font>-<font color='green'>0</font>-<font color='#FF8000'>0</font>-<font color='red'>0</font></span>"
|
||||
user << "<span class='info'>Body temperature: ???</span>"
|
||||
return
|
||||
|
||||
user.visible_message("<span class='notice'>[user] has analyzed [M]'s vitals.</span>")
|
||||
|
||||
if(scanmode == 0)
|
||||
healthscan(user, M, mode)
|
||||
else if(scanmode == 1)
|
||||
chemscan(user, M)
|
||||
|
||||
add_fingerprint(user)
|
||||
|
||||
|
||||
// Used by the PDA medical scanner too
|
||||
/proc/healthscan(mob/living/user, mob/living/M, mode = 1)
|
||||
if(user.stat || user.eye_blind)
|
||||
return
|
||||
//Damage specifics
|
||||
var/oxy_loss = M.getOxyLoss()
|
||||
var/tox_loss = M.getToxLoss()
|
||||
var/fire_loss = M.getFireLoss()
|
||||
var/brute_loss = M.getBruteLoss()
|
||||
var/mob_status = (M.stat > 1 ? "<span class='alert'><b>Deceased</b></span>" : "<b>[round(M.health/M.maxHealth,0.01)*100] % healthy</b>")
|
||||
|
||||
if(M.status_flags & FAKEDEATH)
|
||||
mob_status = "<span class='alert'>Deceased</span>"
|
||||
oxy_loss = max(rand(1, 40), oxy_loss, (300 - (tox_loss + fire_loss + brute_loss))) // Random oxygen loss
|
||||
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = M
|
||||
if(H.heart_attack && H.stat != DEAD)
|
||||
user << "<span class='danger'>Subject suffering from heart attack: Apply defibrillator immediately!</span>"
|
||||
user << "<span class='info'>Analyzing results for [M]:\n\tOverall status: [mob_status]</span>"
|
||||
|
||||
// Damage descriptions
|
||||
if(brute_loss > 10)
|
||||
user << "\t<span class='alert'>[brute_loss > 50 ? "Severe" : "Minor"] tissue damage detected.</span>"
|
||||
if(fire_loss > 10)
|
||||
user << "\t<span class='alert'>[fire_loss > 50 ? "Severe" : "Minor"] burn damage detected.</span>"
|
||||
if(oxy_loss > 10)
|
||||
user << "\t<span class='info'><span class='alert'>[oxy_loss > 50 ? "Severe" : "Minor"] oxygen deprivation detected.</span>"
|
||||
if(tox_loss > 10)
|
||||
user << "\t<span class='alert'>[tox_loss > 50 ? "Critical" : "Dangerous"] amount of toxins detected.</span>"
|
||||
if(M.getStaminaLoss())
|
||||
user << "\t<span class='alert'>Subject appears to be suffering from fatigue.</span>"
|
||||
if (M.getCloneLoss())
|
||||
user << "\t<span class='alert'>Subject appears to have [M.getCloneLoss() > 30 ? "severe" : "minor"] cellular damage.</span>"
|
||||
if (M.reagents && M.reagents.get_reagent_amount("epinephrine"))
|
||||
user << "\t<span class='info'>Bloodstream analysis located [M.reagents:get_reagent_amount("epinephrine")] units of rejuvenation chemicals.</span>"
|
||||
if (M.getBrainLoss() >= 100 || !M.getorgan(/obj/item/organ/brain))
|
||||
user << "\t<span class='alert'>Subject brain function is non-existent.</span>"
|
||||
else if (M.getBrainLoss() >= 60)
|
||||
user << "\t<span class='alert'>Severe brain damage detected. Subject likely to have mental retardation.</span>"
|
||||
else if (M.getBrainLoss() >= 10)
|
||||
user << "\t<span class='alert'>Brain damage detected. Subject may have had a concussion.</span>"
|
||||
|
||||
// Organ damage report
|
||||
if(istype(M, /mob/living/carbon/human) && mode == 1)
|
||||
var/mob/living/carbon/human/H = M
|
||||
var/list/damaged = H.get_damaged_bodyparts(1,1)
|
||||
if(length(damaged)>0 || oxy_loss>0 || tox_loss>0 || fire_loss>0)
|
||||
user << "<span class='info'>\tDamage: <span class='info'><font color='red'>Brute</font></span>-<font color='#FF8000'>Burn</font>-<font color='green'>Toxin</font>-<font color='blue'>Suffocation</font>\n\t\tSpecifics: <font color='red'>[brute_loss]</font>-<font color='#FF8000'>[fire_loss]</font>-<font color='green'>[tox_loss]</font>-<font color='blue'>[oxy_loss]</font></span>"
|
||||
for(var/obj/item/bodypart/org in damaged)
|
||||
user << "\t\t<span class='info'>[capitalize(org.name)]: [(org.brute_dam > 0) ? "<font color='red'>[org.brute_dam]</font></span>" : "<font color='red'>0</font>"]-[(org.burn_dam > 0) ? "<font color='#FF8000'>[org.burn_dam]</font>" : "<font color='#FF8000'>0</font>"]"
|
||||
|
||||
// Species and body temperature
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = M
|
||||
user << "<span class='info'>Species: [H.dna.species.name]</span>"
|
||||
user << "<span class='info'>Body temperature: [round(M.bodytemperature-T0C,0.1)] °C ([round(M.bodytemperature*1.8-459.67,0.1)] °F)</span>"
|
||||
|
||||
// Time of death
|
||||
if(M.tod && (M.stat == DEAD || (M.status_flags & FAKEDEATH)))
|
||||
user << "<span class='info'>Time of Death:</span> [M.tod]"
|
||||
var/tdelta = round(world.time - M.timeofdeath)
|
||||
if(tdelta < (DEFIB_TIME_LIMIT * 10))
|
||||
user << "<span class='danger'>Subject died [tdelta / 10] seconds \
|
||||
ago, defibrillation may be possible!</span>"
|
||||
|
||||
for(var/datum/disease/D in M.viruses)
|
||||
if(!(D.visibility_flags & HIDDEN_SCANNER))
|
||||
user << "<span class='alert'><b>Warning: [D.form] detected</b>\nName: [D.name].\nType: [D.spread_text].\nStage: [D.stage]/[D.max_stages].\nPossible Cure: [D.cure_text]</span>"
|
||||
|
||||
// Blood Level
|
||||
if(M.has_dna())
|
||||
var/mob/living/carbon/C = M
|
||||
var/blood_id = C.get_blood_id()
|
||||
if(blood_id)
|
||||
if(ishuman(C))
|
||||
var/mob/living/carbon/human/H = C
|
||||
if(H.bleed_rate)
|
||||
user << "<span class='danger'>Subject is bleeding!</span>"
|
||||
var/blood_percent = round((C.blood_volume / BLOOD_VOLUME_NORMAL)*100)
|
||||
var/blood_type = C.dna.blood_type
|
||||
if(blood_id != "blood")//special blood substance
|
||||
blood_type = blood_id
|
||||
if(C.blood_volume <= BLOOD_VOLUME_SAFE && C.blood_volume > BLOOD_VOLUME_OKAY)
|
||||
user << "<span class='danger'>LOW blood level [blood_percent] %, [C.blood_volume] cl,</span> <span class='info'>type: [blood_type]</span>"
|
||||
else if(C.blood_volume <= BLOOD_VOLUME_OKAY)
|
||||
user << "<span class='danger'>CRITICAL blood level [blood_percent] %, [C.blood_volume] cl,</span> <span class='info'>type: [blood_type]</span>"
|
||||
else
|
||||
user << "<span class='info'>Blood level [blood_percent] %, [C.blood_volume] cl, type: [blood_type]</span>"
|
||||
|
||||
var/implant_detect
|
||||
for(var/obj/item/organ/cyberimp/CI in C.internal_organs)
|
||||
if(CI.status == ORGAN_ROBOTIC)
|
||||
implant_detect += "[C.name] is modified with a [CI.name].<br>"
|
||||
if(implant_detect)
|
||||
user << "<span class='notice'>Detected cybernetic modifications:</span>"
|
||||
user << "<span class='notice'>[implant_detect]</span>"
|
||||
|
||||
/proc/chemscan(mob/living/user, mob/living/M)
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = M
|
||||
if(H.reagents)
|
||||
if(H.reagents.reagent_list.len)
|
||||
user << "<span class='notice'>Subject contains the following reagents:</span>"
|
||||
for(var/datum/reagent/R in H.reagents.reagent_list)
|
||||
user << "<span class='notice'>[R.volume] units of [R.name][R.overdosed == 1 ? "</span> - <span class='boldannounce'>OVERDOSING</span>" : ".</span>"]"
|
||||
else
|
||||
user << "<span class='notice'>Subject contains no reagents.</span>"
|
||||
if(H.reagents.addiction_list.len)
|
||||
user << "<span class='boldannounce'>Subject is addicted to the following reagents:</span>"
|
||||
for(var/datum/reagent/R in H.reagents.addiction_list)
|
||||
user << "<span class='danger'>[R.name]</span>"
|
||||
else
|
||||
user << "<span class='notice'>Subject is not addicted to any reagents.</span>"
|
||||
|
||||
/obj/item/device/healthanalyzer/verb/toggle_mode()
|
||||
set name = "Switch Verbosity"
|
||||
set category = "Object"
|
||||
|
||||
if(usr.stat || !usr.canmove || usr.restrained())
|
||||
return
|
||||
|
||||
mode = !mode
|
||||
switch (mode)
|
||||
if(1)
|
||||
usr << "The scanner now shows specific limb damage."
|
||||
if(0)
|
||||
usr << "The scanner no longer shows limb damage."
|
||||
|
||||
|
||||
/obj/item/device/analyzer
|
||||
desc = "A hand-held environmental scanner which reports current gas levels."
|
||||
name = "analyzer"
|
||||
icon_state = "atmos"
|
||||
item_state = "analyzer"
|
||||
w_class = 2
|
||||
flags = CONDUCT | NOBLUDGEON
|
||||
slot_flags = SLOT_BELT
|
||||
throwforce = 0
|
||||
throw_speed = 3
|
||||
throw_range = 7
|
||||
materials = list(MAT_METAL=30, MAT_GLASS=20)
|
||||
origin_tech = "magnets=1;engineering=1"
|
||||
|
||||
/obj/item/device/analyzer/attack_self(mob/user)
|
||||
|
||||
add_fingerprint(user)
|
||||
|
||||
if (user.stat || user.eye_blind)
|
||||
return
|
||||
|
||||
var/turf/location = user.loc
|
||||
if(!istype(location))
|
||||
return
|
||||
|
||||
var/datum/gas_mixture/environment = location.return_air()
|
||||
|
||||
var/pressure = environment.return_pressure()
|
||||
var/total_moles = environment.total_moles()
|
||||
|
||||
user << "<span class='info'><B>Results:</B></span>"
|
||||
if(abs(pressure - ONE_ATMOSPHERE) < 10)
|
||||
user << "<span class='info'>Pressure: [round(pressure,0.1)] kPa</span>"
|
||||
else
|
||||
user << "<span class='alert'>Pressure: [round(pressure,0.1)] kPa</span>"
|
||||
if(total_moles)
|
||||
var/list/env_gases = environment.gases
|
||||
|
||||
environment.assert_gases(arglist(hardcoded_gases))
|
||||
var/o2_concentration = env_gases["o2"][MOLES]/total_moles
|
||||
var/n2_concentration = env_gases["n2"][MOLES]/total_moles
|
||||
var/co2_concentration = env_gases["co2"][MOLES]/total_moles
|
||||
var/plasma_concentration = env_gases["plasma"][MOLES]/total_moles
|
||||
environment.garbage_collect()
|
||||
|
||||
if(abs(n2_concentration - N2STANDARD) < 20)
|
||||
user << "<span class='info'>Nitrogen: [round(n2_concentration*100, 0.01)] %</span>"
|
||||
else
|
||||
user << "<span class='alert'>Nitrogen: [round(n2_concentration*100, 0.01)] %</span>"
|
||||
|
||||
if(abs(o2_concentration - O2STANDARD) < 2)
|
||||
user << "<span class='info'>Oxygen: [round(o2_concentration*100, 0.01)] %</span>"
|
||||
else
|
||||
user << "<span class='alert'>Oxygen: [round(o2_concentration*100, 0.01)] %</span>"
|
||||
|
||||
if(co2_concentration > 0.01)
|
||||
user << "<span class='alert'>CO2: [round(co2_concentration*100, 0.01)] %</span>"
|
||||
else
|
||||
user << "<span class='info'>CO2: [round(co2_concentration*100, 0.01)] %</span>"
|
||||
|
||||
if(plasma_concentration > 0.005)
|
||||
user << "<span class='alert'>Plasma: [round(plasma_concentration*100, 0.01)] %</span>"
|
||||
else
|
||||
user << "<span class='info'>Plasma: [round(plasma_concentration*100, 0.01)] %</span>"
|
||||
|
||||
|
||||
for(var/id in env_gases)
|
||||
if(id in hardcoded_gases)
|
||||
continue
|
||||
var/gas_concentration = env_gases[id][MOLES]/total_moles
|
||||
user << "<span class='alert'>[env_gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] %</span>"
|
||||
user << "<span class='info'>Temperature: [round(environment.temperature-T0C)] °C</span>"
|
||||
|
||||
|
||||
/obj/item/device/mass_spectrometer
|
||||
desc = "A hand-held mass spectrometer which identifies trace chemicals in a blood sample."
|
||||
name = "mass-spectrometer"
|
||||
icon_state = "spectrometer"
|
||||
item_state = "analyzer"
|
||||
w_class = 2
|
||||
flags = CONDUCT | OPENCONTAINER
|
||||
slot_flags = SLOT_BELT
|
||||
throwforce = 0
|
||||
throw_speed = 3
|
||||
throw_range = 7
|
||||
materials = list(MAT_METAL=150, MAT_GLASS=100)
|
||||
origin_tech = "magnets=2;biotech=1;plasmatech=2"
|
||||
var/details = 0
|
||||
|
||||
/obj/item/device/mass_spectrometer/New()
|
||||
..()
|
||||
create_reagents(5)
|
||||
|
||||
/obj/item/device/mass_spectrometer/on_reagent_change()
|
||||
if(reagents.total_volume)
|
||||
icon_state = initial(icon_state) + "_s"
|
||||
else
|
||||
icon_state = initial(icon_state)
|
||||
|
||||
/obj/item/device/mass_spectrometer/attack_self(mob/user)
|
||||
if (user.stat || user.eye_blind)
|
||||
return
|
||||
if (!user.IsAdvancedToolUser())
|
||||
user << "<span class='warning'>You don't have the dexterity to do this!</span>"
|
||||
return
|
||||
if(reagents.total_volume)
|
||||
var/list/blood_traces = list()
|
||||
for(var/datum/reagent/R in reagents.reagent_list)
|
||||
if(R.id != "blood")
|
||||
reagents.clear_reagents()
|
||||
user << "<span class='warning'>The sample was contaminated! Please insert another sample.</span>"
|
||||
return
|
||||
else
|
||||
blood_traces = params2list(R.data["trace_chem"])
|
||||
break
|
||||
var/dat = "<i><b>Trace Chemicals Found:</b>"
|
||||
if(!blood_traces.len)
|
||||
dat += "<br>None"
|
||||
else
|
||||
for(var/R in blood_traces)
|
||||
dat += "<br>[chemical_reagents_list[R]]"
|
||||
if(details)
|
||||
dat += " ([blood_traces[R]] units)"
|
||||
dat += "</i>"
|
||||
user << dat
|
||||
reagents.clear_reagents()
|
||||
|
||||
|
||||
/obj/item/device/mass_spectrometer/adv
|
||||
name = "advanced mass-spectrometer"
|
||||
icon_state = "adv_spectrometer"
|
||||
details = 1
|
||||
origin_tech = "magnets=4;biotech=3;plasmatech=3"
|
||||
|
||||
/obj/item/device/slime_scanner
|
||||
name = "slime scanner"
|
||||
desc = "A device that analyzes a slime's internal composition and measures its stats."
|
||||
icon_state = "adv_spectrometer"
|
||||
item_state = "analyzer"
|
||||
origin_tech = "biotech=2"
|
||||
w_class = 2
|
||||
flags = CONDUCT
|
||||
throwforce = 0
|
||||
throw_speed = 3
|
||||
throw_range = 7
|
||||
materials = list(MAT_METAL=30, MAT_GLASS=20)
|
||||
|
||||
/obj/item/device/slime_scanner/attack(mob/living/M, mob/living/user)
|
||||
if(user.stat || user.eye_blind)
|
||||
return
|
||||
if (!isslime(M))
|
||||
user << "<span class='warning'>This device can only scan slimes!</span>"
|
||||
return
|
||||
var/mob/living/simple_animal/slime/T = M
|
||||
user << "Slime scan results:"
|
||||
user << "[T.colour] [T.is_adult ? "adult" : "baby"] slime"
|
||||
user << "Nutrition: [T.nutrition]/[T.get_max_nutrition()]"
|
||||
if (T.nutrition < T.get_starve_nutrition())
|
||||
user << "<span class='warning'>Warning: slime is starving!</span>"
|
||||
else if (T.nutrition < T.get_hunger_nutrition())
|
||||
user << "<span class='warning'>Warning: slime is hungry</span>"
|
||||
user << "Electric change strength: [T.powerlevel]"
|
||||
user << "Health: [round(T.health/T.maxHealth,0.01)*100]"
|
||||
if (T.slime_mutation[4] == T.colour)
|
||||
user << "This slime does not evolve any further."
|
||||
else
|
||||
if (T.slime_mutation[3] == T.slime_mutation[4])
|
||||
if (T.slime_mutation[2] == T.slime_mutation[1])
|
||||
user << "Possible mutation: [T.slime_mutation[3]]"
|
||||
user << "Genetic destability: [T.mutation_chance/2] % chance of mutation on splitting"
|
||||
else
|
||||
user << "Possible mutations: [T.slime_mutation[1]], [T.slime_mutation[2]], [T.slime_mutation[3]] (x2)"
|
||||
user << "Genetic destability: [T.mutation_chance] % chance of mutation on splitting"
|
||||
else
|
||||
user << "Possible mutations: [T.slime_mutation[1]], [T.slime_mutation[2]], [T.slime_mutation[3]], [T.slime_mutation[4]]"
|
||||
user << "Genetic destability: [T.mutation_chance] % chance of mutation on splitting"
|
||||
if (T.cores > 1)
|
||||
user << "Anomalious slime core amount detected"
|
||||
user << "Growth progress: [T.amount_grown]/[SLIME_EVOLUTION_THRESHOLD]"
|
||||
@@ -0,0 +1,11 @@
|
||||
/obj/item/device/sensor_device
|
||||
name = "handheld crew monitor" //Thanks to Gun Hog for the name!
|
||||
desc = "A miniature machine that tracks suit sensors across the station."
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "scanner"
|
||||
w_class = 2
|
||||
slot_flags = SLOT_BELT
|
||||
origin_tech = "programming=3;materials=3;magnets=3"
|
||||
|
||||
/obj/item/device/sensor_device/attack_self(mob/user)
|
||||
crewmonitor.show(user) //Proc already exists, just had to call it
|
||||
@@ -0,0 +1,280 @@
|
||||
/obj/item/device/taperecorder
|
||||
name = "universal recorder"
|
||||
desc = "A device that can record to cassette tapes, and play them. It automatically translates the content in playback."
|
||||
icon_state = "taperecorder_empty"
|
||||
item_state = "analyzer"
|
||||
w_class = 2
|
||||
flags = HEAR
|
||||
slot_flags = SLOT_BELT
|
||||
languages_spoken = ALL //this is a translator, after all.
|
||||
languages_understood = ALL //this is a translator, after all.
|
||||
materials = list(MAT_METAL=60, MAT_GLASS=30)
|
||||
force = 2
|
||||
throwforce = 0
|
||||
var/recording = 0
|
||||
var/playing = 0
|
||||
var/playsleepseconds = 0
|
||||
var/obj/item/device/tape/mytape
|
||||
var/open_panel = 0
|
||||
var/canprint = 1
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/New()
|
||||
mytape = new /obj/item/device/tape/random(src)
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/examine(mob/user)
|
||||
..()
|
||||
user << "The wire panel is [open_panel ? "opened" : "closed"]."
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/attackby(obj/item/I, mob/user, params)
|
||||
if(!mytape && istype(I, /obj/item/device/tape))
|
||||
if(!user.unEquip(I))
|
||||
return
|
||||
I.loc = src
|
||||
mytape = I
|
||||
user << "<span class='notice'>You insert [I] into [src].</span>"
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/proc/eject(mob/user)
|
||||
if(mytape)
|
||||
user << "<span class='notice'>You remove [mytape] from [src].</span>"
|
||||
stop()
|
||||
user.put_in_hands(mytape)
|
||||
mytape = null
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/taperecorder/fire_act()
|
||||
mytape.ruin() //Fires destroy the tape
|
||||
return()
|
||||
|
||||
/obj/item/device/taperecorder/attack_hand(mob/user)
|
||||
if(loc == user)
|
||||
if(mytape)
|
||||
if(user.l_hand != src && user.r_hand != src)
|
||||
..()
|
||||
return
|
||||
eject(user)
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/proc/can_use(mob/user)
|
||||
if(user && ismob(user))
|
||||
if(!user.incapacitated())
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/verb/ejectverb()
|
||||
set name = "Eject Tape"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
if(!mytape)
|
||||
return
|
||||
|
||||
eject(usr)
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/update_icon()
|
||||
if(!mytape)
|
||||
icon_state = "taperecorder_empty"
|
||||
else if(recording)
|
||||
icon_state = "taperecorder_recording"
|
||||
else if(playing)
|
||||
icon_state = "taperecorder_playing"
|
||||
else
|
||||
icon_state = "taperecorder_idle"
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/Hear(message, atom/movable/speaker, message_langs, raw_message, radio_freq, spans)
|
||||
if(mytape && recording)
|
||||
mytape.timestamp += mytape.used_capacity
|
||||
mytape.storedinfo += "\[[time2text(mytape.used_capacity * 10,"mm:ss")]\] [message]"
|
||||
|
||||
/obj/item/device/taperecorder/verb/record()
|
||||
set name = "Start Recording"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
if(!mytape || mytape.ruined)
|
||||
return
|
||||
if(recording)
|
||||
return
|
||||
if(playing)
|
||||
return
|
||||
|
||||
if(mytape.used_capacity < mytape.max_capacity)
|
||||
usr << "<span class='notice'>Recording started.</span>"
|
||||
recording = 1
|
||||
update_icon()
|
||||
mytape.timestamp += mytape.used_capacity
|
||||
mytape.storedinfo += "\[[time2text(mytape.used_capacity * 10,"mm:ss")]\] Recording started."
|
||||
var/used = mytape.used_capacity //to stop runtimes when you eject the tape
|
||||
var/max = mytape.max_capacity
|
||||
for(used, used < max)
|
||||
if(recording == 0)
|
||||
break
|
||||
mytape.used_capacity++
|
||||
used++
|
||||
sleep(10)
|
||||
recording = 0
|
||||
update_icon()
|
||||
else
|
||||
usr << "<span class='notice'>The tape is full.</span>"
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/verb/stop()
|
||||
set name = "Stop"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
|
||||
if(recording)
|
||||
recording = 0
|
||||
mytape.timestamp += mytape.used_capacity
|
||||
mytape.storedinfo += "\[[time2text(mytape.used_capacity * 10,"mm:ss")]\] Recording stopped."
|
||||
usr << "<span class='notice'>Recording stopped.</span>"
|
||||
return
|
||||
else if(playing)
|
||||
playing = 0
|
||||
var/turf/T = get_turf(src)
|
||||
T.visible_message("<font color=Maroon><B>Tape Recorder</B>: Playback stopped.</font>")
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/verb/play()
|
||||
set name = "Play Tape"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
if(!mytape || mytape.ruined)
|
||||
return
|
||||
if(recording)
|
||||
return
|
||||
if(playing)
|
||||
return
|
||||
|
||||
playing = 1
|
||||
update_icon()
|
||||
usr << "<span class='notice'>Playing started.</span>"
|
||||
var/used = mytape.used_capacity //to stop runtimes when you eject the tape
|
||||
var/max = mytape.max_capacity
|
||||
for(var/i = 1, used < max, sleep(10 * playsleepseconds))
|
||||
if(!mytape)
|
||||
break
|
||||
if(playing == 0)
|
||||
break
|
||||
if(mytape.storedinfo.len < i)
|
||||
break
|
||||
say(mytape.storedinfo[i])
|
||||
if(mytape.storedinfo.len < i + 1)
|
||||
playsleepseconds = 1
|
||||
sleep(10)
|
||||
say("End of recording.")
|
||||
else
|
||||
playsleepseconds = mytape.timestamp[i + 1] - mytape.timestamp[i]
|
||||
if(playsleepseconds > 14)
|
||||
sleep(10)
|
||||
say("Skipping [playsleepseconds] seconds of silence")
|
||||
playsleepseconds = 1
|
||||
i++
|
||||
|
||||
playing = 0
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/attack_self(mob/user)
|
||||
if(!mytape || mytape.ruined)
|
||||
return
|
||||
if(recording)
|
||||
stop()
|
||||
else
|
||||
record()
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/verb/print_transcript()
|
||||
set name = "Print Transcript"
|
||||
set category = "Object"
|
||||
|
||||
if(!can_use(usr))
|
||||
return
|
||||
if(!mytape)
|
||||
return
|
||||
if(!canprint)
|
||||
usr << "<span class='notice'>The recorder can't print that fast!</span>"
|
||||
return
|
||||
if(recording || playing)
|
||||
return
|
||||
|
||||
usr << "<span class='notice'>Transcript printed.</span>"
|
||||
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(get_turf(src))
|
||||
var/t1 = "<B>Transcript:</B><BR><BR>"
|
||||
for(var/i = 1, mytape.storedinfo.len >= i, i++)
|
||||
t1 += "[mytape.storedinfo[i]]<BR>"
|
||||
P.info = t1
|
||||
P.name = "paper- 'Transcript'"
|
||||
usr.put_in_hands(P)
|
||||
canprint = 0
|
||||
sleep(300)
|
||||
canprint = 1
|
||||
|
||||
|
||||
//empty tape recorders
|
||||
/obj/item/device/taperecorder/empty/New()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/tape
|
||||
name = "tape"
|
||||
desc = "A magnetic tape that can hold up to ten minutes of content."
|
||||
icon_state = "tape_white"
|
||||
item_state = "analyzer"
|
||||
w_class = 1
|
||||
materials = list(MAT_METAL=20, MAT_GLASS=5)
|
||||
force = 1
|
||||
throwforce = 0
|
||||
var/max_capacity = 600
|
||||
var/used_capacity = 0
|
||||
var/list/storedinfo = list()
|
||||
var/list/timestamp = list()
|
||||
var/ruined = 0
|
||||
|
||||
/obj/item/device/tape/fire_act()
|
||||
ruin()
|
||||
|
||||
/obj/item/device/tape/attack_self(mob/user)
|
||||
if(!ruined)
|
||||
user << "<span class='notice'>You pull out all the tape!</span>"
|
||||
ruin()
|
||||
|
||||
|
||||
/obj/item/device/tape/proc/ruin()
|
||||
add_overlay("ribbonoverlay")
|
||||
ruined = 1
|
||||
|
||||
|
||||
/obj/item/device/tape/proc/fix()
|
||||
overlays -= "ribbonoverlay"
|
||||
ruined = 0
|
||||
|
||||
|
||||
/obj/item/device/tape/attackby(obj/item/I, mob/user, params)
|
||||
if(ruined && istype(I, /obj/item/weapon/screwdriver))
|
||||
user << "<span class='notice'>You start winding the tape back in...</span>"
|
||||
if(do_after(user, 120/I.toolspeed, target = src))
|
||||
user << "<span class='notice'>You wound the tape back in.</span>"
|
||||
fix()
|
||||
|
||||
|
||||
//Random colour tapes
|
||||
/obj/item/device/tape/random/New()
|
||||
icon_state = "tape_[pick("white", "blue", "red", "yellow", "purple")]"
|
||||
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
|
||||
Miscellaneous traitor devices
|
||||
|
||||
BATTERER
|
||||
|
||||
RADIOACTIVE MICROLASER
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
The Batterer, like a flashbang but 50% chance to knock people over. Can be either very
|
||||
effective or pretty fucking useless.
|
||||
|
||||
*/
|
||||
|
||||
/obj/item/device/batterer
|
||||
name = "mind batterer"
|
||||
desc = "A strange device with twin antennas."
|
||||
icon_state = "batterer"
|
||||
throwforce = 5
|
||||
w_class = 1
|
||||
throw_speed = 3
|
||||
throw_range = 7
|
||||
flags = CONDUCT
|
||||
item_state = "electronic"
|
||||
origin_tech = "magnets=3;combat=3;syndicate=3"
|
||||
|
||||
var/times_used = 0 //Number of times it's been used.
|
||||
var/max_uses = 2
|
||||
|
||||
|
||||
/obj/item/device/batterer/attack_self(mob/living/carbon/user, flag = 0, emp = 0)
|
||||
if(!user) return
|
||||
if(times_used >= max_uses)
|
||||
user << "<span class='danger'>The mind batterer has been burnt out!</span>"
|
||||
return
|
||||
|
||||
add_logs(user, null, "knocked down people in the area", src)
|
||||
|
||||
for(var/mob/living/carbon/human/M in urange(10, user, 1))
|
||||
if(prob(50))
|
||||
|
||||
M.Weaken(rand(10,20))
|
||||
if(prob(25))
|
||||
M.Stun(rand(5,10))
|
||||
M << "<span class='userdanger'>You feel a tremendous, paralyzing wave flood your mind.</span>"
|
||||
|
||||
else
|
||||
M << "<span class='userdanger'>You feel a sudden, electric jolt travel through your head.</span>"
|
||||
|
||||
playsound(src.loc, 'sound/misc/interference.ogg', 50, 1)
|
||||
user << "<span class='notice'>You trigger [src].</span>"
|
||||
times_used += 1
|
||||
if(times_used >= max_uses)
|
||||
icon_state = "battererburnt"
|
||||
|
||||
/*
|
||||
The radioactive microlaser, a device disguised as a health analyzer used to irradiate people.
|
||||
|
||||
The strength of the radiation is determined by the 'intensity' setting, while the delay between
|
||||
the scan and the irradiation kicking in is determined by the wavelength.
|
||||
|
||||
Each scan will cause the microlaser to have a brief cooldown period. Higher intensity will increase
|
||||
the cooldown, while higher wavelength will decrease it.
|
||||
|
||||
Wavelength is also slightly increased by the intensity as well.
|
||||
*/
|
||||
|
||||
/obj/item/device/healthanalyzer/rad_laser
|
||||
materials = list(MAT_METAL=400)
|
||||
origin_tech = "magnets=3;biotech=5;syndicate=3"
|
||||
var/irradiate = 1
|
||||
var/intensity = 10 // how much damage the radiation does
|
||||
var/wavelength = 10 // time it takes for the radiation to kick in, in seconds
|
||||
var/used = 0 // is it cooling down?
|
||||
|
||||
/obj/item/device/healthanalyzer/rad_laser/attack(mob/living/M, mob/living/user)
|
||||
..()
|
||||
if(!irradiate)
|
||||
return
|
||||
if(!used)
|
||||
add_logs(user, M, "irradiated", src)
|
||||
var/cooldown = round(max(10, (intensity*5 - wavelength/4))) * 10
|
||||
used = 1
|
||||
icon_state = "health1"
|
||||
handle_cooldown(cooldown) // splits off to handle the cooldown while handling wavelength
|
||||
user << "<span class='warning'>Successfully irradiated [M].</span>"
|
||||
spawn((wavelength+(intensity*4))*5)
|
||||
if(M)
|
||||
if(intensity >= 5)
|
||||
M.apply_effect(round(intensity/1.5), PARALYZE)
|
||||
M.rad_act(intensity*10)
|
||||
else
|
||||
user << "<span class='warning'>The radioactive microlaser is still recharging.</span>"
|
||||
|
||||
/obj/item/device/healthanalyzer/rad_laser/proc/handle_cooldown(cooldown)
|
||||
spawn(cooldown)
|
||||
used = 0
|
||||
icon_state = "health"
|
||||
|
||||
/obj/item/device/healthanalyzer/rad_laser/attack_self(mob/user)
|
||||
interact(user)
|
||||
|
||||
/obj/item/device/healthanalyzer/rad_laser/interact(mob/user)
|
||||
user.set_machine(src)
|
||||
|
||||
var/cooldown = round(max(10, (intensity*5 - wavelength/4)))
|
||||
var/dat = "Irradiation: <A href='?src=\ref[src];rad=1'>[irradiate ? "On" : "Off"]</A><br>"
|
||||
dat += "Scan Mode: <a href='?src=\ref[src];mode=1'>"
|
||||
if(!scanmode)
|
||||
dat += "Scan Health"
|
||||
else if(scanmode == 1)
|
||||
dat += "Scan Reagents"
|
||||
else
|
||||
dat += "Disabled"
|
||||
dat += "</a><br><br>"
|
||||
|
||||
dat += {"
|
||||
Radiation Intensity:
|
||||
<A href='?src=\ref[src];radint=-5'>-</A><A href='?src=\ref[src];radint=-1'>-</A>
|
||||
[intensity]
|
||||
<A href='?src=\ref[src];radint=1'>+</A><A href='?src=\ref[src];radint=5'>+</A><BR>
|
||||
|
||||
Radiation Wavelength:
|
||||
<A href='?src=\ref[src];radwav=-5'>-</A><A href='?src=\ref[src];radwav=-1'>-</A>
|
||||
[(wavelength+(intensity*4))]
|
||||
<A href='?src=\ref[src];radwav=1'>+</A><A href='?src=\ref[src];radwav=5'>+</A><BR>
|
||||
Laser Cooldown: [cooldown] Seconds<BR>
|
||||
"}
|
||||
|
||||
var/datum/browser/popup = new(user, "radlaser", "Radioactive Microlaser Interface", 400, 240)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
/obj/item/device/healthanalyzer/rad_laser/Topic(href, href_list)
|
||||
if(!usr.canUseTopic(src))
|
||||
return 1
|
||||
|
||||
usr.set_machine(src)
|
||||
if(href_list["rad"])
|
||||
irradiate = !irradiate
|
||||
|
||||
else if(href_list["mode"])
|
||||
scanmode += 1
|
||||
if(scanmode > 2)
|
||||
scanmode = 0
|
||||
|
||||
else if(href_list["radint"])
|
||||
var/amount = text2num(href_list["radint"])
|
||||
amount += intensity
|
||||
intensity = max(1,(min(20,amount)))
|
||||
|
||||
else if(href_list["radwav"])
|
||||
var/amount = text2num(href_list["radwav"])
|
||||
amount += wavelength
|
||||
wavelength = max(0,(min(120,amount)))
|
||||
|
||||
attack_self(usr)
|
||||
add_fingerprint(usr)
|
||||
return
|
||||
|
||||
/obj/item/device/shadowcloak
|
||||
name = "cloaker belt"
|
||||
desc = "Makes you invisible for short periods of time. Recharges in darkness."
|
||||
icon = 'icons/obj/clothing/belts.dmi'
|
||||
icon_state = "utilitybelt"
|
||||
item_state = "utility"
|
||||
slot_flags = SLOT_BELT
|
||||
attack_verb = list("whipped", "lashed", "disciplined")
|
||||
|
||||
var/mob/living/carbon/human/user = null
|
||||
var/charge = 300
|
||||
var/max_charge = 300
|
||||
var/on = 0
|
||||
var/old_alpha = 0
|
||||
actions_types = list(/datum/action/item_action/toggle)
|
||||
|
||||
/obj/item/device/shadowcloak/ui_action_click(mob/user)
|
||||
if(user.get_item_by_slot(slot_belt) == src)
|
||||
if(!on)
|
||||
Activate(usr)
|
||||
else
|
||||
Deactivate()
|
||||
return
|
||||
|
||||
/obj/item/device/shadowcloak/item_action_slot_check(slot, mob/user)
|
||||
if(slot == slot_belt)
|
||||
return 1
|
||||
|
||||
/obj/item/device/shadowcloak/proc/Activate(mob/living/carbon/human/user)
|
||||
if(!user)
|
||||
return
|
||||
user << "<span class='notice'>You activate [src].</span>"
|
||||
src.user = user
|
||||
START_PROCESSING(SSobj, src)
|
||||
old_alpha = user.alpha
|
||||
on = 1
|
||||
|
||||
/obj/item/device/shadowcloak/proc/Deactivate()
|
||||
user << "<span class='notice'>You deactivate [src].</span>"
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
if(user)
|
||||
user.alpha = old_alpha
|
||||
on = 0
|
||||
user = null
|
||||
|
||||
/obj/item/device/shadowcloak/dropped(mob/user)
|
||||
..()
|
||||
if(user && user.get_item_by_slot(slot_belt) != src)
|
||||
Deactivate()
|
||||
|
||||
/obj/item/device/shadowcloak/process()
|
||||
if(user.get_item_by_slot(slot_belt) != src)
|
||||
Deactivate()
|
||||
return
|
||||
var/turf/T = get_turf(src)
|
||||
if(on)
|
||||
var/lumcount = T.get_lumcount()
|
||||
if(lumcount > 3)
|
||||
charge = max(0,charge - 25)//Quick decrease in light
|
||||
else
|
||||
charge = min(max_charge,charge + 50) //Charge in the dark
|
||||
animate(user,alpha = Clamp(255 - charge,0,255),time = 10)
|
||||
@@ -0,0 +1,213 @@
|
||||
/obj/item/device/transfer_valve
|
||||
icon = 'icons/obj/assemblies.dmi'
|
||||
name = "tank transfer valve"
|
||||
icon_state = "valve_1"
|
||||
item_state = "ttv"
|
||||
desc = "Regulates the transfer of air between two tanks"
|
||||
var/obj/item/weapon/tank/tank_one
|
||||
var/obj/item/weapon/tank/tank_two
|
||||
var/obj/item/device/attached_device
|
||||
var/mob/attacher = null
|
||||
var/valve_open = 0
|
||||
var/toggle = 1
|
||||
origin_tech = "materials=1;engineering=1"
|
||||
|
||||
/obj/item/device/transfer_valve/IsAssemblyHolder()
|
||||
return 1
|
||||
|
||||
/obj/item/device/transfer_valve/attackby(obj/item/item, mob/user, params)
|
||||
if(istype(item, /obj/item/weapon/tank))
|
||||
if(tank_one && tank_two)
|
||||
user << "<span class='warning'>There are already two tanks attached, remove one first!</span>"
|
||||
return
|
||||
|
||||
if(!tank_one)
|
||||
if(!user.unEquip(item))
|
||||
return
|
||||
tank_one = item
|
||||
item.loc = src
|
||||
user << "<span class='notice'>You attach the tank to the transfer valve.</span>"
|
||||
if(item.w_class > w_class)
|
||||
w_class = item.w_class
|
||||
else if(!tank_two)
|
||||
if(!user.unEquip(item))
|
||||
return
|
||||
tank_two = item
|
||||
item.loc = src
|
||||
user << "<span class='notice'>You attach the tank to the transfer valve.</span>"
|
||||
if(item.w_class > w_class)
|
||||
w_class = item.w_class
|
||||
|
||||
update_icon()
|
||||
//TODO: Have this take an assemblyholder
|
||||
else if(isassembly(item))
|
||||
var/obj/item/device/assembly/A = item
|
||||
if(A.secured)
|
||||
user << "<span class='notice'>The device is secured.</span>"
|
||||
return
|
||||
if(attached_device)
|
||||
user << "<span class='warning'>There is already a device attached to the valve, remove it first!</span>"
|
||||
return
|
||||
user.remove_from_mob(item)
|
||||
attached_device = A
|
||||
A.loc = src
|
||||
user << "<span class='notice'>You attach the [item] to the valve controls and secure it.</span>"
|
||||
A.holder = src
|
||||
A.toggle_secure() //this calls update_icon(), which calls update_icon() on the holder (i.e. the bomb).
|
||||
|
||||
bombers += "[key_name(user)] attached a [item] to a transfer valve."
|
||||
message_admins("[key_name_admin(user)] attached a [item] to a transfer valve.")
|
||||
log_game("[key_name_admin(user)] attached a [item] to a transfer valve.")
|
||||
attacher = user
|
||||
return
|
||||
|
||||
/obj/item/device/transfer_valve/attack_self(mob/user)
|
||||
user.set_machine(src)
|
||||
var/dat = {"<B> Valve properties: </B>
|
||||
<BR> <B> Attachment one:</B> [tank_one] [tank_one ? "<A href='?src=\ref[src];tankone=1'>Remove</A>" : ""]
|
||||
<BR> <B> Attachment two:</B> [tank_two] [tank_two ? "<A href='?src=\ref[src];tanktwo=1'>Remove</A>" : ""]
|
||||
<BR> <B> Valve attachment:</B> [attached_device ? "<A href='?src=\ref[src];device=1'>[attached_device]</A>" : "None"] [attached_device ? "<A href='?src=\ref[src];rem_device=1'>Remove</A>" : ""]
|
||||
<BR> <B> Valve status: </B> [ valve_open ? "<A href='?src=\ref[src];open=1'>Closed</A> <B>Open</B>" : "<B>Closed</B> <A href='?src=\ref[src];open=1'>Open</A>"]"}
|
||||
|
||||
var/datum/browser/popup = new(user, "trans_valve", name)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
return
|
||||
|
||||
/obj/item/device/transfer_valve/Topic(href, href_list)
|
||||
..()
|
||||
if ( usr.stat || usr.restrained() )
|
||||
return
|
||||
if (src.loc == usr)
|
||||
if(tank_one && href_list["tankone"])
|
||||
split_gases()
|
||||
valve_open = 0
|
||||
tank_one.loc = get_turf(src)
|
||||
tank_one = null
|
||||
update_icon()
|
||||
if((!tank_two || tank_two.w_class < 4) && (w_class > 3))
|
||||
w_class = 3
|
||||
else if(tank_two && href_list["tanktwo"])
|
||||
split_gases()
|
||||
valve_open = 0
|
||||
tank_two.loc = get_turf(src)
|
||||
tank_two = null
|
||||
update_icon()
|
||||
if((!tank_one || tank_one.w_class < 4) && (w_class > 3))
|
||||
w_class = 3
|
||||
else if(href_list["open"])
|
||||
toggle_valve()
|
||||
else if(attached_device)
|
||||
if(href_list["rem_device"])
|
||||
attached_device.loc = get_turf(src)
|
||||
attached_device:holder = null
|
||||
attached_device = null
|
||||
update_icon()
|
||||
if(href_list["device"])
|
||||
attached_device.attack_self(usr)
|
||||
|
||||
src.attack_self(usr)
|
||||
src.add_fingerprint(usr)
|
||||
return
|
||||
return
|
||||
|
||||
/obj/item/device/transfer_valve/proc/process_activation(obj/item/device/D)
|
||||
if(toggle)
|
||||
toggle = 0
|
||||
toggle_valve()
|
||||
spawn(50) // To stop a signal being spammed from a proxy sensor constantly going off or whatever
|
||||
toggle = 1
|
||||
|
||||
/obj/item/device/transfer_valve/update_icon()
|
||||
cut_overlays()
|
||||
underlays = null
|
||||
|
||||
if(!tank_one && !tank_two && !attached_device)
|
||||
icon_state = "valve_1"
|
||||
return
|
||||
icon_state = "valve"
|
||||
|
||||
if(tank_one)
|
||||
add_overlay("[tank_one.icon_state]")
|
||||
if(tank_two)
|
||||
var/icon/J = new(icon, icon_state = "[tank_two.icon_state]")
|
||||
J.Shift(WEST, 13)
|
||||
underlays += J
|
||||
if(attached_device)
|
||||
add_overlay("device")
|
||||
|
||||
/obj/item/device/transfer_valve/proc/merge_gases()
|
||||
tank_two.air_contents.volume += tank_one.air_contents.volume
|
||||
var/datum/gas_mixture/temp
|
||||
temp = tank_one.air_contents.remove_ratio(1)
|
||||
tank_two.air_contents.merge(temp)
|
||||
|
||||
/obj/item/device/transfer_valve/proc/split_gases()
|
||||
if (!valve_open || !tank_one || !tank_two)
|
||||
return
|
||||
var/ratio1 = tank_one.air_contents.volume/tank_two.air_contents.volume
|
||||
var/datum/gas_mixture/temp
|
||||
temp = tank_two.air_contents.remove_ratio(ratio1)
|
||||
tank_one.air_contents.merge(temp)
|
||||
tank_two.air_contents.volume -= tank_one.air_contents.volume
|
||||
|
||||
/*
|
||||
Exadv1: I know this isn't how it's going to work, but this was just to check
|
||||
it explodes properly when it gets a signal (and it does).
|
||||
*/
|
||||
|
||||
/obj/item/device/transfer_valve/proc/toggle_valve()
|
||||
if(!valve_open && tank_one && tank_two)
|
||||
valve_open = 1
|
||||
var/turf/bombturf = get_turf(src)
|
||||
var/area/A = get_area(bombturf)
|
||||
|
||||
var/attachment = "no device"
|
||||
if(attached_device)
|
||||
if(istype(attached_device, /obj/item/device/assembly/signaler))
|
||||
attachment = "<A HREF='?_src_=holder;secrets=list_signalers'>[attached_device]</A>"
|
||||
else
|
||||
attachment = attached_device
|
||||
|
||||
var/attacher_name = ""
|
||||
if(!attacher)
|
||||
attacher_name = "Unknown"
|
||||
else
|
||||
attacher_name = "[key_name_admin(attacher)]"
|
||||
|
||||
var/log_str1 = "Bomb valve opened in "
|
||||
var/log_str2 = "with [attachment] attacher: [attacher_name]"
|
||||
|
||||
var/log_attacher = ""
|
||||
if(attacher)
|
||||
log_attacher = "(<A HREF='?_src_=holder;adminmoreinfo=\ref[attacher]'>?</A>) (<A HREF='?_src_=holder;adminplayerobservefollow=\ref[attacher]'>FLW</A>)"
|
||||
|
||||
var/mob/mob = get_mob_by_key(src.fingerprintslast)
|
||||
var/last_touch_info = ""
|
||||
if(mob)
|
||||
last_touch_info = "(<A HREF='?_src_=holder;adminmoreinfo=\ref[mob]'>?</A>) (<A HREF='?_src_=holder;adminplayerobservefollow=\ref[mob]'>FLW</A>)"
|
||||
|
||||
var/log_str3 = " Last touched by: [key_name_admin(mob)]"
|
||||
|
||||
var/bomb_message = "[log_str1] <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[bombturf.x];Y=[bombturf.y];Z=[bombturf.z]'>[A.name]</a> [log_str2][log_attacher] [log_str3][last_touch_info]"
|
||||
|
||||
bombers += bomb_message
|
||||
|
||||
message_admins(bomb_message, 0, 1)
|
||||
log_game("[log_str1] [A.name]([A.x],[A.y],[A.z]) [log_str2] [log_str3]")
|
||||
merge_gases()
|
||||
spawn(20) // In case one tank bursts
|
||||
for (var/i=0,i<5,i++)
|
||||
src.update_icon()
|
||||
sleep(10)
|
||||
src.update_icon()
|
||||
|
||||
else if(valve_open && tank_one && tank_two)
|
||||
split_gases()
|
||||
valve_open = 0
|
||||
src.update_icon()
|
||||
|
||||
// this doesn't do anything but the timer etc. expects it to be here
|
||||
// eventually maybe have it update icon to show state (timer, prox etc.) like old bombs
|
||||
/obj/item/device/transfer_valve/proc/c_state()
|
||||
return
|
||||
Reference in New Issue
Block a user