Skip to content

Commit

Permalink
sgdfgdf
Browse files Browse the repository at this point in the history
  • Loading branch information
Anorak2024 committed Sep 19, 2024
1 parent 7bd7963 commit 9fa3bae
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 109 deletions.
15 changes: 15 additions & 0 deletions code/controllers/subsystem/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,21 @@ SUBSYSTEM_DEF(jobs)

H.mind.initial_account = M

H.mind.initial_account.insurance_type = job.insurance_type
switch (job.insurance_type)
if (INSURANCE_TYPE_NONE)
H.mind.initial_account.insurance = INSURANCE_NONE
if (INSURANCE_TYPE_BUDGETARY)
H.mind.initial_account.insurance = INSURANCE_BUDGETARY
if (INSURANCE_TYPE_STANDART)
H.mind.initial_account.insurance = INSURANCE_STANDART
if (INSURANCE_TYPE_EXTENDED)
H.mind.initial_account.insurance = INSURANCE_EXTENDED
if (INSURANCE_TYPE_DELUXE)
H.mind.initial_account.insurance = INSURANCE_DELUXE
if (INSURANCE_TYPE_NT_SPECIAL)
H.mind.initial_account.insurance = INSURANCE_NT_SPECIAL

spawn(0)
to_chat(H, "<span class='boldnotice'>Номер вашего аккаунта: [M.account_number], ПИН вашего аккаунта: [M.remote_access_pin]</span>")

Expand Down
18 changes: 0 additions & 18 deletions code/game/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -282,24 +282,6 @@
C.age = H.age
C.name = "[C.registered_name]'s ID Card ([C.assignment])"
C.photo = get_id_photo(H)

if(H.mind && H.mind.initial_account)
C.associated_account_number = H.mind.initial_account.account_number
H.mind.initial_account.insurance_type = J.insurance_type
switch (J.insurance_type)
if (INSURANCE_TYPE_NONE)
H.mind.initial_account.insurance = INSURANCE_NONE
if (INSURANCE_TYPE_BUDGETARY)
H.mind.initial_account.insurance = INSURANCE_BUDGETARY
if (INSURANCE_TYPE_STANDART)
H.mind.initial_account.insurance = INSURANCE_STANDART
if (INSURANCE_TYPE_EXTENDED)
H.mind.initial_account.insurance = INSURANCE_EXTENDED
if (INSURANCE_TYPE_DELUXE)
H.mind.initial_account.insurance = INSURANCE_DELUXE
if (INSURANCE_TYPE_NT_SPECIAL)
H.mind.initial_account.insurance = INSURANCE_NT_SPECIAL

C.owner_uid = H.UID()
C.owner_ckey = H.ckey

Expand Down
22 changes: 22 additions & 0 deletions code/game/machinery/adv_med.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

/obj/machinery/bodyscanner/Destroy()
go_out()
eject_id()
return ..()

/obj/machinery/bodyscanner/power_change(forced = FALSE)
Expand Down Expand Up @@ -171,6 +172,17 @@
add_fingerprint(user)
ui_interact(user)

/obj/machinery/bodyscanner/attackby(obj/item/I, mob/user)
if (istype(I, /obj/item/card/id))
if (inserted_id)
user.balloon_alert(src, "Занято")
else
inserted_id = I
I.forceMove(src)
user.balloon_alert(src, "Карта вставлена")

. = ..()

/obj/machinery/bodyscanner/relaymove(mob/user)
if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED))
return FALSE //maybe they should be able to get out with cuffs, but whatever
Expand All @@ -197,6 +209,13 @@
A.forceMove(loc)
SStgui.update_uis(src)

/obj/machinery/bodyscanner/proc/eject_id()
if(!inserted_id)
return
inserted_id.forceMove(loc)
inserted_id = null
SStgui.update_uis(src)

/obj/machinery/bodyscanner/force_eject_occupant(mob/target)
go_out()

