Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit e4cd906

Browse files
committed
pay our doctors
1 parent 047f0b1 commit e4cd906

File tree

4 files changed

+256
-14
lines changed

4 files changed

+256
-14
lines changed

code/game/objects/items/cards_ids.dm

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
. = ..()
109109
var/atom/A = target
110110
if(!proximity && prox_check)
111-
return
111+
return
112112
if(charges < 1)
113113
to_chat(user, span_danger("\The [src] is still recharging!"))
114114
return
@@ -206,7 +206,7 @@
206206
/obj/item/card/cmag/afterattack(atom/target, mob/user, proximity)
207207
. = ..()
208208
if(!proximity && prox_check)
209-
return
209+
return
210210
if(charges < 1)
211211
to_chat(user, span_danger("\The [src] is still recharging!"))
212212
return
@@ -285,7 +285,7 @@
285285
cyborg.SetStun(60) // Gives you time to run if needed.
286286
cyborg.module.transform_to(/obj/item/robot_module/clown) // No law change, but they get to clown around instead.
287287
return
288-
288+
289289
cyborg.SetStun(60) // Standard stun like from emagging.
290290
cyborg.lawupdate = FALSE
291291
cyborg.set_connected_ai(null)
@@ -314,7 +314,7 @@
314314

315315
cyborg.laws = new /datum/ai_laws/pranksimov
316316
cyborg.laws.associate(cyborg)
317-
317+
318318
cyborg.update_icons()
319319
return
320320

@@ -426,7 +426,7 @@
426426
else
427427
to_chat(user, span_notice("You insert [I] into [src], adding [cash_money] credits to the linked account."))
428428

429-
to_chat(user, span_notice("The linked account now reports a balance of $[registered_account.account_balance]."))
429+
to_chat(user, span_notice("The linked account now reports a [registered_account.account_balance >= 0 ? "balance" : "<b>debt</b>"] of $[registered_account.account_balance]."))
430430
qdel(I)
431431

432432

@@ -527,11 +527,11 @@
527527
. += "There's [mining_points] mining equipment redemption point\s loaded onto this card."
528528

529529
if(registered_account)
530-
. += "The account linked to the ID belongs to '[registered_account.account_holder]' and reports a balance of $[registered_account.account_balance]."
530+
. += "The account linked to the ID belongs to '[registered_account.account_holder]' and reports a [registered_account.account_balance >= 0 ? "balance" : "<b>debt</b>"] of $[registered_account.account_balance]."
531531
if(registered_account.account_job)
532532
var/datum/bank_account/D = SSeconomy.get_dep_account(registered_account.account_job.paycheck_department)
533533
if(D)
534-
. += "The [D.account_holder] reports a balance of $[D.account_balance]."
534+
. += "The [D.account_holder] reports a [D.account_balance >= 0 ? "balance" : "<b>debt</b>"] of $[D.account_balance]."
535535
. += span_info("Alt-Click the ID to pull money from the linked account in the form of holochips.")
536536
. += span_info("You can insert credits into the linked account by pressing holochips, cash, or coins against the ID.")
537537
if(registered_account.account_holder == user.real_name)
@@ -1111,11 +1111,11 @@ update_label("John Doe", "Clowny")
11111111
department_name = ACCOUNT_SEC_NAME
11121112

11131113
/***
1114-
*
1115-
*
1114+
*
1115+
*
11161116
* HERETIC ID SECTION (SORRY)
1117-
*
1118-
*
1117+
*
1118+
*
11191119
*/
11201120

11211121
/obj/effect/knock_portal
@@ -1141,7 +1141,7 @@ update_label("John Doe", "Clowny")
11411141
if(target)
11421142
our_airlock = target
11431143
RegisterSignal(target, COMSIG_QDELETING, PROC_REF(delete_on_door_delete))
1144-
1144+
11451145
var/static/list/loc_connections = list(
11461146
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
11471147
)
@@ -1231,7 +1231,7 @@ update_label("John Doe", "Clowny")
12311231

12321232
/obj/item/card/id/syndicate/heretic/proc/clear_portals()
12331233
QDEL_NULL(portal_one)
1234-
QDEL_NULL(portal_two)
1234+
QDEL_NULL(portal_two)
12351235

12361236
///Clears portal references
12371237
/obj/item/card/id/syndicate/heretic/proc/clear_portal_refs()
@@ -1245,7 +1245,7 @@ update_label("John Doe", "Clowny")
12451245
if(portal_one || portal_two)
12461246
clear_portals()
12471247
message += ", previous cleared"
1248-
1248+
12491249
portal_one = new(get_turf(door2), door2)
12501250
portal_two = new(get_turf(door1), door1)
12511251
portal_one.destination = portal_two

