Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IC Health scanner, HEV sounds, Sound cooldown rework #6894

Merged
merged 6 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ a creative player the means to solve many problems. Circuits are held inside an
if(!check_power())
power_fail()
return FALSE
do_work(ord) //Moved it behind next use incase the cooldown is modified in do_work
next_use = world.time + cooldown_per_use
if(assembly)
assembly.ext_next_use = world.time + ext_cooldown
do_work(ord)
return TRUE

/obj/item/integrated_circuit/proc/do_work(ord)
Expand Down
124 changes: 106 additions & 18 deletions code/modules/integrated_electronics/subtypes/input.dm
Original file line number Diff line number Diff line change
Expand Up @@ -213,32 +213,93 @@

name = "integrated advanced medical analyzer"
desc = "A very small version of the medibot's medical analyzer. This allows the machine to know how healthy someone is. \

This type is much more precise, allowing the machine to know much more about the target than a normal analyzer."
This type is much more precise, allowing the machine to know much more about the target than a normal analyzer. \
A better health scanner can be installed to expand functionality. T1 for brain damage, bleeding and infection. \
T2 For fractions and internal bleeding. T3 for non medical reagents."
icon_state = "medscan_adv"
complexity = 12
inputs = list("target" = IC_PINTYPE_REF)
outputs = list(
"brain activity" = IC_PINTYPE_BOOLEAN,
"is conscious" = IC_PINTYPE_BOOLEAN,
"total health %" = IC_PINTYPE_NUMBER,
"total missing health" = IC_PINTYPE_NUMBER,
"brute damage" = IC_PINTYPE_NUMBER,
"burn damage" = IC_PINTYPE_NUMBER,
"tox damage" = IC_PINTYPE_NUMBER,
"oxy damage" = IC_PINTYPE_NUMBER,
"clone damage" = IC_PINTYPE_NUMBER,
"blood loss" = IC_PINTYPE_NUMBER,
"pain level" = IC_PINTYPE_NUMBER,
"radiation" = IC_PINTYPE_NUMBER,
"nutrition" = IC_PINTYPE_NUMBER,
"list of reagents" = IC_PINTYPE_LIST,
"quantity of reagents" = IC_PINTYPE_LIST
"brain activity" = IC_PINTYPE_BOOLEAN, //1
"is conscious" = IC_PINTYPE_BOOLEAN, //2
"total health %" = IC_PINTYPE_NUMBER, //3
"total missing health" = IC_PINTYPE_NUMBER, //4
"brute damage" = IC_PINTYPE_NUMBER, //5
"burn damage" = IC_PINTYPE_NUMBER, //6
"tox damage" = IC_PINTYPE_NUMBER, //7
"oxy damage" = IC_PINTYPE_NUMBER, //8
"clone damage" = IC_PINTYPE_NUMBER, //9
"blood loss" = IC_PINTYPE_NUMBER, //10
"pain level" = IC_PINTYPE_NUMBER, //11
"radiation" = IC_PINTYPE_NUMBER, //12
"nutrition" = IC_PINTYPE_NUMBER, //13
"list of reagents" = IC_PINTYPE_LIST, //14
"quantity of reagents" = IC_PINTYPE_LIST, //15
"health scan tier" = IC_PINTYPE_NUMBER, //16
"brain damage" = IC_PINTYPE_NUMBER, //17
"bleeding limbs" = IC_PINTYPE_LIST, //18
"infected limbs" = IC_PINTYPE_LIST, //19
"internal bleeding" = IC_PINTYPE_LIST, //20
"fractured limbs" = IC_PINTYPE_LIST //21
)
activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT)
spawn_flags = IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3, TECH_BIO = 4)
power_draw_per_use = 80
can_be_asked_input = TRUE
var/obj/item/healthanalyzer/current_healthanalyzer
var/advscan = 0
//T1: brain damage, bleeding, infection. T2: show location of IB and fracture. T3: show non medical reagents

/obj/item/integrated_circuit/input/adv_med_scanner/ask_for_input(mob/living/user, obj/item/I, a_intent)
if(!current_healthanalyzer)
if(!isobj(I))
return FALSE
attackby_react(I, user, a_intent)
else
attack_self(user)

/obj/item/integrated_circuit/input/adv_med_scanner/attackby_react(var/obj/item/healthanalyzer/I, var/mob/living/user)
//Check if it truly is a health scanner
if(!(istype(I,/obj/item/healthanalyzer)))
to_chat(user,"<span class='warning'>The [I.name] doesn't seem to fit in here.</span>")
return

//Check if there is no other health scanner already inside
if(current_healthanalyzer)
to_chat(user,"<span class='notice'>There is already a health scanner inside.</span>")
return

if(!user.attempt_insert_item_for_installation(I, src))
return

//The health scanner is the one we just attached, its location is inside the circuit
current_healthanalyzer = I

to_chat(user,"<span class='warning'>You slot in the [I.name] inside the assembly.</span>")

