Skip to content

Commit 5924a49

Browse files
committed
Loadouts
1 parent a3812c3 commit 5924a49

22 files changed

Lines changed: 641 additions & 2 deletions

File tree

code/__HELPERS/icons.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ GLOBAL_LIST_EMPTY(friendly_animal_types)
767767
if(job)
768768
body.dna.species.pre_equip_species_outfit(job, body, TRUE)
769769
if(outfit)
770-
body.equipOutfit(outfit, TRUE)
770+
body.equip_outfit_and_loadout(outfit, prefs, TRUE) //MASSMETA EDIT ORIGINAL: body.equipOutfit(outfit, TRUE)
771771

772772
var/icon/out_icon = icon('icons/effects/effects.dmi', "nothing")
773773
for(var/direction in showDirs)

code/controllers/subsystem/ticker.dm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,14 @@ SUBSYSTEM_DEF(ticker)
559559
SSquirks.AssignQuirks(new_player_living, new_player_mob.client)
560560
else // clear any personalities the prefs added since our job clearly does not want them
561561
new_player_living.clear_personalities()
562+
//MASSMETA ADDTIION
563+
if(ishuman(new_player_living))
564+
var/list/loadout = loadout_list_to_datums(new_player_mob.client?.prefs?.read_preference(/datum/preference/loadout))
565+
for(var/datum/loadout_item/item as anything in loadout)
566+
if (item.restricted_roles && length(item.restricted_roles) && !(player_assigned_role.title in item.restricted_roles))
567+
continue
568+
item.post_equip_item(new_player_mob.client?.prefs, new_player_living)
569+
//MASSMETA ADDITION END
562570

563571
if(ishuman(new_player_living))
564572
SEND_SIGNAL(new_player_living, COMSIG_HUMAN_CHARACTER_SETUP_FINISHED)

code/game/objects/items/robot/robot_parts.dm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@
335335
O.set_lockcharge(TRUE)
336336
to_chat(O, span_warning("Error: Servo motors unresponsive."))
337337

338+
O.equip_outfit_and_loadout(equipping_job = SSjob.get_job_type(/datum/job/cyborg)) //MASSMETA ADDITION
339+
338340
else
339341
to_chat(user, span_warning("The MMI must go in after everything else!"))
340342

code/modules/loadout/loadout_items.dm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,19 @@ GLOBAL_LIST_INIT(all_loadout_categories, init_loadout_categories())
351351
if(required_holiday)
352352
displayed_text[FA_ICON_CALENDAR_CHECK] = "Only available: [required_holiday]"
353353

354+
//MASSMETA ADDITION: Role restricted loadouts
355+
if(restricted_roles && restricted_roles.len)
356+
var/roles_text = ""
357+
358+
for(var/role in restricted_roles)
359+
if(roles_text != "")
360+
roles_text += ", "
361+
roles_text += role
362+
363+
displayed_text[FA_ICON_LOCK] = "Only equipable for [roles_text]"
364+
365+
//MASSMETA ADDITION END
366+
354367
return displayed_text
355368

