This repository has been archived by the owner on Jan 28, 2023. It is now read-only.
forked from Baystation12/Baystation12
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes and improvements for suit sensors and jammers
- Loading branch information
Showing
22 changed files
with
270 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,105 @@ | ||
/********* | ||
*Vital * | ||
*********/ | ||
|
||
/* Vital */ | ||
/crew_sensor_modifier/vital/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) | ||
crew_data["oxy"] = round(H.getOxyLoss(), 1) | ||
crew_data["tox"] = round(H.getToxLoss(), 1) | ||
crew_data["fire"] = round(H.getFireLoss(), 1) | ||
crew_data["brute"] = round(H.getBruteLoss(), 1) | ||
crew_data["true_pulse"] = -1 | ||
crew_data["pulse"] = "N/A" | ||
crew_data["pulse_span"] = "neutral" | ||
if(!H.isSynthetic() && H.should_have_organ(BP_HEART)) | ||
var/obj/item/organ/internal/heart/O = H.internal_organs_by_name[BP_HEART] | ||
if (!O || O.robotic < ORGAN_ROBOT) // Don't make medical freak out over prosthetic hearts | ||
crew_data["true_pulse"] = H.pulse() | ||
crew_data["pulse"] = H.get_pulse(1) | ||
switch(crew_data["true_pulse"]) | ||
if(PULSE_NONE) | ||
crew_data["pulse_span"] = "bad" | ||
if(PULSE_SLOW) | ||
crew_data["pulse_span"] = "average" | ||
if(PULSE_NORM) | ||
crew_data["pulse_span"] = "good" | ||
if(PULSE_FAST) | ||
crew_data["pulse_span"] = "highlight" | ||
if(PULSE_2FAST) | ||
crew_data["pulse_span"] = "average" | ||
if(PULSE_THREADY) | ||
crew_data["pulse_span"] = "bad" | ||
|
||
crew_data["pressure"] = "N/A" | ||
crew_data["true_oxygenation"] = -1 | ||
crew_data["oxygenation"] = "" | ||
crew_data["oxygenation_span"] = "" | ||
if(!H.isSynthetic() && H.should_have_organ(BP_HEART)) | ||
crew_data["pressure"] = H.get_blood_pressure() | ||
crew_data["true_oxygenation"] = H.get_blood_oxygenation() | ||
switch (crew_data["true_oxygenation"]) | ||
if(105 to INFINITY) | ||
crew_data["oxygenation"] = "increased" | ||
crew_data["oxygenation_span"] = "highlight" | ||
if(BLOOD_VOLUME_SAFE to 105) | ||
crew_data["oxygenation"] = "normal" | ||
crew_data["oxygenation_span"] = "good" | ||
if(BLOOD_VOLUME_OKAY to BLOOD_VOLUME_SAFE) | ||
crew_data["oxygenation"] = "low" | ||
crew_data["oxygenation_span"] = "average" | ||
if(BLOOD_VOLUME_BAD to BLOOD_VOLUME_OKAY) | ||
crew_data["oxygenation"] = "very low" | ||
crew_data["oxygenation_span"] = "bad" | ||
if(-(INFINITY) to BLOOD_VOLUME_BAD) | ||
crew_data["oxygenation"] = "extremely low" | ||
crew_data["oxygenation_span"] = "bad" | ||
|
||
crew_data["bodytemp"] = H.bodytemperature - T0C | ||
return ..() | ||
|
||
/********** | ||
*Jamming * | ||
**********/ | ||
/crew_sensor_modifier/vital/proc/set_healthy(var/list/crew_data) | ||
crew_data["alert"] = FALSE | ||
if(crew_data["true_pulse"] != -1) | ||
crew_data["true_pulse"] = PULSE_NORM | ||
crew_data["pulse"] = rand(60, 90) | ||
crew_data["pulse_span"] = "good" | ||
|
||
/crew_sensor_modifier/vital/jamming | ||
priority = 5 | ||
if(crew_data["true_oxygenation"] != -1) | ||
crew_data["pressure"] = "[Floor(120+rand(-5,5))]/[Floor(80+rand(-5,5))]" | ||
crew_data["true_oxygenation"] = 100 | ||
crew_data["oxygenation"] = "normal" | ||
crew_data["oxygenation_span"] = "good" | ||
|
||
/crew_sensor_modifier/vital/jamming/healthy/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) | ||
crew_data["oxy"] = 0 | ||
crew_data["tox"] = 0 | ||
crew_data["fire"] = 0 | ||
crew_data["brute"] = 0 | ||
return MOD_SUIT_SENSORS_HANDLED | ||
/crew_sensor_modifier/vital/proc/set_dead(var/list/crew_data) | ||
crew_data["alert"] = TRUE | ||
if(crew_data["true_pulse"] != -1) | ||
crew_data["true_pulse"] = PULSE_NONE | ||
crew_data["pulse"] = 0 | ||
crew_data["pulse_span"] = "bad" | ||
|
||
/crew_sensor_modifier/vital/jamming/oxy/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) | ||
. = ..() | ||
crew_data["oxy"] = max(200, crew_data["oxy"]) | ||
if(crew_data["true_oxygenation"] != -1) | ||
crew_data["pressure"] = "[Floor((120+rand(-5,5))*0.25)]/[Floor((80+rand(-5,5))*0.25)]" | ||
crew_data["true_oxygenation"] = 25 | ||
crew_data["oxygenation"] = "extremely low" | ||
crew_data["oxygenation_span"] = "bad" | ||
|
||
/crew_sensor_modifier/vital/jamming/tox/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) | ||
. = ..() | ||
crew_data["tox"] = max(200, crew_data["tox"]) | ||
/* Jamming */ | ||
/crew_sensor_modifier/vital/jamming | ||
priority = 5 | ||
|
||
/crew_sensor_modifier/vital/jamming/fire/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) | ||
/crew_sensor_modifier/vital/jamming/healthy/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) | ||
. = ..() | ||
crew_data["fire"] = max(200, crew_data["fire"]) | ||
set_healthy(crew_data) | ||
return MOD_SUIT_SENSORS_HANDLED | ||
|
||
/crew_sensor_modifier/vital/jamming/brute/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) | ||
/crew_sensor_modifier/vital/jamming/dead/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) | ||
. = ..() | ||
crew_data["brute"] = max(200, crew_data["brute"]) | ||
|
||
/********* | ||
* Random * | ||
*********/ | ||
set_dead(crew_data) | ||
return MOD_SUIT_SENSORS_HANDLED | ||
|
||
/* Random */ | ||
/crew_sensor_modifier/vital/jamming/random | ||
var/min_diff = -10 | ||
var/max_diff = 50 | ||
var/next_shift = 0 | ||
var/list/harm_diffs | ||
var/static/list/harms | ||
|
||
/crew_sensor_modifier/vital/jamming/random/New() | ||
..() | ||
if(!harms) | ||
harms = list("brute", "fire", "oxy", "tox") | ||
harm_diffs = list() | ||
var/error_prob = 25 | ||
|
||
/crew_sensor_modifier/vital/jamming/random/moderate | ||
min_diff = -15 | ||
max_diff = 100 | ||
error_prob = 50 | ||
|
||
/crew_sensor_modifier/vital/jamming/random/major | ||
min_diff = -20 | ||
max_diff = 200 | ||
|
||
/crew_sensor_modifier/vital/jamming/random/proc/update_diff_range() | ||
if(world.time < next_shift) | ||
return | ||
next_shift = world.time + rand(30 SECONDS, 2 MINUTES) | ||
for(var/harm in harms) | ||
harm_diffs[harm] = rand(min_diff, max_diff) | ||
error_prob = 100 | ||
|
||
/crew_sensor_modifier/vital/jamming/random/process_crew_data(var/mob/living/carbon/human/H, var/obj/item/clothing/under/C, var/turf/pos, var/list/crew_data) | ||
..() | ||
update_diff_range() | ||
for(var/harm in harms) | ||
if(crew_data[harm] == 0 && harm_diffs[harm] < 0) // Making sure jamming(almost) always has an effect | ||
crew_data[harm] = crew_data[harm] - harm_diffs[harm] | ||
else | ||
crew_data[harm] = max(0, crew_data[harm] + harm_diffs[harm]) | ||
return MOD_SUIT_SENSORS_HANDLED | ||
. = ..() | ||
if(prob(error_prob)) | ||
pick(set_healthy(crew_data), set_dead(crew_data)) |
Oops, something went wrong.