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

Medical Machinery expansion #2750

Closed
wants to merge 9 commits into from
Closed
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
2 changes: 2 additions & 0 deletions code/__DEFINES/status_effects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@

#define STATUS_EFFECT_STASIS /datum/status_effect/grouped/stasis //Halts biological functions like bleeding, chemical processing, blood regeneration, walking, etc

#define STATUS_EFFECT_LIFE_SUPPORT /datum/status_effect/grouped/life_support //Prevents someone from dying. Doesn't halt any other biological functions.

#define STATUS_EFFECT_FAKE_VIRUS /datum/status_effect/fake_virus //gives you fluff messages for cough, sneeze, headache, etc but without an actual virus

#define STATUS_EFFECT_METAB_FROZEN /datum/status_effect/metab_frozen // Affected cannot process chems
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_TESLA_SHOCKIMMUNE "tesla_shock_immunity"
#define TRAIT_STABLEHEART "stable_heart"
#define TRAIT_STABLELIVER "stable_liver"
#define TRAIT_STABLEPLASMA "stable_plasma"
#define TRAIT_STABLELUNG "stable_lung"
#define TRAIT_RESISTHEAT "resist_heat"
#define TRAIT_RESISTHEATHANDS "resist_heat_handsonly" //For when you want to be able to touch hot things, but still want fire to be an issue.
#define TRAIT_RESISTCOLD "resist_cold"
Expand Down
2 changes: 2 additions & 0 deletions code/_globalvars/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_TESLA_SHOCKIMMUNE" = TRAIT_TESLA_SHOCKIMMUNE,
"TRAIT_STABLEHEART" = TRAIT_STABLEHEART,
"TRAIT_STABLELIVER" = TRAIT_STABLELIVER,
"TRAIT_STABLELUNG" = TRAIT_STABLELUNG,
"TRAIT_STABLEPLASMA" = TRAIT_STABLEPLASMA,
"TRAIT_RESISTHEAT" = TRAIT_RESISTHEAT,
"TRAIT_RESISTHEATHANDS" = TRAIT_RESISTHEATHANDS,
"TRAIT_RESISTCOLD" = TRAIT_RESISTCOLD,
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/traumas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ SUBSYSTEM_DEF(traumas)
/obj/item/clothing/under/rank/medical,
/obj/item/reagent_containers/syringe, /obj/item/reagent_containers/pill/, /obj/item/reagent_containers/hypospray,
/obj/item/storage/firstaid, /obj/item/storage/pill_bottle, /obj/item/healthanalyzer,
/obj/structure/sign/departments/medbay, /obj/machinery/door/airlock/medical, /obj/machinery/sleeper, /obj/machinery/stasis,
/obj/structure/sign/departments/medbay, /obj/machinery/door/airlock/medical, /obj/machinery/sleeper,
/obj/machinery/dna_scannernew, /obj/machinery/atmospherics/components/unary/cryo_cell,
/obj/item/retractor, /obj/item/hemostat, /obj/item/cautery, /obj/item/surgicaldrill, /obj/item/scalpel, /obj/item/circular_saw,
/obj/item/clothing/suit/bio_suit/plaguedoctorsuit, /obj/item/clothing/head/plaguedoctorhat, /obj/item/clothing/mask/gas/plaguedoctor)),
Expand Down
2 changes: 0 additions & 2 deletions code/datums/beam.dm
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,3 @@
var/datum/beam/newbeam = new(src,BeamTarget,icon,icon_state,time,maxdistance,beam_type, beam_color, emissive, override_origin_pixel_x, override_origin_pixel_y, override_target_pixel_x, override_target_pixel_y)
INVOKE_ASYNC(newbeam, TYPE_PROC_REF(/datum/beam, Start))
return newbeam


3 changes: 1 addition & 2 deletions code/datums/looping_sounds/item_sounds.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define RAD_GEIGER_LOW 100 // Geiger counter sound thresholds
#define RAD_GEIGER_LOW 100 // Geiger counter sound thresholds
#define RAD_GEIGER_MEDIUM 500
#define RAD_GEIGER_HIGH 1000

Expand Down Expand Up @@ -41,7 +41,6 @@
mid_length = 3.5
volume = 25


/datum/looping_sound/reverse_bear_trap_beep
mid_sounds = list('sound/machines/beep.ogg')
mid_length = 60
Expand Down
17 changes: 0 additions & 17 deletions code/datums/looping_sounds/machinery_sounds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
end_sound = 'sound/machines/shower/shower_end.ogg'
volume = 20

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/supermatter
mid_sounds = list('sound/machines/sm/loops/calm.ogg' = 1)
mid_length = 60
Expand All @@ -17,17 +15,13 @@
falloff_distance = 5
vary = TRUE

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/destabilized_crystal
mid_sounds = list('sound/machines/sm/loops/delamming.ogg' = 1)
mid_length = 60
volume = 55
extra_range = 15
vary = TRUE

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/generator
start_sound = 'sound/machines/generator/generator_start.ogg'
start_length = 4
Expand All @@ -36,9 +30,6 @@
end_sound = 'sound/machines/generator/generator_end.ogg'
volume = 40

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