code/modules/economy/healthcare.dm

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
#define CARE_BASIC_CHECKUP "Basic Checkup"
2+
#define CARE_VACCINATION "Vaccination"
3+
#define CARE_MINOR_SURGERY "Minor Surgery"
4+
#define CARE_MAJOR_SURGERY "Major Surgery"
5+
#define CARE_EMERGENCY "Emergency Care"
6+
#define CARE_PRESCRIPTION "Prescription"
7+
#define CARE_MENTAL "Mental Health Consultataion"
8+
9+
/// This machine is designed to encourage medical staff to charge patients exorbitant prices for basic care
10+
/obj/machinery/healthcare_computer
11+
name = "healthcare computer"
12+
desc = "A convenient and user-friendly computer interface for all of your healthcare needs."
13+
icon = 'yogstation/icons/obj/register.dmi'
14+
icon_state = "register"
15+
clicksound = "keyboard"
16+
anchored = TRUE
17+
density = TRUE
18+
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF // death & taxes
19+
flags_1 = NODECONSTRUCT_1
20+
var/obj/item/radio/radio
21+
var/current_price = 0
22+
var/list/selected_care
23+
var/static/list/available_care
24+
var/department_tax = 0.08
25+
26+
/obj/machinery/healthcare_computer/Initialize(mapload)
27+
. = ..()
28+
radio = new(src)
29+
radio.keyslot = new /obj/item/encryptionkey/headset_med
30+
radio.subspace_transmission = TRUE
31+
radio.listening = FALSE
32+
radio.recalculateChannels()
33+
34+
if(available_care && islist(available_care))
35+
return
36+
37+
available_care = list(
38+
CARE_BASIC_CHECKUP = floor(50 * (1.0 + department_tax)),
39+
CARE_VACCINATION = floor(75 * (1.0 + department_tax)),
40+
CARE_MINOR_SURGERY = floor(150 * (1.0 + department_tax)),
41+
CARE_MAJOR_SURGERY = floor(300 * (1.0 + department_tax)),
42+
CARE_EMERGENCY = floor(200 * (1.0 + department_tax)),
43+
CARE_PRESCRIPTION = floor(100 * (1.0 + department_tax)),
44+
CARE_MENTAL = floor(100 * (1.0 + department_tax)),
45+
)
46+
47+
/obj/machinery/healthcare_computer/attack_hand(mob/living/user, list/modifiers)
48+
. = ..()
49+
if(.)
50+
return
51+
if(!user.combat_mode && user.stat == CONSCIOUS)
52+
ui_interact(user)
53+
return .
54+
return
55+
56+
/obj/machinery/healthcare_computer/ui_interact(mob/user, datum/tgui/ui)
57+
ui = SStgui.try_update_ui(user, src, ui)
58+
if(!is_operational())
59+
return
60+
if (!ui)
61+
ui = new(user, src, "Healthcare", name)
62+
ui.open()
63+
64+
/obj/machinery/healthcare_computer/ui_data(mob/user)
65+
. = ..()
66+
var/payee = "none"
67+
var/obj/item/card/id/card = user.get_idcard(TRUE)
68+
if(card?.registered_account?.account_holder)
69+
payee = card.registered_account.account_holder
70+
.["payee"] = payee
71+
.["current_price"] = current_price
72+
.["selected_care"] = selected_care
73+
.["available_care"] = available_care
74+
75+
/obj/machinery/healthcare_computer/ui_act(action, list/params)
76+
if(..())
77+
return TRUE
78+
if(!is_operational())
79+
return
80+
81+
switch(action)
82+
if("toggle_care")
83+
var/care_name = params["care"]
84+
if(!istext(care_name))
85+
return
86+
if(!available_care[care_name])
87+
return
88+
if(!selected_care)
89+
selected_care = list()
90+
if(care_name in selected_care)
91+
selected_care -= care_name
92+
current_price -= available_care[care_name]
93+
else
94+
selected_care |= care_name
95+
current_price += available_care[care_name]
96+
return TRUE
97+
if("pay_for_care")
98+
var/card = usr.get_idcard(TRUE)
99+
if(!card)
100+
return
101+
if(!charge_card(card))
102+
return
103+
return TRUE
104+
105+
/obj/machinery/healthcare_computer/proc/charge_card(obj/item/card/id/victim)
106+
if(!victim.registered_account)
107+
return FALSE
108+
if(current_price <= 0)
109+
return FALSE
110+
if(!selected_care || !islist(selected_care) || selected_care.len == 0)
111+
return FALSE
112+
if(!victim || !istype(victim))
113+
return FALSE
114+
115+
victim.registered_account._adjust_money(-current_price) // can't pay? it's ok, you'll just go into debt
116+
. = TRUE
117+
118+
var/list/datum/bank_account/payouts = list()
119+
var/m_staff_amt = 0
120+
for(var/datum/bank_account/account_id as anything in SSeconomy.bank_accounts)
121+
var/datum/bank_account/account = SSeconomy.bank_accounts[account_id]
122+
if(account.account_job && (account.account_job.title in GLOB.medical_positions))
123+
payouts += account
124+
m_staff_amt += 1
125+
126+
var/datum/bank_account/med_account = SSeconomy.get_dep_account(ACCOUNT_MED)
127+
med_account.adjust_money(floor(current_price * department_tax))
128+
var/after_tax = current_price * (1.0 - department_tax)
129+
130+
var/payout_amt = floor(after_tax / m_staff_amt)
131+
for(var/datum/bank_account/medical_staff as anything in payouts)
132+
medical_staff.adjust_money(payout_amt)
133+
134+
var/care = selected_care.Join(", ")
135+
radio.talk_into(src, "[victim.registered_account.account_holder] has paid for [care]. Medical staff have been paid [payout_amt]cr each.", RADIO_CHANNEL_MEDICAL)
136+
137+
current_price = 0
138+
selected_care = null
139+
140+
say("Thank you for your patronage, [victim.registered_account.account_holder]! Medical staff have been paid and notified. You are entitled to the following: [care]")
141+
142+
if(!victim.registered_account.has_money(-950)) // fraud prevention. id is shredded, debt remains on account
143+
victim.registered_account.bank_card_talk("Severe debt fraud detected! This ID will now self-destruct. Please contact a member of command to be issued a new ID.", TRUE)
144+
qdel(victim)
145+
playsound(src.loc, 'sound/items/pshred.ogg', 75, TRUE)
146+
else
147+
playsound(src.loc, 'sound/effects/cashregister.ogg', 20, TRUE)
148+
149+
#undef CARE_BASIC_CHECKUP
150+
#undef CARE_VACCINATION
151+
#undef CARE_MINOR_SURGERY
152+
#undef CARE_MAJOR_SURGERY
153+
#undef CARE_EMERGENCY
154+
#undef CARE_PRESCRIPTION
155+
#undef CARE_MENTAL
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import { useBackend } from '../backend';
2+
import { Button, Box, Table, Section } from '../components';
3+
import { Window } from '../layouts';
4+
5+
type HealthcareData = {
6+
payee: string;
7+
current_price: number;
8+
selected_care: string[] | null;
9+
available_care: any;
10+
};
11+
// https://i.imgur.com/AQlT2gV.png
12+
export const Healthcare = (props, context) => {
13+
const { act, data } = useBackend<HealthcareData>(context);
14+
return (
15+
<Window
16+
width={400}
17+
height={500}>
18+
<Window.Content>
19+
<Section title="Order" height={28}>
20+
<Table>
21+
{data.selected_care?.map((val, idx) => (
22+
<Table.Row key={idx} style={{
23+
'border': '2px solid',
24+
'border-color': '#4d4d4d',
25+
'background-color': '#007cb2',
26+
}}>
27+
<Table.Cell px={1} py={1}>
28+
{val}
29+
</Table.Cell>
30+
<Table.Cell bold collapsing minWidth={5}>
31+
{data.available_care[val]+'cr'}
32+
</Table.Cell>
33+
</Table.Row>
34+
))}
35+
<Table.Row style={{
36+
'border': '2px solid',
37+
'border-color': '#4d4d4d',
38+
'background-color': '#39888a',
39+
}}>
40+
<Table.Cell bold px={2} py={2}>
41+
Total
42+
</Table.Cell>
43+
<Table.Cell bold collapsing minWidth={5}>
44+
{
45+
(data.selected_care === null || data.selected_care.length === 0) ? '0' :
46+
(
47+
data.selected_care.length === 1 ? data.available_care[data.selected_care[0]] :
48+
(
49+
data.selected_care?.reduce(
50+
(acc, curr) =>
51+
(
52+
((acc in data.available_care) ? data.available_care[acc] : acc) + data.available_care[curr]
53+
)
54+
)
55+
)
56+
)
57+
}cr
58+
</Table.Cell>
59+
</Table.Row>
60+
<Table.Row>
61+
<Button.Confirm
62+
mx={1}
63+
my={1}
64+
px={1}
65+
py={1}
66+
disabled={data.selected_care === null || data.selected_care.length === 0}
67+
content='Checkout'
68+
onClick={() => act('pay_for_care')} />
69+
</Table.Row>
70+
</Table>
71+
</Section>
72+
<Section title="Select Care">
73+
{Object.entries(data.available_care).map((key, idx) => (
74+
<Button
75+
key={idx}
76+
content={key[0]}
77+
color={(data.selected_care || []).includes(key[0]) ? 'good' : 'bad'}
78+
onClick={() => act('toggle_care', {
79+
care: key[0],
80+
})} />
81+
))}
82+
</Section>
83+
</Window.Content>
84+
</Window>
85+
);
86+
};

yogstation.dme

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2415,6 +2415,7 @@
24152415
#include "code\modules\discord\manipulation.dm"
24162416
#include "code\modules\economy\_economy.dm"
24172417
#include "code\modules\economy\account.dm"
2418+
#include "code\modules\economy\healthcare.dm"
24182419
#include "code\modules\economy\pay_stand.dm"
24192420
#include "code\modules\emoji\emoji_parse.dm"
24202421
#include "code\modules\error_handler\error_handler.dm"

0 commit comments

Comments
 (0)