mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-21 12:02:31 +01:00
Accessory Loadout Options (#18082)
* Accessory Loadout Options * more * throw this on top * fluffy review * nope * more stuff * default log file * fix order? * indentation fix
This commit is contained in:
@@ -51,6 +51,7 @@ GLOBAL_LIST_EMPTY(gamemode_cache)
|
||||
"log_tools" = FALSE, // Tools
|
||||
"log_manifest" = TRUE, // Manifest
|
||||
"log_asset" = FALSE, // log asset caching
|
||||
"log_loadout" = TRUE, // Loadout
|
||||
|
||||
/*#### SUBSYSTEMS ####*/
|
||||
|
||||
@@ -105,6 +106,7 @@ GLOBAL_LIST_EMPTY(gamemode_cache)
|
||||
"harddel_log" = "harddel.log",
|
||||
"world_paper_log" = "world_paper.log",
|
||||
"world_manifest_log" = "world_manifest.log",
|
||||
"world_loadout_log" = "world_loadout.log",
|
||||
|
||||
/*#### SUBSYSTEMS ####*/
|
||||
|
||||
|
||||
@@ -670,14 +670,14 @@ SUBSYSTEM_DEF(jobs)
|
||||
// H, job, and prefs MUST be supplied and not null.
|
||||
// leftovers, storage, custom_equip_slots can be passed if their return values are required (proc mutates passed list), or ignored if not required.
|
||||
/datum/controller/subsystem/jobs/proc/EquipCustom(mob/living/carbon/human/H, datum/job/job, datum/preferences/prefs, list/leftovers = null, list/storage = null, list/custom_equip_slots = list())
|
||||
Debug("EC/([H]): Entry.")
|
||||
log_loadout("EC/([H]): Entry.")
|
||||
if (!istype(H) || !job)
|
||||
Debug("EC/([H]): Abort: invalid arguments.")
|
||||
log_loadout("EC/([H]): Abort: invalid arguments.")
|
||||
return FALSE
|
||||
|
||||
switch (job.title)
|
||||
if ("AI", "Cyborg")
|
||||
Debug("EC/([H]): Abort: synthetic.")
|
||||
log_loadout("EC/([H]): Abort: synthetic.")
|
||||
return FALSE
|
||||
|
||||
for(var/thing in prefs.gear)
|
||||
@@ -698,23 +698,29 @@ SUBSYSTEM_DEF(jobs)
|
||||
to_chat(H, SPAN_WARNING(cant_spawn_reason))
|
||||
continue
|
||||
|
||||
// we want to handle spawning accessories after all the other clothing items have been spawned in
|
||||
var/list/spawn_data = G.get_spawn_item_data(H, metadata, H)
|
||||
if(ispath(spawn_data[1], /obj/item/clothing/accessory))
|
||||
leftovers += thing
|
||||
continue
|
||||
|
||||
if(G.slot && !(G.slot in custom_equip_slots))
|
||||
// This is a miserable way to fix the loadout overwrite bug, but the alternative requires
|
||||
// adding an arg to a bunch of different procs. Will look into it after this merge. ~ Z
|
||||
var/obj/item/CI = G.spawn_item(null,metadata, H)
|
||||
if (H.equip_to_slot_or_del(CI, G.slot))
|
||||
to_chat(H, "<span class='notice'>Equipping you with [thing]!</span>")
|
||||
to_chat(H, SPAN_NOTICE("Equipping you with [thing]!"))
|
||||
if(G.slot != slot_tie)
|
||||
custom_equip_slots += G.slot
|
||||
Debug("EC/([H]): Equipped [CI] successfully.")
|
||||
log_loadout("EC/([H]): Equipped [CI] successfully.")
|
||||
else if (leftovers)
|
||||
leftovers += thing
|
||||
Debug("EC/([H]): Unable to equip [thing]; sending to overflow.")
|
||||
log_loadout("EC/([H]): Unable to equip [thing]; sending to overflow.")
|
||||
else if (storage)
|
||||
storage += thing
|
||||
Debug("EC/([H]): Unable to equip [thing]; sending to storage.")
|
||||
log_loadout("EC/([H]): Unable to equip [thing]; sending to storage.")
|
||||
|
||||
Debug("EC/([H]): Complete.")
|
||||
log_loadout("EC/([H]): Complete.")
|
||||
return TRUE
|
||||
|
||||
// Attempts to equip custom items that failed to equip in EquipCustom.
|
||||
@@ -722,7 +728,7 @@ SUBSYSTEM_DEF(jobs)
|
||||
// H and prefs must not be null.
|
||||
/datum/controller/subsystem/jobs/proc/EquipCustomDeferred(mob/living/carbon/human/H, datum/preferences/prefs, list/items, list/used_slots)
|
||||
. = list()
|
||||
Debug("ECD/([H]): Entry.")
|
||||
log_loadout("ECD/([H]): Entry.")
|
||||
for (var/thing in items)
|
||||
var/datum/gear/G = gear_datums[thing]
|
||||
|
||||
@@ -735,25 +741,51 @@ SUBSYSTEM_DEF(jobs)
|
||||
metadata = gear_test
|
||||
else
|
||||
metadata = list()
|
||||
|
||||
var/obj/item/CI = G.spawn_item(H, metadata, H)
|
||||
if (H.equip_to_slot_or_del(CI, G.slot))
|
||||
to_chat(H, "<span class='notice'>Equipping you with [thing]!</span>")
|
||||
used_slots += G.slot
|
||||
Debug("ECD/([H]): Equipped [thing] successfully.")
|
||||
var/equip_slot = G.slot
|
||||
var/handled_accessory = FALSE
|
||||
|
||||
else
|
||||
. += thing
|
||||
Debug("ECD/([H]): Unable to equip [thing]; dumping into overflow.")
|
||||
if(isaccessory(CI))
|
||||
var/datum/gear_tweak/accessory_slot/accessory_slot = locate(/datum/gear_tweak/accessory_slot) in G.gear_tweaks
|
||||
if(accessory_slot && metadata["[accessory_slot]"])
|
||||
var/selected_slot = metadata["[accessory_slot]"]
|
||||
switch(selected_slot)
|
||||
if(GEAR_TWEAK_ACCESSORY_SLOT_UNDER)
|
||||
if(isclothing(H.w_uniform))
|
||||
var/obj/item/clothing/worn_uniform = H.w_uniform
|
||||
if(worn_uniform.can_attach_accessory(CI))
|
||||
to_chat(H, SPAN_NOTICE("Attaching \the [CI] to your uniform!"))
|
||||
worn_uniform.attach_accessory(H, CI)
|
||||
handled_accessory = TRUE
|
||||
if(GEAR_TWEAK_ACCESSORY_SLOT_SUIT)
|
||||
if(isclothing(H.wear_suit))
|
||||
var/obj/item/clothing/worn_suit = H.wear_suit
|
||||
if(worn_suit.can_attach_accessory(CI))
|
||||
to_chat(H, SPAN_NOTICE("Attaching \the [CI] to your suit!"))
|
||||
worn_suit.attach_accessory(H, CI)
|
||||
handled_accessory = TRUE
|
||||
if(GEAR_TWEAK_ACCESSORY_SLOT_SUIT_STANDALONE)
|
||||
equip_slot = slot_wear_suit
|
||||
|
||||
Debug("ECD/([H]): Complete.")
|
||||
if(!handled_accessory)
|
||||
if (H.equip_to_slot_or_del(CI, equip_slot))
|
||||
to_chat(H, SPAN_NOTICE("Equipping you with [thing]!"))
|
||||
used_slots += equip_slot
|
||||
log_loadout("ECD/([H]): Equipped [thing] successfully.")
|
||||
else
|
||||
. += thing
|
||||
log_loadout("ECD/([H]): Unable to equip [thing]; dumping into overflow.")
|
||||
|
||||
log_loadout("ECD/([H]): Complete.")
|
||||
|
||||
// Attempts to place everything in items into a storage object located on H, deleting them if they're unable to be inserted.
|
||||
// H and prefs must not be null.
|
||||
// Returns nothing.
|
||||
/datum/controller/subsystem/jobs/proc/EquipItemsStorage(mob/living/carbon/human/H, datum/preferences/prefs, list/items)
|
||||
Debug("EIS/([H]): Entry.")
|
||||
log_loadout("EIS/([H]): Entry.")
|
||||
if (LAZYLEN(items))
|
||||
Debug("EIS/([H]): [items.len] items.")
|
||||
log_loadout("EIS/([H]): [items.len] items.")
|
||||
var/obj/item/storage/B = locate() in H
|
||||
if (B)
|
||||
for (var/thing in items)
|
||||
@@ -766,13 +798,13 @@ SUBSYSTEM_DEF(jobs)
|
||||
else
|
||||
metadata = list()
|
||||
G.spawn_item(B, metadata, H)
|
||||
Debug("EIS/([H]): placed [thing] in [B].")
|
||||
log_loadout("EIS/([H]): placed [thing] in [B].")
|
||||
|
||||
else
|
||||
to_chat(H, "<span class='danger'>Failed to locate a storage object on your mob, either you spawned with no arms and no backpack or this is a bug.</span>")
|
||||
Debug("EIS/([H]): unable to equip; no storage.")
|
||||
log_loadout("EIS/([H]): unable to equip; no storage.")
|
||||
|
||||
Debug("EIS/([H]): Complete.")
|
||||
log_loadout("EIS/([H]): Complete.")
|
||||
|
||||
/datum/controller/subsystem/jobs/proc/get_roundstart_spawnpoint(var/rank)
|
||||
var/list/loc_list = list()
|
||||
@@ -803,16 +835,16 @@ SUBSYSTEM_DEF(jobs)
|
||||
|
||||
|
||||
/datum/controller/subsystem/jobs/proc/EquipAugments(mob/living/carbon/human/H, datum/preferences/prefs)
|
||||
Debug("EA/([H]): Entry.")
|
||||
log_loadout("EA/([H]): Entry.")
|
||||
if(!istype(H))
|
||||
Debug("EA/([H]): Abort: invalid arguments.")
|
||||
log_loadout("EA/([H]): Abort: invalid arguments.")
|
||||
return FALSE
|
||||
|
||||
var/datum/job/rank = GetJob(H.mind.assigned_role)
|
||||
|
||||
switch (rank.title)
|
||||
if ("AI", "Cyborg")
|
||||
Debug("EA/([H]): Abort: synthetic.")
|
||||
log_loadout("EA/([H]): Abort: synthetic.")
|
||||
return FALSE
|
||||
|
||||
for(var/thing in prefs.gear)
|
||||
@@ -839,7 +871,7 @@ SUBSYSTEM_DEF(jobs)
|
||||
A.replaced(H, affected)
|
||||
H.update_body()
|
||||
|
||||
Debug("EA/([H]): Complete.")
|
||||
log_loadout("EA/([H]): Complete.")
|
||||
return TRUE
|
||||
|
||||
/proc/show_location_blurb(client/C, duration)
|
||||
|
||||
Reference in New Issue
Block a user