/datum/looping_sound/deep_fryer
start_sound = 'sound/machines/fryer/deep_fryer_immerse.ogg' //my immersions
start_length = 10
Expand All @@ -47,15 +38,11 @@
end_sound = 'sound/machines/fryer/deep_fryer_emerge.ogg'
volume = 15

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/grill
mid_length = 2
mid_sounds = list('sound/machines/fryer/deep_fryer_1.ogg' = 1, 'sound/machines/fryer/deep_fryer_2.ogg' = 1)
volume = 30

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/microwave
start_sound = 'sound/machines/microwave/microwave-start.ogg'
start_length = 10
Expand All @@ -64,16 +51,12 @@
end_sound = 'sound/machines/microwave/microwave-end.ogg'
volume = 90

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/jackpot
mid_length = 11
mid_sounds = list('sound/machines/roulettejackpot.ogg')
volume = 85
vary = TRUE

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/datum/looping_sound/drill
mid_sounds = list('sound/machines/gravgen/gravgen_mid1.ogg'=1, 'sound/machines/gravgen/gravgen_mid2.ogg'=1, 'sound/machines/gravgen/gravgen_mid3.ogg'=1, 'sound/machines/gravgen/gravgen_mid4.ogg'=1)
mid_length = 4
Expand Down
21 changes: 21 additions & 0 deletions code/datums/looping_sounds/medical_sounds.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/datum/looping_sound/ekg
mid_sounds = list('sound/machines/medical/ekgbeep.ogg')
mid_length = 8
volume = 35

/datum/looping_sound/ekg_fast
mid_sounds = list('sound/machines/medical/ekgbeep.ogg')
mid_length = 5
volume = 35

/datum/looping_sound/ekg_slow
mid_sounds = list('sound/machines/medical/ekgbeep.ogg')
mid_length = 15
volume = 35

/datum/looping_sound/flatline
start_length = 7
start_sound = 'sound/machines/medical/flatline_start.ogg'
mid_sounds = list('sound/machines/medical/flatline_mid.ogg')
mid_length = 10
volume = 35
50 changes: 50 additions & 0 deletions code/datums/status_effects/debuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,56 @@
desc = "You've fallen asleep. Wait a bit and you should wake up. Unless you don't, considering how helpless you are."
icon_state = "asleep"

//LIFE SUPPORT
/datum/status_effect/grouped/life_support
id = "life_support"
duration = -1
tick_interval = 10
alert_type = /atom/movable/screen/alert/status_effect/life_support
///last time the affected person was dead
var/last_dead_time

/atom/movable/screen/alert/status_effect/life_support
name = "Life Support"
desc = "You are in a state of life suspension, and you can't die. Pray that someone doesn't pull the cord."
icon_state = "stasis"

/**
* Updates the time of death
*
* Replaces the incorrect time of death with the actual time they died.
*/
/datum/status_effect/grouped/life_support/proc/update_time_of_death()
if(last_dead_time)
var/delta = world.time - last_dead_time
var/new_timeofdeath = owner.timeofdeath + delta
owner.timeofdeath = new_timeofdeath
owner.tod = station_time_timestamp(wtime=new_timeofdeath)
last_dead_time = null
if(owner.stat == DEAD)
last_dead_time = world.time

/datum/status_effect/grouped/life_support/on_creation(mob/living/new_owner, set_duration, updating_canmove)
. = ..()
if(.)
update_time_of_death()

/datum/status_effect/grouped/life_support/on_apply()
. = ..()
if(!.)
return
ADD_TRAIT(owner, TRAIT_NOCRITDAMAGE, TRAIT_STATUS_EFFECT(id))
ADD_TRAIT(owner, TRAIT_NODEATH, TRAIT_STATUS_EFFECT(id))

/datum/status_effect/grouped/life_support/tick()
update_time_of_death()

/datum/status_effect/grouped/life_support/on_remove()
REMOVE_TRAIT(owner,TRAIT_NOCRITDAMAGE, TRAIT_STATUS_EFFECT(id))
REMOVE_TRAIT(owner,TRAIT_NODEATH, TRAIT_STATUS_EFFECT(id))
update_time_of_death()
return ..()

//STASIS
/datum/status_effect/grouped/stasis
id = "stasis"
Expand Down
10 changes: 0 additions & 10 deletions code/game/machinery/computer/Operating.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
circuit = /obj/item/circuitboard/computer/operating