Expand Down Expand Up @@ -232,6 +251,7 @@
var/list/data = list()

data["occupied"] = occupant ? TRUE : FALSE
data["has_id"] = inserted_id ? TRUE : FALSE

var/occupantData[0]
if(occupant)
Expand Down Expand Up @@ -390,6 +410,8 @@
isPrinting = FALSE
if ("insurance")
do_insurance_collection(occupant, inserted_id ? inserted_id.associated_account_number : null)
if ("eject_id")
eject_id()
else
return FALSE

Expand Down
9 changes: 8 additions & 1 deletion code/modules/economy/ATM.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ log transactions
#define CHANGE_SECURITY_LEVEL 1
#define TRANSFER_FUNDS 2
#define VIEW_TRANSACTION_LOGS 3
#define CHANGE_INSURANCE_TYPE 4
#define PRINT_DELAY 100
#define LOCKOUT_TIME 120

Expand Down Expand Up @@ -172,6 +173,7 @@ log transactions
data["owner_name"] = authenticated_account.owner_name
data["money"] = authenticated_account.money
data["insurance"] = authenticated_account.insurance
data["insurance_type"] = authenticated_account.insurance_type
data["security_level"] = authenticated_account.security_level

var/list/trx = list()
Expand Down Expand Up @@ -209,7 +211,7 @@ log transactions
to_chat(usr, "[bicon(src)]<span class='warning'>You don't have enough funds to do that!</span>")

if("view_screen")
var/list/valid_screen = list(DEFAULT_SCREEN, CHANGE_SECURITY_LEVEL, TRANSFER_FUNDS, VIEW_TRANSACTION_LOGS)
var/list/valid_screen = list(DEFAULT_SCREEN, CHANGE_SECURITY_LEVEL, TRANSFER_FUNDS, VIEW_TRANSACTION_LOGS, CHANGE_INSURANCE_TYPE)
var/screen_proper = text2num(params["view_screen"])
if(screen_proper in valid_screen)
view_screen = screen_proper
Expand All @@ -222,6 +224,11 @@ log transactions
var/new_sec_level = max(min(params["new_security_level"], 2), 0)
authenticated_account.security_level = new_sec_level

if("change_insurance_type")
if(authenticated_account)
var/new_insurance_type = params["new_insurance_type"]
authenticated_account.insurance_type = new_insurance_type

if("attempt_auth")
if(linked_db)
if(!ticks_left_locked_down)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/economy/Accounts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ GLOBAL_LIST_EMPTY(dna2account)
//the current ingame time (hh:mm:ss) can be obtained by calling:
//station_time_timestamp("hh:mm:ss")

/proc/create_account(var/new_owner_name = "Default user", var/starting_funds = 0, var/obj/machinery/computer/account_database/source_db)
/proc/create_account(var/new_owner_name = "Default user", var/starting_funds = 0, var/obj/machinery/computer/account_database/source_db, is_roundstart)

//create a new account
var/datum/money_account/M = new()
Expand Down
4 changes: 3 additions & 1 deletion code/modules/economy/Accounts_DB.dm
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,11 @@ GLOBAL_VAR(current_date_string)
starting_funds = clamp(starting_funds, 0, GLOB.station_account.money) // Not authorized to put the station in debt.
starting_funds = min(starting_funds, fund_cap) // Not authorized to give more than the fund cap.

var/datum/money_account/M = create_account(account_name, starting_funds, src)
var/datum/money_account/M = create_account(account_name, starting_funds, src, FALSE)
if(starting_funds > 0)
GLOB.station_account.charge(starting_funds, null, "New account activation", "", "New account activation", M.owner_name)
M.insurance_type = INSURANCE_TYPE_BUDGETARY
M.insurance = INSURANCE_NONE

current_page = AUT_ACCLST

