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

LOADOUT CATEGORIES #22

Merged
merged 21 commits into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions code/__DEFINES/~doppler_defines/loadout.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/// Used to set custom descriptions.
#define INFO_DESCRIBED "description"

/// Max amonut of misc / backpack items that are allowed.
#define MAX_ALLOWED_MISC_ITEMS 3
/// The maximum allowed amount of erp items allowed in any given character's loadout
#define MAX_ALLOWED_ERP_ITEMS 7

/// Defines for extra info blurbs, for loadout items.
#define TOOLTIP_NO_ARMOR "Armorless"
#define TOOLTIP_NO_DAMAGE "CEREMONIAL - This item has very low force and is cosmetic."
#define TOOLTIP_RANDOM_COLOR "Random Color"
#define TOOLTIP_GREYSCALE "GREYSCALED - This item can be customized via the greyscale modification UI."
#define TOOLTIP_RENAMABLE "RENAMABLE - This item can be given a custom name."

#define LOADOUT_OVERRIDE_JOB "Delete job items"
#define LOADOUT_OVERRIDE_BACKPACK "Move job to backpack"
#define LOADOUT_OVERRIDE_CASE "Place all in case"
9 changes: 9 additions & 0 deletions code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,15 @@ SUBSYSTEM_DEF(ticker)
if(new_player_mob.client?.prefs?.should_be_random_hardcore(player_assigned_role, new_player_living.mind))
new_player_mob.client.prefs.hardcore_random_setup(new_player_living)
SSquirks.AssignQuirks(new_player_living, new_player_mob.client)

//DOPPLER EDIT ADDITION
if(ishuman(new_player_living))
var/list/loadout = loadout_list_to_datums(new_player_mob.client?.prefs?.read_preference(/datum/preference/loadout))
for(var/datum/loadout_item/item as anything in loadout)
if (item.restricted_roles && length(item.restricted_roles) && !(player_assigned_role.title in item.restricted_roles))
continue
item.post_equip_item(new_player_mob.client?.prefs, new_player_living)
//DOPPLER EDIT END
CHECK_TICK

if(captainless)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/loadout/categories/pocket.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
type_to_generate = /datum/loadout_item/pocket_items
tab_order = /datum/loadout_category/head::tab_order + 5
/// How many pocket items are allowed
VAR_PRIVATE/max_allowed = 2
var/max_allowed = 2 // DOPPLER EDIT CAHANGE - ORIGINAL: VAR_PRIVATE/max_allowed = 2

/datum/loadout_category/pocket/New()
. = ..()
Expand Down
7 changes: 7 additions & 0 deletions code/modules/loadout/loadout_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,13 @@ GLOBAL_LIST_INIT(all_loadout_categories, init_loadout_categories())
equipped_item.name = trim(item_details[INFO_NAMED], PREVENT_CHARACTER_TRIM_LOSS(MAX_NAME_LEN))
ADD_TRAIT(equipped_item, TRAIT_WAS_RENAMED, "Loadout")

// DOPPLER EDIT ADDITION START - Loadout item descriptions
if(can_be_named && item_details?[INFO_DESCRIBED] && !visuals_only)
equipped_item.desc = item_details[INFO_DESCRIBED]
ADD_TRAIT(equipped_item, TRAIT_WAS_RENAMED, "Loadout")
equipped_item.on_loadout_custom_described()
// DOPPLER EDIT ADDITION END

if(can_be_reskinned && item_details?[INFO_RESKIN])
var/skin_chosen = item_details[INFO_RESKIN]
if(skin_chosen in equipped_item.unique_reskin)
Expand Down
9 changes: 9 additions & 0 deletions code/modules/mob/dead/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,15 @@
humanc.put_in_hands(new /obj/item/crowbar/large/emergency(get_turf(humanc))) //if hands full then just drops on the floor
log_manifest(character.mind.key, character.mind, character, latejoin = TRUE)

//DOPPLER EDIT ADDITION
if(humanc)
var/list/loadout = loadout_list_to_datums(humanc.client?.prefs?.read_preference(/datum/preference/loadout))
for(var/datum/loadout_item/item as anything in loadout)
if (item.restricted_roles && length(item.restricted_roles) && !(job.title in item.restricted_roles))
continue
item.post_equip_item(humanc.client?.prefs, humanc)
//DOPPLER EDIT END

/mob/dead/new_player/proc/AddEmploymentContract(mob/living/carbon/human/employee)
//TODO: figure out a way to exclude wizards/nukeops/demons from this.
for(var/C in GLOB.employmentCabinets)
Expand Down
54 changes: 54 additions & 0 deletions modular_doppler/loadout_categories/READEME.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# LOADOUT CATEGORIES

Most loadout categories are added in, if it is one that is stock TG just add in additional items in the respecitve files.

If you need to add more categories or items the following format should be followed:

## Format

```DM
/datum/loadout_category/<category name here>
category_name = "<category name here>"
category_ui_icon = FA_ICON_GLASSES // A Fontawesome icon to be used for the Category item
type_to_generate = /datum/loadout_item/<category item here>
tab_order = /datum/loadout_category/head::tab_order + 1 //This is where it will place the item in the tab order
/datum/loadout_item/<category item here>
abstract_type = /datum/loadout_item/glasses
/datum/loadout_item/<category item here>/insert_path_into_outfit(datum/outfit/outfit, mob/living/carbon/human/equipper, visuals_only = FALSE)
if(outfit.glasses)
LAZYADD(outfit.backpack_contents, outfit.glasses) // This will dictate if the item will go into the backpack if the slot is already occupied
outfit.glasses = item_path
```

