the stuff

This commit is contained in:
SandPoot
2023-02-06 19:54:54 -03:00
parent 2d5e163916
commit 5052f836e7
15 changed files with 123 additions and 30 deletions
+3 -1
View File
@@ -46,9 +46,11 @@
#define ITEM_SLOT_HANDCUFFED (1<<18)
/// Legcuff slot (bolas, beartraps)
#define ITEM_SLOT_LEGCUFFED (1<<19)
/// To attach to a jumpsuit
#define ITEM_SLOT_ACCESSORY (1<<20)
/// Total amount of slots
#define SLOTS_AMT 20 // Keep this up to date!
#define SLOTS_AMT 21 // Keep this up to date!
//SLOT GROUP HELPERS
#define ITEM_SLOT_POCKETS (ITEM_SLOT_LPOCKET|ITEM_SLOT_RPOCKET)
+3 -1
View File
@@ -4,10 +4,12 @@
#define LOADOUT_SUBCATEGORY_NONE "Miscellaneous"
#define LOADOUT_SUBCATEGORIES_NONE list("Miscellaneous")
//accessory
#define LOADOUT_CATEGORY_ACCESSORY "Accessory"
//backpack
#define LOADOUT_CATEGORY_BACKPACK "In backpack"
#define LOADOUT_SUBCATEGORY_BACKPACK_GENERAL "General" //basically anything that there's not enough of to have its own subcategory
#define LOADOUT_SUBCATEGORY_BACKPACK_ACCESSORIES "Accessories" //maybe one day someone will make loadouts have accessory compatibility
#define LOADOUT_SUBCATEGORY_BACKPACK_TOYS "Toys"
//neck
#define LOADOUT_CATEGORY_NECK "Neck"
+1
View File
@@ -6,6 +6,7 @@
prefs.copy_to(mannequin)
if(apply_loadout && prefs.parent)
SSjob.equip_loadout(prefs.parent.mob, mannequin, bypass_prereqs = TRUE)
SSjob.post_equip_loadout(prefs.parent.mob, mannequin, bypass_prereqs = TRUE)
if(copy_job)
var/datum/job/highest = prefs.get_highest_job()
if(highest && !istype(highest, /datum/job/ai) && !istype(highest, /datum/job/cyborg))
+1
View File
@@ -412,6 +412,7 @@ DEFINE_BITFIELD(sight, list(
))
DEFINE_BITFIELD(slot_flags, list(
"ITEM_SLOT_ACCESSORY" = ITEM_SLOT_ACCESSORY,
"ITEM_SLOT_BACK" = ITEM_SLOT_BACK,
"ITEM_SLOT_BACKPACK" = ITEM_SLOT_BACKPACK,
"ITEM_SLOT_BELT" = ITEM_SLOT_BELT,
+2 -1
View File
@@ -1,5 +1,6 @@
GLOBAL_LIST_INIT(loadout_categories, list(
LOADOUT_CATEGORY_BACKPACK = list(LOADOUT_SUBCATEGORY_BACKPACK_GENERAL, LOADOUT_SUBCATEGORY_BACKPACK_ACCESSORIES, LOADOUT_SUBCATEGORY_BACKPACK_TOYS),
LOADOUT_CATEGORY_ACCESSORY = LOADOUT_SUBCATEGORIES_NONE,
LOADOUT_CATEGORY_BACKPACK = list(LOADOUT_SUBCATEGORY_BACKPACK_GENERAL, LOADOUT_SUBCATEGORY_BACKPACK_TOYS),
LOADOUT_CATEGORY_NECK = list(LOADOUT_SUBCATEGORY_NECK_GENERAL, LOADOUT_SUBCATEGORY_NECK_TIE, LOADOUT_SUBCATEGORY_NECK_SCARVES),
LOADOUT_CATEGORY_MASK = LOADOUT_SUBCATEGORIES_NONE,
LOADOUT_CATEGORY_HANDS = LOADOUT_SUBCATEGORIES_NONE,
+63 -4
View File
@@ -482,7 +482,7 @@ SUBSYSTEM_DEF(job)
if(job.dresscodecompliant)// CIT CHANGE - dress code compliance
equip_loadout(N, H) // CIT CHANGE - allows players to spawn with loadout items
job.after_spawn(H, M.client, joined_late) // note: this happens before the mob has a key! M will always have a client, H might not.
equip_loadout(N, H, TRUE)//CIT CHANGE - makes players spawn with in-backpack loadout items properly. A little hacky but it works
post_equip_loadout(N, H)//CIT CHANGE - makes players spawn with in-backpack loadout items properly. A little hacky but it works
var/list/tcg_cards
if(ishuman(H))
@@ -684,7 +684,7 @@ SUBSYSTEM_DEF(job)
message_admins(msg)
CRASH(msg)
/datum/controller/subsystem/job/proc/equip_loadout(mob/dead/new_player/N, mob/living/M, equipbackpackstuff, bypass_prereqs = FALSE, can_drop = TRUE)
/datum/controller/subsystem/job/proc/equip_loadout(mob/dead/new_player/N, mob/living/M, bypass_prereqs = FALSE, can_drop = TRUE)
var/mob/the_mob = N
if(!the_mob)
the_mob = M // cause this doesn't get assigned if player is a latejoiner
@@ -702,9 +702,68 @@ SUBSYSTEM_DEF(job)
permitted = FALSE
if(G.donoritem && !G.donator_ckey_check(the_mob.client.ckey))
permitted = FALSE
if(!equipbackpackstuff && G.slot == ITEM_SLOT_BACKPACK)//snowflake check since plopping stuff in the backpack doesnt work for pre-job equip loadout stuffs
if(G.handle_post_equip)
permitted = FALSE
if(equipbackpackstuff && G.slot != ITEM_SLOT_BACKPACK)//ditto
if(!permitted)
continue
var/obj/item/I = new G.path
if(I)
if(length(i[LOADOUT_COLOR])) //handle loadout colors
//handle polychromic items
if((G.loadout_flags & LOADOUT_CAN_COLOR_POLYCHROMIC) && length(G.loadout_initial_colors))
var/datum/element/polychromic/polychromic = LAZYACCESS(I.comp_lookup, "item_worn_overlays") //stupid way to do it but GetElement does not work for this
if(polychromic && istype(polychromic))
var/list/polychromic_entry = polychromic.colors_by_atom[I]
if(polychromic_entry)
if(polychromic.suits_with_helmet_typecache[I.type]) //is this one of those toggleable hood/helmet things?
polychromic.connect_helmet(I,i[LOADOUT_COLOR])
polychromic.colors_by_atom[I] = i[LOADOUT_COLOR]
I.update_icon()
else
//handle non-polychromic items (they only have one color)
I.add_atom_colour(i[LOADOUT_COLOR][1], FIXED_COLOUR_PRIORITY)
I.update_icon()
//when inputting the data it's already sanitized
if(i[LOADOUT_CUSTOM_NAME])
var/custom_name = i[LOADOUT_CUSTOM_NAME]
I.name = custom_name
if(i[LOADOUT_CUSTOM_DESCRIPTION])
var/custom_description = i[LOADOUT_CUSTOM_DESCRIPTION]
I.desc = custom_description
if(!M.equip_to_slot_if_possible(I, G.slot, disable_warning = TRUE, bypass_equip_delay_self = TRUE)) // If the job's dresscode compliant, try to put it in its slot, first
if(iscarbon(M))
var/mob/living/carbon/C = M
var/obj/item/storage/backpack/B = C.back
if(!B || !SEND_SIGNAL(B, COMSIG_TRY_STORAGE_INSERT, I, null, TRUE, TRUE)) // Otherwise, try to put it in the backpack, for carbons.
if(can_drop)
I.forceMove(get_turf(C))
else
qdel(I)
else if(!M.equip_to_slot_if_possible(I, ITEM_SLOT_BACKPACK, disable_warning = TRUE, bypass_equip_delay_self = TRUE)) // Otherwise, try to put it in the backpack
if(can_drop)
I.forceMove(get_turf(M)) // If everything fails, just put it on the floor under the mob.
else
qdel(I)
/datum/controller/subsystem/job/proc/post_equip_loadout(mob/dead/new_player/N, mob/living/M, bypass_prereqs = FALSE, can_drop = TRUE)
var/mob/the_mob = N
if(!the_mob)
the_mob = M // cause this doesn't get assigned if player is a latejoiner
var/list/chosen_gear = the_mob.client.prefs.loadout_data["SAVE_[the_mob.client.prefs.loadout_slot]"]
if(the_mob.client && the_mob.client.prefs && (chosen_gear && chosen_gear.len))
if(!ishuman(M))//no silicons allowed
return
for(var/i in chosen_gear)
var/datum/gear/G = istext(i[LOADOUT_ITEM]) ? text2path(i[LOADOUT_ITEM]) : i[LOADOUT_ITEM]
G = GLOB.loadout_items[initial(G.category)][initial(G.subcategory)][initial(G.name)]
if(!G)
continue
var/permitted = TRUE
if(!bypass_prereqs && G.restricted_roles && G.restricted_roles.len && !(M.mind.assigned_role in G.restricted_roles))
permitted = FALSE
if(G.donoritem && !G.donator_ckey_check(the_mob.client.ckey))
permitted = FALSE
if(!G.handle_post_equip)
permitted = FALSE
if(!permitted)
continue
@@ -73,7 +73,7 @@
yolk.gib()
QDEL_NULL(egg)
return ..()
/obj/effect/mob_spawn/human/ash_walker
name = "ash walker egg"
desc = "A man-sized yellow egg, spawned from some unfathomable creature. A humanoid silhouette lurks within."
@@ -835,7 +835,8 @@
var/area/A = get_area(src)
var/datum/outfit/O = new /datum/outfit/ghostcafe()
O.equip(new_spawn, FALSE, new_spawn.client)
SSjob.equip_loadout(null, new_spawn, FALSE)
SSjob.equip_loadout(null, new_spawn)
SSjob.post_equip_loadout(null, new_spawn)
SSquirks.AssignQuirks(new_spawn, new_spawn.client, TRUE, TRUE, null, FALSE, new_spawn)
new_spawn.AddElement(/datum/element/ghost_role_eligibility, free_ghosting = TRUE)
new_spawn.AddElement(/datum/element/dusts_on_catatonia)
+2 -1
View File
@@ -4,7 +4,8 @@
icon = 'icons/obj/clothing/accessories.dmi'
icon_state = "plasma"
item_state = "" //no inhands
slot_flags = 0
slot_flags = ITEM_SLOT_ACCESSORY
slot_equipment_priority = list(ITEM_SLOT_ACCESSORY)
w_class = WEIGHT_CLASS_SMALL
var/above_suit = FALSE
var/minimize_when_attached = TRUE // TRUE if shown as a small icon in corner, FALSE if overlayed
@@ -51,7 +51,8 @@
if(current_tab == LOADOUT_TAB)
//give it its loadout if not on the appearance tab
SSjob.equip_loadout(parent.mob, mannequin, FALSE, bypass_prereqs = TRUE, can_drop = FALSE)
SSjob.equip_loadout(parent.mob, mannequin, bypass_prereqs = TRUE, can_drop = FALSE)
SSjob.post_equip_loadout(parent.mob, mannequin, bypass_prereqs = TRUE, can_drop = FALSE)
else
if(previewJob && equip_job)
mannequin.job = previewJob.title
@@ -148,6 +148,10 @@
if(ITEM_SLOT_SUITSTORE)
s_store = I
update_inv_s_store()
if(ITEM_SLOT_ACCESSORY)
var/obj/item/clothing/under/attach_target = w_uniform
attach_target.attach_accessory(I, src, TRUE)
// updates handled by attach_accessory
else
to_chat(src, "<span class='danger'>You are trying to equip this item to an unsupported inventory slot. Report this to a coder!</span>")
not_handled = TRUE
@@ -1454,6 +1454,22 @@ GLOBAL_LIST_EMPTY(roundstart_race_names)
if(SEND_SIGNAL(H.back, COMSIG_TRY_STORAGE_CAN_INSERT, I, H, TRUE))
return TRUE
return FALSE
if(ITEM_SLOT_ACCESSORY)
if(istype(H.w_uniform, /obj/item/clothing/under))
var/obj/item/clothing/under/attaching_target = H.w_uniform
if(attaching_target.attached_accessory)
if(return_warning)
return_warning[1] = "\The [attaching_target] already has an accessory."
return FALSE
if(attaching_target.dummy_thick)
if(return_warning)
return_warning[1] = "\The [attaching_target] is too bulky and cannot have accessories attached to it!"
return FALSE
else
return TRUE
else if(return_warning)
return_warning[1] = "\The [H.w_uniform] cannot have any attachments."
return FALSE
return FALSE //Unsupported slot
/datum/species/proc/equip_delay_self_check(obj/item/I, mob/living/carbon/human/H, bypass_equip_delay_self)