Skip to content

Commit

Permalink
add: health insurance (#5921) [testmerge][a4236a6]
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 23, 2024
1 parent 8bbcbe4 commit 54ae86b
Show file tree
Hide file tree
Showing 26 changed files with 494 additions and 110 deletions.
33 changes: 33 additions & 0 deletions code/__DEFINES/insurance.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#define INSURANCE_NONE 0
#define INSURANCE_BUDGETARY 1000
#define INSURANCE_STANDART 3000
#define INSURANCE_EXTENDED 6000
#define INSURANCE_DELUXE 10000
#define INSURANCE_NT_SPECIAL 100000 // CC roles don't have accounts, but if they do, they will have this insurance.

#define INSURANCE_NONE_COST 0
#define INSURANCE_BUDGETARY_COST 0
#define INSURANCE_STANDART_COST 500
#define INSURANCE_DELUXE_COST 2000

#define INSURANCE_TYPE_NONE "None"
#define INSURANCE_TYPE_BUDGETARY "Bugetary"
#define INSURANCE_TYPE_STANDART "Standart"
#define INSURANCE_TYPE_EXTENDED "Extended"
#define INSURANCE_TYPE_DELUXE "Deluxe"
#define INSURANCE_TYPE_NT_SPECIAL "NT Special"

#define REQ_INSURANCE_BRUT 1.5
#define REQ_INSURANCE_BURN 1.5
#define REQ_INSURANCE_OXY 0.5
#define REQ_INSURANCE_TOX 0.5
#define REQ_INSURANCE_ORGAN 1
#define REQ_INSURANCE_RAD 1
#define REQ_INSURANCE_CLONE 2
#define REQ_INSURANCE_BLOOD 2 // 1% of max blood
#define REQ_INSURANCE_INTBLEED 150
#define REQ_INSURANCE_BONE 150
#define REQ_INSURANCE_LOST_ORGAN 300
#define REQ_INSURANCE_LOST_LIMB 300
#define REQ_INSURANCE_CRIT 250
#define REQ_INSURANCE_DEATH 500
17 changes: 17 additions & 0 deletions code/controllers/subsystem/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,8 @@ SUBSYSTEM_DEF(jobs)
/datum/controller/subsystem/jobs/proc/CreateMoneyAccount(mob/living/H, rank, datum/job/job)
var/money_amount = rand(job.min_start_money, job.max_start_money)
var/datum/money_account/M = create_account(H.real_name, money_amount, null, job, TRUE)
if (H.dna)
GLOB.dna2account[H.dna] = M
var/remembered_info = ""

remembered_info += "<b>Номер вашего аккаунта:</b> #[M.account_number]<br>"
Expand All @@ -663,6 +665,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
7 changes: 0 additions & 7 deletions code/defines/procs/radio.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,3 @@
freq_text = format_frequency(display_freq)

return freq_text

/proc/get_message_server()
if(GLOB.message_servers)
for(var/obj/machinery/message_server/MS in GLOB.message_servers)
if(MS.active)
return MS
return null
1 change: 1 addition & 0 deletions code/game/jobs/job/civilian.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
minimal_access = list() //See /datum/job/assistant/get_access()
alt_titles = list("Tourist","Businessman","Trader","Assistant")
outfit = /datum/outfit/job/assistant
insurance_type = INSURANCE_TYPE_BUDGETARY

salary = SALARY_FOR_NISHEBROD
min_start_money = 10
Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/engineering.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
exp_requirements = 3000
exp_type = EXP_TYPE_ENGINEERING
outfit = /datum/outfit/job/chief_engineer
insurance_type = INSURANCE_TYPE_DELUXE

salary = 300
min_start_money = 400
Expand Down
3 changes: 3 additions & 0 deletions code/game/jobs/job/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
var/required_objectives=list() // Objectives that are ALWAYS added.
var/optional_objectives=list() // Objectives that are SOMETIMES added.

var/insurance = INSURANCE_STANDART
var/insurance_type = INSURANCE_TYPE_STANDART

//Only override this proc
/datum/job/proc/after_spawn(mob/living/carbon/human/H)

Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
exp_requirements = 3000
exp_type = EXP_TYPE_MEDICAL
outfit = /datum/outfit/job/cmo
insurance_type = INSURANCE_TYPE_DELUXE

salary = 300
min_start_money = 400
Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/science.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
/datum/job_objective/further_research
)
outfit = /datum/outfit/job/rd
insurance_type = INSURANCE_TYPE_DELUXE