356369
/**

modular_meta/_defines/_main_modular_defines_include.dm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "antagonists.dm"
55
#include "hardsuit.dm"
6-
#include "re_hooch_heals_assistants.dm"
76
#include "justice_mecha.dm"
7+
#include "loadout.dm"
8+
#include "re_hooch_heals_assistants.dm"
89
#include "techweb_nodes.dm"

modular_meta/_defines/loadout.dm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#define LOADOUT_OVERRIDE_JOB "Delete job items"
2+
#define LOADOUT_OVERRIDE_BACKPACK "Move job items to backpack"
3+
#define LOADOUT_OVERRIDE_CASE "Place loadout items in briefcase"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/datum/preference/choiced/loadout_override_preference
2+
category = PREFERENCE_CATEGORY_NON_CONTEXTUAL
3+
priority = PREFERENCE_PRIORITY_DEFAULT
4+
savefile_key = "loadout_override_preference"
5+
savefile_identifier = PREFERENCE_CHARACTER
6+
7+
/datum/preference/choiced/loadout_override_preference/init_possible_values()
8+
return list(LOADOUT_OVERRIDE_JOB, LOADOUT_OVERRIDE_BACKPACK, LOADOUT_OVERRIDE_CASE)
9+
10+
/datum/preference/choiced/loadout_override_preference/create_default_value()
11+
return LOADOUT_OVERRIDE_BACKPACK
12+
13+
/datum/preference/choiced/loadout_override_preference/apply_to_human(mob/living/carbon/human/target, value, datum/preferences/preferences)
14+
return TRUE
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/datum/loadout_item/accessory/insert_path_into_outfit(datum/outfit/outfit, mob/living/carbon/human/equipper, visuals_only = FALSE, override_items = LOADOUT_OVERRIDE_BACKPACK)
2+
if(override_items == LOADOUT_OVERRIDE_BACKPACK && !visuals_only)
3+
if(outfit.accessory)
4+
LAZYADD(outfit.backpack_contents, outfit.accessory)
5+
outfit.accessory = item_path
6+
else
7+
outfit.accessory = item_path
8+
9+
/datum/loadout_item/accessory/qm_cloak
10+
name = "QM Cloak"
11+
group = "Command Outfit"
12+
item_path = /obj/item/clothing/neck/cloak/qm
13+
restricted_roles = list(JOB_QUARTERMASTER)
14+
15+
/datum/loadout_item/accessory/hos_cloak
16+
name = "HOS Cloak"
17+
group = "Command Outfit"
18+
item_path = /obj/item/clothing/neck/cloak/hos
19+
restricted_roles = list(JOB_HEAD_OF_SECURITY)
20+
21+
/datum/loadout_item/accessory/cmo_cloak
22+
name = "CMO Cloak"
23+
group = "Command Outfit"
24+
item_path = /obj/item/clothing/neck/cloak/cmo
25+
restricted_roles = list(JOB_CHIEF_MEDICAL_OFFICER)
26+
27+
/datum/loadout_item/accessory/ce_cloak
28+
name = "CE Cloak"
29+
group = "Command Outfit"
30+
item_path = /obj/item/clothing/neck/cloak/ce
31+
restricted_roles = list(JOB_CHIEF_ENGINEER)
32+
33+
/datum/loadout_item/accessory/rd_cloak
34+
name = "RD Cloak"
35+
group = "Command Outfit"
36+
item_path = /obj/item/clothing/neck/cloak/rd
37+
restricted_roles = list(JOB_RESEARCH_DIRECTOR)
38+
39+
/datum/loadout_item/accessory/cap_cloak
40+
name = "Captain Cloak"
41+
group = "Command Outfit"
42+
item_path = /obj/item/clothing/neck/cloak/cap
43+
restricted_roles = list(JOB_CAPTAIN)
44+
45+
/datum/loadout_item/accessory/hop_cloak
46+
name = "HOP Cloak"
47+
group = "Command Outfit"
48+
item_path = /obj/item/clothing/neck/cloak/hop
49+
restricted_roles = list(JOB_HEAD_OF_PERSONNEL)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/datum/loadout_item/glasses/pre_equip_item(datum/outfit/outfit, datum/outfit/outfit_important_for_life, mob/living/carbon/human/equipper, visuals_only = FALSE)
2+
if(initial(outfit_important_for_life.glasses))
3+
.. ()
4+
return TRUE
5+
6+
/datum/loadout_item/glasses/insert_path_into_outfit(datum/outfit/outfit, mob/living/carbon/human/equipper, visuals_only = FALSE, override_items = LOADOUT_OVERRIDE_BACKPACK)
7+
if(override_items == LOADOUT_OVERRIDE_BACKPACK && !visuals_only)
8+
if(outfit.glasses)
9+
LAZYADD(outfit.backpack_contents, outfit.glasses)
10+
outfit.glasses = item_path
11+
else
12+
outfit.glasses = item_path
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/datum/loadout_item/head/pre_equip_item(datum/outfit/outfit, datum/outfit/outfit_important_for_life, mob/living/carbon/human/equipper, visuals_only = FALSE)
2+
if(initial(outfit_important_for_life.head))
3+
.. ()
4+
return TRUE
5+
6+
/datum/loadout_item/head/insert_path_into_outfit(datum/outfit/outfit, mob/living/carbon/human/equipper, visuals_only = FALSE, override_items = LOADOUT_OVERRIDE_BACKPACK)
7+
if(override_items == LOADOUT_OVERRIDE_BACKPACK && !visuals_only)
8+
if(outfit.head)
9+
LAZYADD(outfit.backpack_contents, outfit.head)
10+
outfit.head = item_path
11+
else
12+
outfit.head = item_path
13+
14+
/datum/loadout_item/head/constable
15+
name = "Constable Helmet"
16+
group = "Security Department Outfit"
17+
item_path = /obj/item/clothing/head/costume/constable
18+
restricted_roles = list(JOB_SECURITY_OFFICER, JOB_WARDEN, JOB_HEAD_OF_SECURITY, JOB_SECURITY_OFFICER_MEDICAL, JOB_SECURITY_OFFICER_ENGINEERING, JOB_SECURITY_OFFICER_SCIENCE, JOB_SECURITY_OFFICER_SUPPLY)
19+
20+
/datum/loadout_item/head/blueshirt
21+
name = "Blue Helmet"
22+
group = "Security Department Outfit"
23+
item_path = /obj/item/clothing/head/helmet/blueshirt
24+
restricted_roles = list(JOB_SECURITY_OFFICER, JOB_WARDEN, JOB_HEAD_OF_SECURITY, JOB_SECURITY_OFFICER_MEDICAL, JOB_SECURITY_OFFICER_ENGINEERING, JOB_SECURITY_OFFICER_SCIENCE, JOB_SECURITY_OFFICER_SUPPLY)

0 commit comments

Comments
 (0)