var/obj/structure/table/optable/table
var/obj/machinery/stasis/sbed
var/list/advanced_surgeries = list()
var/datum/techweb/linked_techweb
light_color = LIGHT_COLOR_BLUE
Expand All @@ -33,10 +32,6 @@
table = locate(/obj/structure/table/optable) in get_step(src, direction)
if(table && table.computer == src)
table.computer = null
else
sbed = locate(/obj/machinery/stasis) in get_step(src, direction)
if(sbed && sbed.op_computer == src)
sbed.op_computer = null
linked_techweb = null
. = ..()

Expand Down Expand Up @@ -77,11 +72,6 @@
if(table)
table.computer = src
break
else
sbed = locate(/obj/machinery/stasis) in get_step(src, direction)
if(sbed)
sbed.op_computer = src
break

/obj/machinery/computer/operating/ui_state(mob/user)
return GLOB.not_incapacitated_state
Expand Down
84 changes: 84 additions & 0 deletions code/game/machinery/medical/_medical.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/obj/machinery/medical
name = "Medical Unit"
desc = "If you see this something went horrbily, horrbily wrong."
icon = 'icons/obj/machines/medical/medical_machinery.dmi'
icon_state = "mechanical_liver"
density = TRUE
anchored = TRUE
mouse_drag_pointer = MOUSE_ACTIVE_POINTER
idle_power_usage = 100
active_power_usage = 750
///Whos is attached to the life support.
var/mob/living/carbon/attached
///Active beam currently connected to attached target
var/datum/beam/attached_beam = null

/obj/machinery/medical/Initialize()
. = ..()
START_PROCESSING(SSmachines, src)

/obj/machinery/medical/Destroy()
STOP_PROCESSING(SSmachines, src)
clear_status()
return ..()

/obj/machinery/medical/wrench_act(mob/living/user, obj/item/I)
. = ..()
anchored = !anchored
return

/obj/machinery/medical/MouseDrop(mob/living/target)
. = ..()
if(!ishuman(usr) || !usr.canUseTopic(src, BE_CLOSE) || !isliving(target))
return

if(attached)
usr.visible_message(span_warning("[usr] detaches [src] from [target]."), span_notice("You detach [src] from [target]."))
clear_status()
attached = null
return

if(!target.has_dna())
to_chat(usr, span_warning("The [name] beeps: 'Warning, incompatible creature!'"))
return

if(Adjacent(target) && usr.Adjacent(target))
usr.visible_message(span_warning("[usr] attaches [src] to [target]."), span_notice("You attach [src] to [target]."))
attached_beam = src.Beam(target, icon_state = "1-full", maxdistance = 3)
add_fingerprint(usr)
attached = target
update_appearance(UPDATE_ICON)

/obj/machinery/medical/process()
update_appearance(UPDATE_ICON)

if(!attached)
use_power = IDLE_POWER_USE
return

if(machine_stat & (NOPOWER|BROKEN))
clear_status()
return

if(!(get_dist(src, attached) <= 2 && isturf(attached.loc))) //you will most likely have multiple machines hooked up to you. Running away from them is a bad idea.
to_chat(attached, "<span class='userdanger'>The [name] lines are ripped out of you!</span>")
attached.apply_damage(20, BRUTE, BODY_ZONE_CHEST)
attached.apply_damage(15, BRUTE, pick(BODY_ZONE_R_ARM, BODY_ZONE_L_ARM))
clear_status()
attached = null
return

use_power = ACTIVE_POWER_USE

return

/**
* Properly gets rid of status effects from the attached
*
* Internal function, you shouldn't be calling this from anywhere else. Gets rid of all the status effects, traits and other shit you might have
* put on the attached victim. Automatically updates overlays in case you have some, and changes power to idle power use.
*/
/obj/machinery/medical/proc/clear_status()
update_appearance(UPDATE_ICON)
qdel(attached_beam)
return
22 changes: 22 additions & 0 deletions code/game/machinery/medical/dialysis.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/obj/machinery/medical/dialysis
name = "Direct Blood Filtration Unit"
desc = "Automatically filtrates your blood from all chemicals."
icon_state = "dialysis"
///Amount of purged chems per process
var/purge_amount = 0.5

/obj/machinery/medical/dialysis/RefreshParts()
var/change = 0
for(var/obj/item/stock_parts/capacitor/capacitor in component_parts)
change += capacitor.rating
purge_amount = initial(purge_amount) * change
return

/obj/machinery/medical/dialysis/process()
. = ..()
if(!attached || !attached.reagents)
return
for(var/R in attached.reagents.reagent_list)
var/datum/reagent/reagent = R
attached.reagents.remove_reagent(reagent.type, purge_amount)
return
Loading
Loading