```DM
/datum/loadout_item/pocket_items/<Logical name for the loadout item>
name = "<Name that will show up in the loadout menu>"
item_path = <The items actual path>
/* Here there could be additional vars specified current list of possible vars as follows:
restricted_roles // If the item is only allowed on specific roles I.E Security Items
blacklisted_roles // If the item cannot be given to specific roles I.E. Prisoner
restricted_species // If the item would cause issues with a species
required_season = null // If the item is a seasonal one and should only show up then
erp_item = FALSE // If the item is suggestive
erp_box = FALSE // If the item is suggestive and should be put in a box
/*
```

## Helper Functions

### Post equip Item

`/datum/loadout_item/proc/post_equip_item`
This proc particulalrly is useful if you wish for a specific item to do something after it gets equipped to the character. As an exapmple take the wallet, equip it on the ID card slot then just put the ID into the wallet so you dont have to put your own ID in your wallet. Useful for that sort of thing.

### Pre equip Item

`/datum/loadout_item/proc/pre_equip_item`
Useful for doing checks on a item before it gets equipped for whatever reason, most of the time check to see if the slot would affect someone who has a item there they need to survive, I.E. Plasmamen.

### Can be applied to

`/datum/loadout_item/proc/can_be_applied_to`
Checkes if the item passes requirements and isn't blacklisted based on role or species or restricted to specific role
102 changes: 102 additions & 0 deletions modular_doppler/loadout_categories/categories/belts.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/datum/loadout_category/belt
category_name = "Belt"
category_ui_icon = FA_ICON_SCREWDRIVER_WRENCH
type_to_generate = /datum/loadout_item/belts
tab_order = /datum/loadout_category/accessories::tab_order + 1


/*
* LOADOUT ITEM DATUMS FOR THE BELT SLOT
*/
/datum/loadout_item/belts
abstract_type = /datum/loadout_item/belts

/datum/loadout_item/belts/insert_path_into_outfit(datum/outfit/outfit, mob/living/carbon/human/equipper, visuals_only = FALSE)
if(outfit.belt)
LAZYADD(outfit.backpack_contents, outfit.belt)
outfit.belt = item_path


/datum/loadout_item/belts/fanny_pack_black
name = "Black Fannypack"
item_path = /obj/item/storage/belt/fannypack/black

/datum/loadout_item/belts/fanny_pack_blue
name = "Blue Fannypack"
item_path = /obj/item/storage/belt/fannypack/blue

/datum/loadout_item/belts/fanny_pack_brown
name = "Brown Fannypack"
item_path = /obj/item/storage/belt/fannypack

/datum/loadout_item/belts/fanny_pack_cyan
name = "Cyan Fannypack"
item_path = /obj/item/storage/belt/fannypack/cyan

/datum/loadout_item/belts/fanny_pack_green
name = "Green Fannypack"
item_path = /obj/item/storage/belt/fannypack/green

/datum/loadout_item/belts/fanny_pack_orange
name = "Orange Fannypack"
item_path = /obj/item/storage/belt/fannypack/orange

/datum/loadout_item/belts/fanny_pack_pink
name = "Pink Fannypack"
item_path = /obj/item/storage/belt/fannypack/pink

/datum/loadout_item/belts/fanny_pack_purple
name = "Purple Fannypack"
item_path = /obj/item/storage/belt/fannypack/purple

/datum/loadout_item/belts/fanny_pack_red
name = "Red Fannypack"
item_path = /obj/item/storage/belt/fannypack/red

/datum/loadout_item/belts/fanny_pack_yellow
name = "Yellow Fannypack"
item_path = /obj/item/storage/belt/fannypack/yellow

/datum/loadout_item/belts/fanny_pack_white
name = "White Fannypack"
item_path = /obj/item/storage/belt/fannypack/white

/datum/loadout_item/belts/lantern
name = "Lantern"
item_path = /obj/item/flashlight/lantern

/datum/loadout_item/belts/candle_box
name = "Candle Box"
item_path = /obj/item/storage/fancy/candle_box

/datum/loadout_item/belts/champion
name = "Champion's Belt"
item_path = /obj/item/storage/belt/champion

// HOLSTERS

/datum/loadout_item/belts/holster_shoulders
name = "Shoulder Holster"
item_path = /obj/item/storage/belt/holster

// USEFUL BELTS

/datum/loadout_item/belts/medical
name = "Medical Belt"
item_path = /obj/item/storage/belt/medical

/datum/loadout_item/belts/security
name = "Security Belt"
item_path = /obj/item/storage/belt/security

/datum/loadout_item/belts/utility
name = "Utility Belt"
item_path = /obj/item/storage/belt/utility

/datum/loadout_item/belts/utility/chief
name = "Chief Engineer's Utility Belt"
item_path = /obj/item/storage/belt/utility/chief

/datum/loadout_item/belts/mining
name = "Explorer's Webbing"
item_path = /obj/item/storage/belt/mining
Loading
Loading