//Set the pin to a weak reference of the current beaker
set_pin_data(IC_OUTPUT, 16, I.advscan)
advscan = I.advscan
push_data()

/obj/item/integrated_circuit/input/adv_med_scanner/attack_self(mob/user)
. = ..()
if(.)
return
//Check if no health scanner is attached
if(!current_healthanalyzer)
to_chat(user, "<span class='notice'>There is currently no health scanner attached.</span>")
return

//Remove beaker and put in user's hands/location
to_chat(user, "<span class='notice'>You yank the [current_healthanalyzer] out of the slot.</span>")
user.put_in_hands(current_healthanalyzer)
current_healthanalyzer = null
//Reset to 0
set_pin_data(IC_OUTPUT, 16, 0)
advscan = 0
push_data()

/obj/item/integrated_circuit/input/adv_med_scanner/do_work(ord)
if(ord == 1)
Expand Down Expand Up @@ -267,11 +328,38 @@
var/cont[0]
var/amt[0]
for(var/datum/reagent/RE in H.reagents.reagent_list)
if(RE.scannable)
if(RE.scannable || advscan >= 3)
cont += RE.id
amt += round(H.reagents.get_reagent_amount(RE.id), 1)
set_pin_data(IC_OUTPUT, 14, cont)
set_pin_data(IC_OUTPUT, 15, amt)
var/frac[0]
var/ib[0]
var/bleed[0]
var/infec[0]
if(advscan >= 1)
set_pin_data(IC_OUTPUT, 17, H.getBrainLoss())
for(var/obj/item/organ/external/e in H.organs)
if(!e)
continue
// Bleeding
if(e.status & ORGAN_BLEEDING)
bleed += e.name
// Infections
if(e.has_infected_wound())
infec += e.name
if(advscan >= 2)
// Broken limbs
if(e.status & ORGAN_BROKEN)
frac += e.name
// IB
for(var/datum/wound/W as anything in e.wounds)
if(W.internal)
ib += e.name
set_pin_data(IC_OUTPUT, 18, bleed)
set_pin_data(IC_OUTPUT, 19, infec)
set_pin_data(IC_OUTPUT, 20, ib)
set_pin_data(IC_OUTPUT, 21, frac)

push_data()
activate_pin(2)
Expand Down
110 changes: 107 additions & 3 deletions code/modules/integrated_electronics/subtypes/output.dm
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,18 @@
desc = "A miniature speaker is attached to this component."
icon_state = "speaker"
complexity = 8
cooldown_per_use = 4 SECONDS
cooldown_per_use = 1 SECONDS //The cooldown is adjusted by sound length
var/cooldown_after_use = 1 SECONDS //Extra cooldown added to the sound length
inputs = list(
"sound ID" = IC_PINTYPE_STRING,
"volume" = IC_PINTYPE_NUMBER,
"frequency" = IC_PINTYPE_BOOLEAN
)
outputs = list()
activators = list("play sound" = IC_PINTYPE_PULSE_IN)
outputs = list("cooldown duration" = IC_PINTYPE_NUMBER)
activators = list("play sound" = IC_PINTYPE_PULSE_IN, "on played" = IC_PINTYPE_PULSE_OUT)
power_draw_per_use = 20
var/list/sounds = list()
var/list/durations = list() //Audacity works decently well to finding out deciseconds

/obj/item/integrated_circuit/output/sound/Initialize(mapload)
. = ..()
Expand All @@ -205,8 +207,13 @@
var/selected_sound = sounds[ID]
if(!selected_sound)
return
var/selected_cooldown = durations[ID]
vol = clamp( vol, 0, 100)
playsound(get_turf(src), selected_sound, vol, freq, -1)
cooldown_per_use = selected_cooldown + cooldown_after_use
set_pin_data(IC_OUTPUT, 1, cooldown_per_use)
push_data()
activate_pin(2)

/obj/item/integrated_circuit/output/sound/beeper
name = "beeper circuit"
Expand All @@ -223,6 +230,16 @@
"synth no" = 'sound/machines/synth_no.ogg',
"warning buzz" = 'sound/machines/warning-buzzer.ogg'
)
durations = list(
"beep" = 3,
"chime" = 4,
"buzz sigh" = 3,
"buzz twice" = 6,
"ping" = 5,
"synth yes" = 4,
"synth no" = 4,
"warning buzz" = 35
)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH

/obj/item/integrated_circuit/output/sound/beepsky
Expand All @@ -238,6 +255,16 @@
"radio" = 'sound/voice/bradio.ogg',
"secure day" = 'sound/voice/bsecureday.ogg',
)
durations = list(
"creep" = 16,
"criminal" = 11,
"freeze" = 10,
"god" = 30,
"i am the law" = 22,
"insult" = 141, //Yeah it is that long
"radio" = 18,
"secure day" = 12,
)
spawn_flags = IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_ILLEGAL = 1)