salary = 300
min_start_money = 400
Expand Down
6 changes: 6 additions & 0 deletions code/game/jobs/job/security.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
exp_type = EXP_TYPE_SECURITY
disabilities_allowed = 0
outfit = /datum/outfit/job/hos
insurance_type = INSURANCE_TYPE_DELUXE

salary = 300
min_start_money = 400
Expand Down Expand Up @@ -79,6 +80,7 @@
exp_requirements = 2100
exp_type = EXP_TYPE_SECURITY
outfit = /datum/outfit/job/warden
insurance_type = INSURANCE_TYPE_DELUXE

salary = 170
min_start_money = 200
Expand Down Expand Up @@ -130,6 +132,7 @@
blocked_race_for_job = list(SPECIES_VOX)
exp_type = EXP_TYPE_SECURITY
outfit = /datum/outfit/job/detective
insurance_type = INSURANCE_TYPE_DELUXE

salary = 170
min_start_money = 200
Expand Down Expand Up @@ -194,6 +197,7 @@
exp_requirements = 600
exp_type = EXP_TYPE_CREW
outfit = /datum/outfit/job/officer
insurance_type = INSURANCE_TYPE_DELUXE

salary = 170
min_start_money = 200
Expand Down Expand Up @@ -262,6 +266,7 @@
exp_requirements = 1800
exp_type = EXP_TYPE_MEDICAL
outfit = /datum/outfit/job/brigdoc
insurance_type = INSURANCE_TYPE_DELUXE

salary = 170
min_start_money = 200
Expand Down Expand Up @@ -303,6 +308,7 @@
exp_requirements = 1200
exp_type = EXP_TYPE_SECURITY
outfit = /datum/outfit/job/pilot
insurance_type = INSURANCE_TYPE_DELUXE

salary = 170
min_start_money = 200
Expand Down
2 changes: 2 additions & 0 deletions code/game/jobs/job/silicon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
minimal_player_age = 30
exp_requirements = 3000
exp_type = EXP_TYPE_SILICON
insurance_type = INSURANCE_TYPE_NONE

/datum/job/ai/equip(mob/living/carbon/human/H)
if(!H)
Expand All @@ -33,6 +34,7 @@
exp_requirements = 300
exp_type = EXP_TYPE_CREW
alt_titles = list("Robot")
insurance_type = INSURANCE_TYPE_NONE

