mirror of
https://github.com/CHOMPstation/CHOMPstation.git
synced 2026-08-30 07:26:39 +01:00
Polaris December Sync
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
//The case the paddles are kept in.
|
||||
/obj/item/device/defib_kit
|
||||
name = "defibrillator kit"
|
||||
desc = "This KHI-branded defib kit is a semi-automated model. Remove pads, slap on chest, wait."
|
||||
icon = 'icons/obj/device.dmi'
|
||||
icon_state = "defib_kit"
|
||||
w_class = ITEMSIZE_LARGE
|
||||
|
||||
var/state //0 off, 1 open, 2 working, 3 dead
|
||||
var/uses = 2 //Calculates initial uses based on starting cell size
|
||||
var/chance = 75 //Percent chance of working
|
||||
var/charge_cost //Set in New() based on uses
|
||||
var/obj/item/weapon/cell/cell //The size is mostly irrelevant, see 'uses'
|
||||
var/mob/living/carbon/human/patient //The person the paddles are on
|
||||
|
||||
/obj/item/device/defib_kit/New()
|
||||
..()
|
||||
//Create cell and determine uses (futureproofing against cell size changes)
|
||||
cell = new(src)
|
||||
charge_cost = cell.maxcharge / uses
|
||||
statechange(0)
|
||||
|
||||
/obj/item/device/defib_kit/attack_self(mob/user as mob)
|
||||
..()
|
||||
if(patient)
|
||||
patient = null
|
||||
user.visible_message("<span class='notice'>[user] returns the pads to \the [src] and closes it.</span>",
|
||||
"<span class='notice'>You return the pads to \the [src] and close it.</span>")
|
||||
statechange(0)
|
||||
|
||||
/obj/item/device/defib_kit/MouseDrop(var/mob/living/carbon/human/onto)
|
||||
if(istype(onto) && Adjacent(usr) && !usr.restrained() && !usr.stat)
|
||||
var/mob/living/carbon/human/user = usr
|
||||
//<--Feel free to code clothing checks right here
|
||||
user.visible_message("<span class='warning'>[user] begins applying defib pads to [onto].</span>",
|
||||
"<span class='warning'>You begin applying defib pads to [onto].</span>")
|
||||
if(do_after(user, 100, onto))
|
||||
patient = onto
|
||||
statechange(1,patient)
|
||||
user.visible_message("<span class='warning'>[user] applies defib pads to [onto].</span>",
|
||||
"<span class='warning'>You finish applying defib pads to [onto].</span>")
|
||||
|
||||
/obj/item/device/defib_kit/attackby(var/obj/item/A as obj, mob/living/user as mob)
|
||||
..()
|
||||
|
||||
if(!cell && istype(A,/obj/item/weapon/cell))
|
||||
if(!user.unEquip(A)) return
|
||||
to_chat(user,"You jack \the [A] into \the [src]'s battery mount.")
|
||||
A.forceMove(src)
|
||||
src.cell = A
|
||||
|
||||
else if(istype(A,/obj/item/weapon/screwdriver))
|
||||
if(cell)
|
||||
to_chat(user,"<span class='notice'>You remove \the [cell] from \the [src].</span>")
|
||||
if(user.r_hand && user.l_hand)
|
||||
cell.forceMove(get_turf(user))
|
||||
else
|
||||
cell.forceMove(user.put_in_hands(cell))
|
||||
cell = null
|
||||
playsound(src.loc, 'sound/items/Screwdriver.ogg', 50, 1)
|
||||
else
|
||||
to_chat(user,"<span class='warning'>The power source has already been removed!</span>")
|
||||
|
||||
/obj/item/device/defib_kit/proc/statechange(var/new_state, var/pat)
|
||||
if(state == new_state) return //Let's just save ourselves some time
|
||||
state = new_state
|
||||
icon_state = "[initial(icon_state)][state]"
|
||||
var/turf/T = get_turf(src)
|
||||
var/state_words = ""
|
||||
switch(state)
|
||||
if(0)
|
||||
state_words = "It is currently closed."
|
||||
processing_objects -= src
|
||||
if(1)
|
||||
state_words = "A green light is lit; it has charge."
|
||||
processing_objects |= src
|
||||
if(2)
|
||||
state_words = "A yellow light is flashing: it's in the process of reviving a patient."
|
||||
T.visible_message("<span class='notice'>A yellow light starts flashing on \the [src].</span>")
|
||||
playsound(T, 'sound/machines/chime.ogg', 50, 0)
|
||||
if(3)
|
||||
state_words = "A red light is flashing: the battery needs to be recharged."
|
||||
T.visible_message("<span class='warning'>A red light starts flashing on \the [src].</span>")
|
||||
playsound(T, 'sound/machines/buzz-sigh.ogg', 50, 0)
|
||||
|
||||
desc = "[initial(desc)] [state_words][pat ? " The pads are attached to [pat]." : ""]"
|
||||
update_icon()
|
||||
|
||||
/obj/item/device/defib_kit/process()
|
||||
if(!state) //0 or null
|
||||
statechange(0)
|
||||
processing_objects -= src
|
||||
return
|
||||
|
||||
//Patient moved too far
|
||||
if(patient && !(get_dist(src,patient) <= 1)) //You separated the kit and pads too far
|
||||
audible_message("<span class='warning'>There's a clatter as the defib pads are yanked off of [patient].</span>")
|
||||
statechange(0)
|
||||
patient = null
|
||||
return
|
||||
|
||||
//Battery died
|
||||
if(!cell || cell.charge < charge_cost)
|
||||
statechange(3,patient)
|
||||
return
|
||||
|
||||
//A patient isn't being worked on, but we have one, so start
|
||||
if(patient && patient.stat == DEAD && state != 2)
|
||||
statechange(2)
|
||||
if(attempt_shock()) //Try to shock them, has timer and such
|
||||
patient.visible_message("<span class='warning'>[patient] convulses!</span>")
|
||||
playsound(src.loc, 'sound/effects/sparks2.ogg', 75, 1)
|
||||
//Actual rezzing code
|
||||
if(prob(chance) && ((world.time - patient.timeofdeath) < (10 MINUTES))) //Can only revive within a few minutes
|
||||
if(!patient.client && patient.mind) //Don't force the dead person to come back if they don't want to.
|
||||
for(var/mob/observer/dead/ghost in player_list)
|
||||
if(ghost.mind == patient.mind)
|
||||
to_chat(ghost, "<b><font color = #330033><font size = 3>Someone is trying to \
|
||||
revive you. Return to your body if you want to be revived!</b> \
|
||||
(Verbs -> Ghost -> Re-enter corpse). You have 15 seconds to do this!</font></font>")
|
||||
sleep(15 SECONDS)
|
||||
break
|
||||
|
||||
if(patient.client)
|
||||
patient.adjustOxyLoss(-20) //Look, blood stays oxygenated for quite some time, but I'm not recoding the entire oxy system
|
||||
patient.stat = CONSCIOUS //Note that if whatever killed them in the first place wasn't fixed, they're likely to die again.
|
||||
dead_mob_list -= patient
|
||||
living_mob_list += patient
|
||||
patient.timeofdeath = null
|
||||
patient.visible_message("<span class='notice'>[patient]'s eyes open!</span>")
|
||||
log_and_message_admins("[patient] was revived.")
|
||||
cell.charge -= charge_cost //Always charge the cost after any attempt, failed or not
|
||||
sleep(20) //Wait 2 seconds before next attempt
|
||||
statechange(1,patient) //Back to ready
|
||||
|
||||
/obj/item/device/defib_kit/proc/attempt_shock()
|
||||
if(!patient || cell.charge < charge_cost)
|
||||
return
|
||||
|
||||
var/zap_time = world.time + (7 SECONDS)
|
||||
var/o_patient_loc = patient.loc
|
||||
. = 1
|
||||
|
||||
while(world.time < zap_time) //This is basically a custom do_after() call
|
||||
sleep(1)
|
||||
|
||||
//Failed: We lost something important
|
||||
if(!patient || !cell || cell.charge < charge_cost)
|
||||
. = 0
|
||||
break
|
||||
|
||||
//Failed: The locations aren't right
|
||||
if((o_patient_loc != patient.loc) || !(get_dist(src,patient) <= 1))
|
||||
. = 0
|
||||
break
|
||||
|
||||
return
|
||||
@@ -274,6 +274,8 @@ var/global/list/default_medbay_channels = list(
|
||||
// Fix for permacell radios, but kinda eh about actually fixing them.
|
||||
if(!M || !message) return 0
|
||||
|
||||
if(speaking && (speaking.flags & (SIGNLANG|NONVERBAL))) return 0
|
||||
|
||||
if(istype(M)) M.trigger_aiming(TARGET_CAN_RADIO)
|
||||
|
||||
// Uncommenting this. To the above comment:
|
||||
|
||||
@@ -69,7 +69,7 @@ REAGENT SCANNER
|
||||
user.show_message("<span class='notice'>Analyzing Results for [M]:</span>")
|
||||
user.show_message("<span class='notice'>Overall Status: dead</span>")
|
||||
else
|
||||
user.show_message("<span class='notice'>Analyzing Results for [M]:\n\t Overall Status: [M.stat > 1 ? "dead" : "[round(M.health/M.maxHealth)*100]% healthy"]</span>")
|
||||
user.show_message("<span class='notice'>Analyzing Results for [M]:\n\t Overall Status: [M.stat > 1 ? "dead" : "[round((M.health/M.maxHealth)*100) ]% healthy"]</span>")
|
||||
user.show_message("<span class='notice'> Key: <font color='blue'>Suffocation</font>/<font color='green'>Toxin</font>/<font color='#FFA500'>Burns</font>/<font color='red'>Brute</font></span>", 1)
|
||||
user.show_message("<span class='notice'> Damage Specifics: <font color='blue'>[OX]</font> - <font color='green'>[TX]</font> - <font color='#FFA500'>[BU]</font> - <font color='red'>[BR]</font></span>")
|
||||
user.show_message("<span class='notice'>Body Temperature: [M.bodytemperature-T0C]°C ([M.bodytemperature*1.8-459.67]°F)</span>", 1)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/obj/item/device/taperecorder
|
||||
name = "universal recorder"
|
||||
desc = "A device that can record up to an hour of dialogue and play it back. It automatically translates the content in playback."
|
||||
icon_state = "taperecorderidle"
|
||||
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 = ITEMSIZE_SMALL
|
||||
|
||||
@@ -10,33 +10,100 @@
|
||||
var/emagged = 0.0
|
||||
var/recording = 0.0
|
||||
var/playing = 0.0
|
||||
var/timerecorded = 0.0
|
||||
var/playsleepseconds = 0.0
|
||||
var/list/storedinfo = new/list()
|
||||
var/list/timestamp = new/list()
|
||||
var/obj/item/device/tape/mytape = /obj/item/device/tape/random
|
||||
var/canprint = 1
|
||||
|
||||
flags = CONDUCT
|
||||
slot_flags = SLOT_BELT
|
||||
throwforce = 2
|
||||
throw_speed = 4
|
||||
throw_range = 20
|
||||
show_messages = 1
|
||||
|
||||
/obj/item/device/taperecorder/New()
|
||||
..()
|
||||
if(ispath(mytape))
|
||||
mytape = new mytape(src)
|
||||
update_icon()
|
||||
listening_objects += src
|
||||
|
||||
/obj/item/device/taperecorder/empty
|
||||
mytape = null
|
||||
|
||||
/obj/item/device/taperecorder/Destroy()
|
||||
listening_objects -= src
|
||||
if(mytape)
|
||||
qdel(mytape)
|
||||
mytape = null
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/device/tape))
|
||||
if(mytape)
|
||||
to_chat(user, "<span class='notice'>There's already a tape inside.</span>")
|
||||
return
|
||||
if(!user.unEquip(I))
|
||||
return
|
||||
I.forceMove(src)
|
||||
mytape = I
|
||||
to_chat(user, "<span class='notice'>You insert [I] into [src].</span>")
|
||||
update_icon()
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/fire_act()
|
||||
if(mytape)
|
||||
mytape.ruin() //Fires destroy the tape
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/attack_hand(mob/user)
|
||||
if(user.get_inactive_hand() == src)
|
||||
if(mytape)
|
||||
eject()
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/verb/eject()
|
||||
set name = "Eject Tape"
|
||||
set category = "Object"
|
||||
|
||||
if(usr.incapacitated())
|
||||
return
|
||||
if(!mytape)
|
||||
to_chat(usr, "<span class='notice'>There's no tape in \the [src].</span>")
|
||||
return
|
||||
if(emagged)
|
||||
to_chat(usr, "<span class='notice'>The tape seems to be stuck inside.</span>")
|
||||
return
|
||||
|
||||
if(playing || recording)
|
||||
stop()
|
||||
to_chat(usr, "<span class='notice'>You remove [mytape] from [src].</span>")
|
||||
usr.put_in_hands(mytape)
|
||||
mytape = null
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/hear_talk(mob/living/M as mob, msg, var/verb="says", datum/language/speaking=null)
|
||||
if(recording)
|
||||
timestamp += timerecorded
|
||||
if(mytape && recording)
|
||||
|
||||
if(speaking)
|
||||
storedinfo += "\[[time2text(timerecorded*10,"mm:ss")]\] [M.name] [speaking.format_message_plain(msg, verb)]"
|
||||
if(!speaking.machine_understands)
|
||||
msg = speaking.scramble(msg)
|
||||
mytape.record_speech("[M.name] [speaking.format_message_plain(msg, verb)]")
|
||||
else
|
||||
storedinfo += "\[[time2text(timerecorded*10,"mm:ss")]\] [M.name] [verb], \"[msg]\""
|
||||
mytape.record_speech("[M.name] [verb], \"[msg]\"")
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/see_emote(mob/M as mob, text, var/emote_type)
|
||||
if(emote_type != 2) //only hearable emotes
|
||||
return
|
||||
if(recording)
|
||||
timestamp += timerecorded
|
||||
storedinfo += "\[[time2text(timerecorded*10,"mm:ss")]\] [strip_html_properly(text)]"
|
||||
if(mytape && recording)
|
||||
mytape.record_speech("[strip_html_properly(text)]")
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/show_message(msg, type, alt, alt_type)
|
||||
var/recordedtext
|
||||
@@ -46,25 +113,24 @@
|
||||
recordedtext = alt
|
||||
else
|
||||
return
|
||||
if(recording)
|
||||
timestamp += timerecorded
|
||||
storedinfo += "*\[[time2text(timerecorded*10,"mm:ss")]\] *[strip_html_properly(recordedtext)]*" //"*" at front as a marker
|
||||
if(mytape && recording)
|
||||
mytape.record_noise("[strip_html_properly(recordedtext)]")
|
||||
|
||||
/obj/item/device/taperecorder/emag_act(var/remaining_charges, var/mob/user)
|
||||
if(emagged == 0)
|
||||
emagged = 1
|
||||
recording = 0
|
||||
user << "<span class='warning'>PZZTTPFFFT</span>"
|
||||
icon_state = "taperecorderidle"
|
||||
to_chat(user, "<span class='warning'>PZZTTPFFFT</span>")
|
||||
update_icon()
|
||||
return 1
|
||||
else
|
||||
user << "<span class='warning'>It is already emagged!</span>"
|
||||
to_chat(user, "<span class='warning'>It is already emagged!</span>")
|
||||
|
||||
/obj/item/device/taperecorder/proc/explode()
|
||||
var/turf/T = get_turf(loc)
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
M << "<span class='danger'>\The [src] explodes!</span>"
|
||||
to_chat(M, "<span class='danger'>\The [src] explodes!</span>")
|
||||
if(T)
|
||||
T.hotspot_expose(700,125)
|
||||
explosion(T, -1, -1, 0, 4)
|
||||
@@ -75,117 +141,152 @@
|
||||
set name = "Start Recording"
|
||||
set category = "Object"
|
||||
|
||||
if(usr.stat)
|
||||
if(usr.incapacitated())
|
||||
return
|
||||
if(emagged == 1)
|
||||
usr << "<span class='warning'>The tape recorder makes a scratchy noise.</span>"
|
||||
if(!mytape)
|
||||
to_chat(usr, "<span class='notice'>There's no tape!</span>")
|
||||
return
|
||||
icon_state = "taperecorderrecording"
|
||||
if(timerecorded < 3600 && playing == 0)
|
||||
usr << "<span class='notice'>Recording started.</span>"
|
||||
if(mytape.ruined)
|
||||
to_chat(usr, "<span class='warning'>The tape recorder makes a scratchy noise.</span>")
|
||||
return
|
||||
if(recording)
|
||||
to_chat(usr, "<span class='notice'>You're already recording!</span>")
|
||||
return
|
||||
if(playing)
|
||||
to_chat(usr, "<span class='notice'>You can't record when playing!</span>")
|
||||
return
|
||||
if(emagged)
|
||||
to_chat(usr, "<span class='warning'>The tape recorder makes a scratchy noise.</span>")
|
||||
return
|
||||
if(mytape.used_capacity < mytape.max_capacity)
|
||||
to_chat(usr, "<span class='notice'>Recording started.</span>")
|
||||
recording = 1
|
||||
timestamp+= timerecorded
|
||||
storedinfo += "\[[time2text(timerecorded*10,"mm:ss")]\] Recording started."
|
||||
for(timerecorded, timerecorded<3600)
|
||||
if(recording == 0)
|
||||
break
|
||||
timerecorded++
|
||||
update_icon()
|
||||
|
||||
mytape.record_speech("Recording started.")
|
||||
|
||||
//count seconds until full, or recording is stopped
|
||||
while(mytape && recording && mytape.used_capacity < mytape.max_capacity)
|
||||
sleep(10)
|
||||
recording = 0
|
||||
icon_state = "taperecorderidle"
|
||||
mytape.used_capacity++
|
||||
if(mytape.used_capacity >= mytape.max_capacity)
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
to_chat(M, "<span class='notice'>The tape is full.</span>")
|
||||
stop_recording()
|
||||
|
||||
|
||||
update_icon()
|
||||
return
|
||||
else
|
||||
usr << "<span class='notice'>Either your tape recorder's memory is full, or it is currently playing back its memory.</span>"
|
||||
to_chat(usr, "<span class='notice'>The tape is full.</span>")
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/proc/stop_recording()
|
||||
//Sanity checks skipped, should not be called unless actually recording
|
||||
recording = 0
|
||||
update_icon()
|
||||
mytape.record_speech("Recording stopped.")
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
to_chat(M, "<span class='notice'>Recording stopped.</span>")
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/verb/stop()
|
||||
set name = "Stop"
|
||||
set category = "Object"
|
||||
|
||||
if(usr.stat)
|
||||
if(usr.incapacitated())
|
||||
return
|
||||
if(emagged == 1)
|
||||
usr << "<span class='warning'>The tape recorder makes a scratchy noise.</span>"
|
||||
if(recording)
|
||||
stop_recording()
|
||||
return
|
||||
if(recording == 1)
|
||||
recording = 0
|
||||
timestamp+= timerecorded
|
||||
storedinfo += "\[[time2text(timerecorded*10,"mm:ss")]\] Recording stopped."
|
||||
usr << "<span class='notice'>Recording stopped.</span>"
|
||||
icon_state = "taperecorderidle"
|
||||
return
|
||||
else if(playing == 1)
|
||||
else if(playing)
|
||||
playing = 0
|
||||
var/turf/T = get_turf(src)
|
||||
T.audible_message("<font color=Maroon><B>Tape Recorder</B>: Playback stopped.</font>")
|
||||
icon_state = "taperecorderidle"
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/verb/clear_memory()
|
||||
set name = "Clear Memory"
|
||||
set category = "Object"
|
||||
|
||||
if(usr.stat)
|
||||
return
|
||||
if(emagged == 1)
|
||||
usr << "<span class='warning'>The tape recorder makes a scratchy noise.</span>"
|
||||
return
|
||||
if(recording == 1 || playing == 1)
|
||||
usr << "<span class='notice'>You can't clear the memory while playing or recording!</span>"
|
||||
update_icon()
|
||||
to_chat(usr, "<span class='notice'>Playback stopped.</span>")
|
||||
return
|
||||
else
|
||||
if(storedinfo) storedinfo.Cut()
|
||||
if(timestamp) timestamp.Cut()
|
||||
timerecorded = 0
|
||||
usr << "<span class='notice'>Memory cleared.</span>"
|
||||
to_chat(usr, "<span class='notice'>Stop what?</span>")
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/verb/wipe_tape()
|
||||
set name = "Wipe Tape"
|
||||
set category = "Object"
|
||||
|
||||
if(usr.incapacitated())
|
||||
return
|
||||
if(emagged)
|
||||
to_chat(usr, "<span class='warning'>The tape recorder makes a scratchy noise.</span>")
|
||||
return
|
||||
if(mytape.ruined)
|
||||
to_chat(usr, "<span class='warning'>The tape recorder makes a scratchy noise.</span>")
|
||||
return
|
||||
if(recording || playing)
|
||||
to_chat(usr, "<span class='notice'>You can't wipe the tape while playing or recording!</span>")
|
||||
return
|
||||
else
|
||||
if(mytape.storedinfo) mytape.storedinfo.Cut()
|
||||
if(mytape.timestamp) mytape.timestamp.Cut()
|
||||
mytape.used_capacity = 0
|
||||
to_chat(usr, "<span class='notice'>You wipe the tape.</span>")
|
||||
return
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/verb/playback_memory()
|
||||
set name = "Playback Memory"
|
||||
set name = "Playback Tape"
|
||||
set category = "Object"
|
||||
|
||||
if(usr.stat)
|
||||
if(usr.incapacitated())
|
||||
return
|
||||
if(emagged == 1)
|
||||
usr << "<span class='warning'>The tape recorder makes a scratchy noise.</span>"
|
||||
if(!mytape)
|
||||
to_chat(usr, "<span class='notice'>There's no tape!</span>")
|
||||
return
|
||||
if(recording == 1)
|
||||
usr << "<span class='notice'>You can't playback when recording!</span>"
|
||||
if(mytape.ruined)
|
||||
to_chat(usr, "<span class='warning'>The tape recorder makes a scratchy noise.</span>")
|
||||
return
|
||||
if(playing == 1)
|
||||
usr << "<span class='notice'>You're already playing!</span>"
|
||||
if(recording)
|
||||
to_chat(usr, "<span class='notice'>You can't playback when recording!</span>")
|
||||
return
|
||||
if(playing)
|
||||
to_chat(usr, "<span class='notice'>You're already playing!</span>")
|
||||
return
|
||||
playing = 1
|
||||
icon_state = "taperecorderplaying"
|
||||
usr << "<span class='notice'>Playing started.</span>"
|
||||
for(var/i=1,timerecorded<3600,sleep(10 * (playsleepseconds) ))
|
||||
if(playing == 0)
|
||||
update_icon()
|
||||
to_chat(usr, "<span class='notice'>Playing started.</span>")
|
||||
for(var/i=1 , i < mytape.max_capacity , i++)
|
||||
if(!mytape || !playing)
|
||||
break
|
||||
if(storedinfo.len < i)
|
||||
if(mytape.storedinfo.len < i)
|
||||
break
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
var/playedmessage = storedinfo[i]
|
||||
var/playedmessage = mytape.storedinfo[i]
|
||||
if (findtextEx(playedmessage,"*",1,2)) //remove marker for action sounds
|
||||
playedmessage = copytext(playedmessage,2)
|
||||
T.audible_message("<font color=Maroon><B>Tape Recorder</B>: [playedmessage]</font>")
|
||||
if(storedinfo.len < i+1)
|
||||
|
||||
if(mytape.storedinfo.len < i+1)
|
||||
playsleepseconds = 1
|
||||
sleep(10)
|
||||
T = get_turf(src)
|
||||
T.audible_message("<font color=Maroon><B>Tape Recorder</B>: End of recording.</font>")
|
||||
break
|
||||
else
|
||||
playsleepseconds = timestamp[i+1] - timestamp[i]
|
||||
playsleepseconds = mytape.timestamp[i+1] - mytape.timestamp[i]
|
||||
|
||||
if(playsleepseconds > 14)
|
||||
sleep(10)
|
||||
T = get_turf(src)
|
||||
T.audible_message("<font color=Maroon><B>Tape Recorder</B>: Skipping [playsleepseconds] seconds of silence</font>")
|
||||
playsleepseconds = 1
|
||||
i++
|
||||
icon_state = "taperecorderidle"
|
||||
sleep(10 * playsleepseconds)
|
||||
|
||||
|
||||
playing = 0
|
||||
if(emagged == 1.0)
|
||||
update_icon()
|
||||
|
||||
if(emagged)
|
||||
var/turf/T = get_turf(src)
|
||||
T.audible_message("<font color=Maroon><B>Tape Recorder</B>: This tape recorder will self-destruct in... Five.</font>")
|
||||
sleep(10)
|
||||
@@ -208,24 +309,31 @@
|
||||
set name = "Print Transcript"
|
||||
set category = "Object"
|
||||
|
||||
if(usr.stat)
|
||||
if(usr.incapacitated())
|
||||
return
|
||||
if(emagged == 1)
|
||||
usr << "<span class='warning'>The tape recorder makes a scratchy noise.</span>"
|
||||
if(!mytape)
|
||||
to_chat(usr, "<span class='notice'>There's no tape!</span>")
|
||||
return
|
||||
if(mytape.ruined)
|
||||
to_chat(usr, "<span class='warning'>The tape recorder makes a scratchy noise.</span>")
|
||||
return
|
||||
if(emagged)
|
||||
to_chat(usr, "<span class='warning'>The tape recorder makes a scratchy noise.</span>")
|
||||
return
|
||||
if(!canprint)
|
||||
usr << "<span class='notice'>The recorder can't print that fast!</span>"
|
||||
to_chat(usr, "<span class='notice'>The recorder can't print that fast!</span>")
|
||||
return
|
||||
if(recording == 1 || playing == 1)
|
||||
usr << "<span class='notice'>You can't print the transcript while playing or recording!</span>"
|
||||
if(recording || playing)
|
||||
to_chat(usr, "<span class='notice'>You can't print the transcript while playing or recording!</span>")
|
||||
return
|
||||
usr << "<span class='notice'>Transcript printed.</span>"
|
||||
|
||||
to_chat(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,storedinfo.len >= i,i++)
|
||||
var/printedmessage = storedinfo[i]
|
||||
for(var/i=1,mytape.storedinfo.len >= i,i++)
|
||||
var/printedmessage = mytape.storedinfo[i]
|
||||
if (findtextEx(printedmessage,"*",1,2)) //replace action sounds
|
||||
printedmessage = "\[[time2text(timestamp[i]*10,"mm:ss")]\] (Unrecognized sound)"
|
||||
printedmessage = "\[[time2text(mytape.timestamp[i]*10,"mm:ss")]\] (Unrecognized sound)"
|
||||
t1 += "[printedmessage]<BR>"
|
||||
P.info = t1
|
||||
P.name = "Transcript"
|
||||
@@ -235,46 +343,98 @@
|
||||
|
||||
|
||||
/obj/item/device/taperecorder/attack_self(mob/user)
|
||||
if(recording == 0 && playing == 0)
|
||||
if(usr.stat)
|
||||
return
|
||||
if(emagged == 1)
|
||||
usr << "<span class='warning'>The tape recorder makes a scratchy noise.</span>"
|
||||
return
|
||||
icon_state = "taperecorderrecording"
|
||||
if(timerecorded < 3600 && playing == 0)
|
||||
usr << "<span class='notice'>Recording started.</span>"
|
||||
recording = 1
|
||||
timestamp+= timerecorded
|
||||
storedinfo += "\[[time2text(timerecorded*10,"mm:ss")]\] Recording started."
|
||||
for(timerecorded, timerecorded<3600)
|
||||
if(recording == 0)
|
||||
break
|
||||
timerecorded++
|
||||
sleep(10)
|
||||
recording = 0
|
||||
icon_state = "taperecorderidle"
|
||||
return
|
||||
else
|
||||
usr << "<span class='warning'>Either your tape recorder's memory is full, or it is currently playing back its memory.</span>"
|
||||
if(recording || playing)
|
||||
stop()
|
||||
else
|
||||
if(usr.stat)
|
||||
usr << "Not when you're incapacitated."
|
||||
return
|
||||
if(recording == 1)
|
||||
recording = 0
|
||||
timestamp+= timerecorded
|
||||
storedinfo += "\[[time2text(timerecorded*10,"mm:ss")]\] Recording stopped."
|
||||
usr << "<span class='notice'>Recording stopped.</span>"
|
||||
icon_state = "taperecorderidle"
|
||||
return
|
||||
else if(playing == 1)
|
||||
playing = 0
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/mob/O in hearers(world.view-1, T))
|
||||
O.show_message("<font color=Maroon><B>Tape Recorder</B>: Playback stopped.</font>",2)
|
||||
icon_state = "taperecorderidle"
|
||||
return
|
||||
else
|
||||
usr << "<span class='warning'>Stop what?</span>"
|
||||
return
|
||||
record()
|
||||
|
||||
|
||||
/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/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 = ITEMSIZE_TINY
|
||||
matter = list(DEFAULT_WALL_MATERIAL=20, "glass"=5)
|
||||
force = 1
|
||||
throwforce = 0
|
||||
var/max_capacity = 600
|
||||
var/used_capacity = 0
|
||||
var/list/storedinfo = new/list()
|
||||
var/list/timestamp = new/list()
|
||||
var/ruined = 0
|
||||
|
||||
|
||||
/obj/item/device/tape/update_icon()
|
||||
overlays.Cut()
|
||||
if(ruined)
|
||||
overlays += "ribbonoverlay"
|
||||
|
||||
|
||||
/obj/item/device/tape/fire_act()
|
||||
ruin()
|
||||
|
||||
/obj/item/device/tape/attack_self(mob/user)
|
||||
if(!ruined)
|
||||
to_chat(user, "<span class='notice'>You pull out all the tape!</span>")
|
||||
ruin()
|
||||
|
||||
|
||||
/obj/item/device/tape/proc/ruin()
|
||||
ruined = 1
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/device/tape/proc/fix()
|
||||
ruined = 0
|
||||
update_icon()
|
||||
|
||||
|
||||
/obj/item/device/tape/proc/record_speech(text)
|
||||
timestamp += used_capacity
|
||||
storedinfo += "\[[time2text(used_capacity*10,"mm:ss")]\] [text]"
|
||||
|
||||
|
||||
//shows up on the printed transcript as (Unrecognized sound)
|
||||
/obj/item/device/tape/proc/record_noise(text)
|
||||
timestamp += used_capacity
|
||||
storedinfo += "*\[[time2text(used_capacity*10,"mm:ss")]\] [text]"
|
||||
|
||||
|
||||
/obj/item/device/tape/attackby(obj/item/I, mob/user, params)
|
||||
if(ruined && istype(I, /obj/item/weapon/screwdriver))
|
||||
to_chat(user, "<span class='notice'>You start winding the tape back in...</span>")
|
||||
if(do_after(user, 120, target = src))
|
||||
to_chat(user, "<span class='notice'>You wound the tape back in.</span>")
|
||||
fix()
|
||||
return
|
||||
else if(istype(I, /obj/item/weapon/pen))
|
||||
if(loc == user && !user.incapacitated())
|
||||
var/new_name = input(user, "What would you like to label the tape?", "Tape labeling") as null|text
|
||||
if(isnull(new_name)) return
|
||||
new_name = sanitizeSafe(new_name)
|
||||
if(new_name)
|
||||
name = "tape - '[new_name]'"
|
||||
to_chat(user, "<span class='notice'>You label the tape '[new_name]'.</span>")
|
||||
else
|
||||
name = "tape"
|
||||
to_chat(user, "<span class='notice'>You scratch off the label.</span>")
|
||||
return
|
||||
..()
|
||||
|
||||
|
||||
//Random colour tapes
|
||||
/obj/item/device/tape/random/New()
|
||||
icon_state = "tape_[pick("white", "blue", "red", "yellow", "purple")]"
|
||||
@@ -217,8 +217,9 @@
|
||||
// Includes normal radio uplink, multitool uplink,
|
||||
// implant uplink (not the implant tool) and a preset headset uplink.
|
||||
|
||||
/obj/item/device/radio/uplink/New()
|
||||
hidden_uplink = new(src, usr.mind, DEFAULT_TELECRYSTAL_AMOUNT)
|
||||
/obj/item/device/radio/uplink/New(atom/loc, datum/mind/target_mind, telecrystals)
|
||||
..(loc)
|
||||
hidden_uplink = new(src, target_mind, telecrystals)
|
||||
icon_state = "radio"
|
||||
|
||||
/obj/item/device/radio/uplink/attack_self(mob/user as mob)
|
||||
|
||||
Reference in New Issue
Block a user