Expand All @@ -261,9 +288,86 @@
"apple" = 'sound/voice/medibot/mapple.ogg',
"no" = 'sound/voice/medibot/mno.ogg',
)
durations = list(
"surgeon" = 39,
"radar" = 16,
"feel better" = 14,
"patched up" = 11,
"injured" = 21,
"insult" = 155,
"coming" = 20,
"help" = 13,
"live" = 15,
"lost" = 45,
"flies" = 50,
"catch" = 38,
"delicious" = 7,
"apple" = 23,
"no" = 16,
)
spawn_flags = IC_SPAWN_RESEARCH
origin_tech = list(TECH_ENGINEERING = 2, TECH_DATA = 2, TECH_BIO = 1)

/obj/item/integrated_circuit/output/sound/hev
name = "HEV sound circuit"
desc = "Takes a sound name as an input, and will play said sound when pulsed. This circuit is similar to those used in some old RIG suit"
cooldown_after_use = 5
sounds = list(
"bio_warn" = 'sound/voice/Hevsounds/biohazard_detected.wav',
"chem_warn" = 'sound/voice/Hevsounds/chemical_detected.wav',
"rad_warn" = 'sound/voice/Hevsounds/radiation_detected.wav',
"near_death" = 'sound/voice/Hevsounds/near_death.wav',
"seek_medic" = 'sound/voice/Hevsounds/seek_medic.wav',
"shock_damage" = 'sound/voice/Hevsounds/shock_damage.wav',
"blood_loss" = 'sound/voice/Hevsounds/blood_loss.wav',
"blood_plasma" = 'sound/voice/Hevsounds/blood_plasma.wav',
"blood_toxins" = 'sound/voice/Hevsounds/blood_toxins.wav',
"health_critical" = 'sound/voice/Hevsounds/health_critical.wav',
"health_dropping" = 'sound/voice/Hevsounds/health_dropping.wav',
"health_dropping2" = 'sound/voice/Hevsounds/health_dropping2.wav',
"minor_fracture" = 'sound/voice/Hevsounds/minor_fracture.wav',
"minor_lacerations" = 'sound/voice/Hevsounds/minor_lacerations.wav',
"major_fracture" = 'sound/voice/Hevsounds/major_fracture.wav',
"major_lacerations" = 'sound/voice/Hevsounds/major_lacerations.wav',
"wound_sterilized" = 'sound/voice/Hevsounds/wound_sterilized.wav',
"administering_medical" = 'sound/voice/Hevsounds/administering_medical.wav',
"adrenaline_shot" = 'sound/voice/Hevsounds/adrenaline_shot.wav',
"automedic_on" = 'sound/voice/Hevsounds/automedic_on.wav',
"antitoxin_shot" = 'sound/voice/Hevsounds/antitoxin_shot.wav',
"heat_damage" = 'sound/voice/Hevsounds/heat_damage.wav',
"morphine_shot" = 'sound/voice/Hevsounds/morphine_shot.wav',
"innsuficient_medical" = 'sound/voice/Hevsounds/innsuficient_medical.wav',
"internal_bleeding" = 'sound/voice/Hevsounds/internal_bleeding.wav'
)
durations = list(
"bio_warn" = 31,
"chem_warn" = 38,
"rad_warn" = 45,
"near_death" = 36,
"seek_medic" = 25,
"shock_damage" = 23,
"blood_loss" = 22,
"blood_plasma" = 26,
"blood_toxins" = 38,
"health_critical" = 32,
"health_dropping" = 35,
"health_dropping2" = 29,
"minor_fracture" = 24,
"minor_lacerations" = 29,
"major_fracture" = 24,
"major_lacerations" = 30,
"wound_sterilized" = 20,
"administering_medical" = 31,
"adrenaline_shot" = 20,
"automedic_on" = 35,
"antitoxin_shot" = 22,
"heat_damage" = 30,
"morphine_shot" = 20,
"innsuficient_medical" = 45,
"internal_bleeding" = 24
)
spawn_flags = IC_SPAWN_RESEARCH

/obj/item/integrated_circuit/output/video_camera
name = "video camera circuit"
desc = "This small camera allows a remote viewer to see what it sees."
Expand Down
Binary file added sound/voice/Hevsounds/administering_medical.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/adrenaline_shot.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/antitoxin_shot.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/automedic_on.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/biohazard_detected.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/blood_loss.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/blood_plasma.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/blood_toxins.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/chemical_detected.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/health_critical.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/health_dropping.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/health_dropping2.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/heat_damage.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/innsuficient_medical.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/internal_bleeding.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/major_fracture.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/major_lacerations.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/minor_fracture.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/minor_lacerations.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/morphine_shot.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/near_death.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/radiation_detected.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/seek_medic.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/shock_damage.wav
Binary file not shown.
Binary file added sound/voice/Hevsounds/wound_sterilized.wav
Binary file not shown.
Loading