Expand Down
72 changes: 64 additions & 8 deletions tgui/packages/tgui/interfaces/ATM.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ export const ATM = (props, context) => {
case 3: // VIEW_TRANSACTION_LOGS
body = <ViewTransactionLogs />;
break;
case 4: // CHANGE_INSURANCE_TYPE
body = <ChangeInsuranceType />;
break;
default:
body = <DefaultScreen />;
}
Expand Down Expand Up @@ -197,14 +200,56 @@ const TransferFunds = (props, context) => {
);
};

const DefaultScreen = (props, context) => {
const ChangeInsuranceType = (props, context) => {
const { act, data } = useBackend(context);
const [fundsAmount, insuranceAmount, setFundsAmount, setInsuranceAmount] = useLocalState(
context,
'fundsAmount',
'insuranceAmount',
0
const { insurance_type } = data;
return (
<Section title="Выберите новый тип страховки">
<LabeledList>
<LabeledList.Item label="Тип">
<Button
content="Нет (0)"
icon="unlock"
selected={insurance_type === 'None'}
onClick={() =>
act('change_insurance_type', { new_insurance_type: 'None' })
}
/>
<Button
content="Бюджетная (0)"
icon="unlock"
selected={insurance_type === 'Bugetary'}
onClick={() =>
act('change_insurance_type', { new_insurance_type: 'Bugetary' })
}
/>
<Button
content="Стандартная (500)"
icon="unlock"
selected={insurance_type === 'Standart'}
onClick={() =>
act('change_insurance_type', { new_insurance_type: 'Standart' })
}
/>
<Button
content="Делюкс (2000)"
icon="unlock"
selected={insurance_type === 'Deluxe'}
onClick={() =>
act('change_insurance_type', { new_insurance_type: 'Deluxe' })
}
/>
</LabeledList.Item>
</LabeledList>
<BackButton />
</Section>
);
};

const DefaultScreen = (props, context) => {
const { act, data } = useBackend(context);
const [fundsAmount, insuranceAmount, setFundsAmount, setInsuranceAmount] =
useLocalState(context, 'fundsAmount', 'insuranceAmount', 0);
const { owner_name, money, insurance } = data;
return (
<>
Expand All @@ -231,15 +276,19 @@ const DefaultScreen = (props, context) => {
/>
</LabeledList.Item>

<LabeledList.Item label="Insurance Points">${insurance}</LabeledList.Item>
<LabeledList.Item label="Insurance Points">
${insurance}
</LabeledList.Item>
<LabeledList.Item label="Adding Insurance">
<Input onInput={(e, value) => setInsuranceAmount(value)} />
</LabeledList.Item>
<LabeledList.Item>
<Button
content="Add insurance points"
icon="sign-out-alt"
onClick={() => act('insurance', { insurance_amount: insuranceAmount })}
onClick={() =>
act('insurance', { insurance_amount: insuranceAmount })
}
/>
</LabeledList.Item>

Expand Down Expand Up @@ -274,6 +323,13 @@ const DefaultScreen = (props, context) => {
onClick={() => act('view_screen', { view_screen: 3 })}
/>
</Box>
<Box>
<Button
content="Change type of insurance"
icon="lock"
onClick={() => act('view_screen', { view_screen: 4 })}
/>
</Box>
<Box>
<Button
content="Print balance statement"
Expand Down
5 changes: 4 additions & 1 deletion tgui/packages/tgui/interfaces/BodyScanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,11 @@ const BodyScannerMainOccupant = (props, context) => {
<Button icon="print" onClick={() => act('insurance')}>
Списать страховку
</Button>
<Button icon="user-slash" onClick={() => act('eject_id')}>
Извлечь карту
</Button>
<Button icon="user-slash" onClick={() => act('ejectify')}>
Извлечь
Извлечь пациента
</Button>
</>
}
Expand Down
158 changes: 79 additions & 79 deletions tgui/public/tgui.bundle.js

Large diffs are not rendered by default.

0 comments on commit 9fa3bae

Please sign in to comment.