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

Adds holocards to health scans, adds a new purple holocard #5968

Merged
merged 10 commits into from
Mar 26, 2024
53 changes: 34 additions & 19 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -834,25 +834,7 @@
R.fields[text("com_[counter]")] = text("Made by [U.get_authentification_name()] ([U.get_assignment()]) on [time2text(world.realtime, "DDD MMM DD hh:mm:ss")], [GLOB.game_year]<BR>[t1]")

if(href_list["medholocard"])
if(!skillcheck(usr, SKILL_MEDICAL, SKILL_MEDICAL_MEDIC))
to_chat(usr, SPAN_WARNING("You're not trained to use this."))
return
if(!has_species(src, "Human"))
to_chat(usr, SPAN_WARNING("Triage holocards only works on humans."))
return
var/newcolor = tgui_input_list(usr, "Choose a triage holo card to add to the patient:", "Triage holo card", list("black", "red", "orange", "none"))
if(!newcolor) return
if(get_dist(usr, src) > 7)
to_chat(usr, SPAN_WARNING("[src] is too far away."))
return
if(newcolor == "none")
if(!holo_card_color) return
holo_card_color = null
to_chat(usr, SPAN_NOTICE("You remove the holo card on [src]."))
else if(newcolor != holo_card_color)
holo_card_color = newcolor
to_chat(usr, SPAN_NOTICE("You add a [newcolor] holo card on [src]."))
update_targeted()
change_holo_card(usr)

if(href_list["lookitem"])
var/obj/item/I = locate(href_list["lookitem"])
Expand Down Expand Up @@ -904,6 +886,39 @@
..()
return

/mob/living/carbon/human/proc/change_holo_card(mob/user)
if(isobserver(user))
return
if(!skillcheck(user, SKILL_MEDICAL, SKILL_MEDICAL_MEDIC))
Vicacrov marked this conversation as resolved.
Show resolved Hide resolved
// Removing your own holocard when you are not trained
if(user == src && holo_card_color)
if(tgui_alert(user, "Are you sure you want to reset your own holocard?", "Resetting Holocard", list("Yes", "No")) != "Yes")
return
holo_card_color = null
to_chat(user, SPAN_NOTICE("You reset your holocard."))
update_targeted()
return
to_chat(user, SPAN_WARNING("You're not trained to use this."))
return
if(!has_species(src, "Human"))
to_chat(user, SPAN_WARNING("Triage holocards only works on humans."))
return
var/newcolor = tgui_input_list(user, "Choose a triage holo card to add to the patient:", "Triage holo card", list("black", "red", "orange", "purple", "none"))
if(!newcolor)
return
if(get_dist(user, src) > 7)
to_chat(user, SPAN_WARNING("[src] is too far away."))
return
if(newcolor == "none")
if(!holo_card_color)
return
holo_card_color = null
to_chat(user, SPAN_NOTICE("You remove the holo card on [src]."))
else if(newcolor != holo_card_color)
holo_card_color = newcolor
to_chat(user, SPAN_NOTICE("You add a [newcolor] holo card on [src]."))
update_targeted()

/mob/living/carbon/human/tgui_interact(mob/user, datum/tgui/ui) // I'M SORRY, SO FUCKING SORRY
. = ..()
ui = SStgui.try_update_ui(user, src, ui)
Expand Down
6 changes: 0 additions & 6 deletions code/modules/mob/living/carbon/human/human_attackhand.dm
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,6 @@
/mob/living/carbon/human/help_shake_act(mob/living/carbon/M)
//Target is us
if(src == M)
if(holo_card_color) //if we have a triage holocard printed on us, we remove it.
holo_card_color = null
update_targeted()
visible_message(SPAN_NOTICE("[src] removes the holo card on [gender==MALE?"himself":"herself"]."), \
SPAN_NOTICE("You remove the holo card on yourself."), null, 3)
return
Vicacrov marked this conversation as resolved.
Show resolved Hide resolved
check_for_injuries()
return