/datum/job/cyborg/equip(mob/living/carbon/human/H)
if(!H)
Expand Down
6 changes: 6 additions & 0 deletions code/game/jobs/job/supervisor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ GLOBAL_DATUM_INIT(captain_announcement, /datum/announcement/minor, new(do_newsca
exp_type = EXP_TYPE_COMMAND
disabilities_allowed = 0
outfit = /datum/outfit/job/captain
insurance_type = INSURANCE_TYPE_DELUXE

salary = 500
min_start_money = 600
Expand Down Expand Up @@ -89,6 +90,7 @@ GLOBAL_DATUM_INIT(captain_announcement, /datum/announcement/minor, new(do_newsca
ACCESS_THEATRE, ACCESS_CHAPEL_OFFICE, ACCESS_LIBRARY, ACCESS_RESEARCH, ACCESS_HEADS_VAULT, ACCESS_MINING_STATION,
ACCESS_CLOWN, ACCESS_MIME, ACCESS_HOP, ACCESS_RC_ANNOUNCE, ACCESS_KEYCARD_AUTH, ACCESS_GATEWAY, ACCESS_WEAPONS, ACCESS_MINERAL_STOREROOM)
outfit = /datum/outfit/job/hop
insurance_type = INSURANCE_TYPE_DELUXE

salary = 300
min_start_money = 400
Expand Down Expand Up @@ -146,6 +148,7 @@ GLOBAL_DATUM_INIT(captain_announcement, /datum/announcement/minor, new(do_newsca
ACCESS_CLOWN, ACCESS_MIME, ACCESS_RC_ANNOUNCE, ACCESS_KEYCARD_AUTH, ACCESS_GATEWAY, ACCESS_WEAPONS, ACCESS_NTREP)
alt_titles = list("NT Consultant","Central Command Consultant")
outfit = /datum/outfit/job/nanotrasenrep
insurance_type = INSURANCE_TYPE_DELUXE

salary = 300
min_start_money = 400
Expand Down Expand Up @@ -193,6 +196,7 @@ GLOBAL_DATUM_INIT(captain_announcement, /datum/announcement/minor, new(do_newsca
minimal_access = list(ACCESS_FORENSICS_LOCKERS, ACCESS_SEC_DOORS, ACCESS_MEDICAL, ACCESS_CONSTRUCTION, ACCESS_ENGINE, ACCESS_MAINT_TUNNELS, ACCESS_RESEARCH,
ACCESS_RC_ANNOUNCE, ACCESS_KEYCARD_AUTH, ACCESS_HEADS, ACCESS_BLUESHIELD, ACCESS_WEAPONS)
outfit = /datum/outfit/job/blueshield
insurance_type = INSURANCE_TYPE_DELUXE

salary = 300
min_start_money = 400
Expand Down Expand Up @@ -251,6 +255,7 @@ GLOBAL_DATUM_INIT(captain_announcement, /datum/announcement/minor, new(do_newsca
minimal_access = list(ACCESS_SECURITY, ACCESS_SEC_DOORS, ACCESS_BRIG, ACCESS_COURT, ACCESS_MAINT_TUNNELS, ACCESS_LAWYER, ACCESS_MAGISTRATE, ACCESS_HEADS)
alt_titles = list("Judge")
outfit = /datum/outfit/job/judge
insurance_type = INSURANCE_TYPE_DELUXE

salary = 170
min_start_money = 200
Expand Down Expand Up @@ -300,6 +305,7 @@ GLOBAL_DATUM_INIT(captain_announcement, /datum/announcement/minor, new(do_newsca
exp_requirements = 3000
exp_type = EXP_TYPE_CREW
outfit = /datum/outfit/job/lawyer
insurance_type = INSURANCE_TYPE_DELUXE

salary = 170
min_start_money = 200
Expand Down
2 changes: 2 additions & 0 deletions code/game/jobs/job/support.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
exp_type = EXP_TYPE_CREW
alt_titles = list("Chief Supply Manager")
outfit = /datum/outfit/job/qm
insurance_type = INSURANCE_TYPE_DELUXE // Always has been.

//QM IS NOT THE HEAD!!
salary = 300
Expand Down Expand Up @@ -86,6 +87,7 @@
minimal_access = list(ACCESS_MINING, ACCESS_MINT, ACCESS_MINING_STATION, ACCESS_MAILSORTING, ACCESS_MAINT_TUNNELS, ACCESS_MINERAL_STOREROOM)
alt_titles = list("Spelunker")
outfit = /datum/outfit/job/mining
insurance_type = INSURANCE_TYPE_EXTENDED

salary = 100
min_start_money = 100
Expand Down
1 change: 1 addition & 0 deletions code/game/jobs/job/syndicate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
admin_only = 1
syndicate_command = 1
outfit = /datum/outfit/job/syndicateofficer
insurance_type = INSURANCE_TYPE_NONE

/datum/job/syndicateofficer/get_access()
return get_syndicate_access(title)
Expand Down
24 changes: 24 additions & 0 deletions code/game/machinery/adv_med.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
var/mob/living/carbon/human/occupant
var/known_implants = list(/obj/item/implant/chem, /obj/item/implant/death_alarm, /obj/item/implant/mindshield, /obj/item/implant/tracking, /obj/item/implant/health)
var/isPrinting = FALSE
var/obj/item/card/id/inserted_id = null

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

/obj/machinery/bodyscanner/power_change(forced = FALSE)
Expand Down Expand Up @@ -170,6 +172,16 @@
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(user, "занято")
else if (user.drop_transfer_item_to_loc(I, src))
inserted_id = I
user.balloon_alert(user, "карта вставлена")

. = ..()

/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 @@ -196,6 +208,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 @@ -231,6 +250,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 @@ -387,6 +407,10 @@
P.info += "<br><br><b>Notes:</b><br>"
P.name = "Body Scan - [name]"
isPrinting = FALSE
if ("insurance")
do_insurance_collection(usr, occupant, inserted_id ? inserted_id.associated_account_number : null)
if ("eject_id")
eject_id()
else
return FALSE

Expand Down
38 changes: 36 additions & 2 deletions code/game/objects/items/devices/scanners.dm
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ REAGENT SCANNER

var/isPrinting = FALSE

var/datum/money_account/connected_acc = null

var/mob/scanned = null

/obj/item/healthanalyzer/attack(mob/living/target, mob/living/user, params, def_zone, skip_attack_anim = FALSE)
add_fingerprint(user)
Expand Down Expand Up @@ -317,6 +320,9 @@ REAGENT SCANNER
if(!isPrinting)
print_report(user)
return 1
if(href_list["insurance"])
do_insurance_collection(user, scanned, connected_acc)
return 1
if(href_list["mode"])
toggle_mode()
return 1
Expand Down Expand Up @@ -375,7 +381,7 @@ REAGENT SCANNER
popup.open(no_focus = 1)

/obj/item/healthanalyzer/proc/get_header(mob/user)
return "<a href='byond://?src=[src.UID()];user=[user.UID()];clear=1'>Очистить</a><a href='byond://?src=[src.UID()];user=[user.UID()];mode=1'>Локализация</a>[advanced ? "<a href='byond://?src=[src.UID()];user=[user.UID()];print=1'>Печать отчета</a>" : ""]"
return "<a href='byond://?src=[src.UID()];user=[user.UID()];clear=1'>Очистить</a><a href='byond://?src=[src.UID()];user=[user.UID()];mode=1'>Локализация</a>[advanced ? "<a href='byond://?src=[src.UID()];user=[user.UID()];print=1'>Печать отчета</a><a href='byond://?src=[src.UID()];user=[user.UID()];insurance=1'>Списать страховку</a>" : ""]"

/obj/item/healthanalyzer/examine(mob/user)
. = ..()
Expand Down Expand Up @@ -438,6 +444,8 @@ REAGENT SCANNER
. = medical_scan_results(scan_subject, mode, advanced)
scanner.window_height += length(.) * 20
. = "<span class='highlight'>[jointext(., "<br>")]</span>"
scanner.scanned = scan_subject


/proc/medical_scan_results(var/mob/living/M, var/mode = 1, var/advanced = FALSE)
. = list()
Expand Down Expand Up @@ -618,7 +626,16 @@ REAGENT SCANNER
else
. += "Гены стабильны."

// Это вывод в чат
var/datum/money_account/acc = get_insurance_account(H)
if (acc)
. += "Тип страховки - [acc.insurance_type]"
else
. += "Аккаунт не обнаружен"
. += "Требуемое количество очков страховки: [get_req_insurance(H)]"
if (acc)
. += "Текущее количество очков страховки: [acc.insurance]"

// This is the output to the chat
/proc/healthscan(mob/user, mob/living/M, mode = 1, advanced = FALSE)
var/scan_data = medical_scan_results(M, mode, advanced)
to_chat(user, "[jointext(scan_data, "<br>")]")
Expand Down Expand Up @@ -659,6 +676,23 @@ REAGENT SCANNER
qdel(I)
return ATTACK_CHAIN_BLOCKED_ALL

if(istype(I, /obj/item/card/id))
add_fingerprint(user)
if(!advanced)
to_chat(user, span_warning("Для привязки счета требуется наличие продвинутого модуля сканирования."))
return ATTACK_CHAIN_PROCEED

var/obj/item/card/id/id = I

if (!id.associated_account_number)
to_chat(user, span_warning("Не обнаружено привязанного аккаунта."))
return ATTACK_CHAIN_PROCEED

connected_acc = id.associated_account_number
to_chat(user, span_notice("Аккаунт привязан."))
playsound(loc, I.usesound, 50, TRUE)
return ATTACK_CHAIN_PROCEED

return ..()


Expand Down
Loading

0 comments on commit 54ae86b

Please sign in to comment.