Expand Down
19 changes: 18 additions & 1 deletion code/modules/mob/living/living_healthscan.dm
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ GLOBAL_LIST_INIT(known_implants, subtypesof(/obj/item/implant))
// Fake death will make the scanner think they died of oxygen damage, thus it returns enough damage to kill minus already received damage.
return round(POSITIVE(200 - total_mob_damage))

/datum/health_scan/proc/get_holo_card_color(mob/living/target_mob)
if(!ishuman(target_mob))
return
var/mob/living/carbon/human/human_mob = target_mob
return human_mob.holo_card_color

/datum/health_scan/proc/get_health_value(mob/living/target_mob)
if(!(target_mob.status_flags & FAKEDEATH))
return target_mob.health
Expand All @@ -97,7 +103,7 @@ GLOBAL_LIST_INIT(known_implants, subtypesof(/obj/item/implant))
"clone" = round(target_mob.getCloneLoss()),
"blood_type" = target_mob.blood_type,
"blood_amount" = target_mob.blood_volume,

"holocard" = get_holo_card_color(target_mob),
"hugged" = (locate(/obj/item/alien_embryo) in target_mob),
)

Expand Down Expand Up @@ -467,6 +473,17 @@ GLOBAL_LIST_INIT(known_implants, subtypesof(/obj/item/implant))

return data

/datum/health_scan/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
switch(action)
if("change_holo_card")
if(ishuman(target_mob))
var/mob/living/carbon/human/target_human = target_mob
target_human.change_holo_card(ui.user)
return TRUE

/// legacy proc for to_chat messages on health analysers
/mob/living/proc/health_scan(mob/living/carbon/human/user, ignore_delay = FALSE, show_limb_damage = TRUE, show_browser = TRUE, alien = FALSE, do_checks = TRUE) // ahem. FUCK WHOEVER CODED THIS SHIT AS NUMBERS AND NOT DEFINES.
if(do_checks)
Expand Down
Binary file modified icons/effects/Targeted.dmi
Binary file not shown.
30 changes: 28 additions & 2 deletions tgui/packages/tgui/interfaces/HealthScan.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { useBackend } from '../backend';
import { Section, ProgressBar, Box, LabeledList, NoticeBox, Stack, Icon, Divider, Flex } from '../components';
import { Section, ProgressBar, Box, LabeledList, NoticeBox, Stack, Icon, Divider, Flex, Button } from '../components';
import { Window } from '../layouts';

export const HealthScan = (props) => {
const { data } = useBackend();
const { act, data } = useBackend();
const {
patient_mob,
patient,
dead,
health,
Expand Down Expand Up @@ -35,6 +36,7 @@ export const HealthScan = (props) => {
permadead,
advice,
species,
holocard,
} = data;

const bloodpct = blood_amount / 560;
Expand All @@ -47,6 +49,18 @@ export const HealthScan = (props) => {

const theme = Synthetic ? 'hackerman' : bodyscanner ? 'ntos' : 'default';

let holocard_message;
if (holocard === 'red') {
holocard_message = 'Patient needs life-saving treatment.';
} else if (holocard === 'orange') {
holocard_message = 'Patient needs non-urgent surgery.';
} else if (holocard === 'purple') {
holocard_message = 'Patient is infected with an XX-121 embryo.';
} else if (holocard === 'black') {
holocard_message = 'Patient is permanently deceased.';
} else {
holocard_message = 'Patient has no active holocard.';
}
return (
<Window width={500} height={bodyscanner ? 700 : 600} theme={theme}>
<Window.Content scrollable>
Expand Down Expand Up @@ -143,6 +157,18 @@ export const HealthScan = (props) => {
</Box>
)}
</LabeledList.Item>
<LabeledList.Item label="Holocard">
<NoticeBox color={holocard} inline>
{holocard_message}
</NoticeBox>

<Button
inline
style={{ 'margin-left': '2%' }}
content="Change"
onClick={() => act('change_holo_card')}
/>
</LabeledList.Item>
</LabeledList>
</Section>
{limbs_damaged ? <ScannerLimbs /> : null}
Expand Down
Loading