Skip to content

Commit

Permalink
Merge pull request #2643 from Superlagg/okay-fine-you-can-have-all-th…
Browse files Browse the repository at this point in the history
…e-clothes-jfc

Disables loadout displacement
  • Loading branch information
Tk420634 authored Jul 16, 2023
2 parents ea8538b + f98ce1c commit c82fea9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion code/controllers/subsystem/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ SUBSYSTEM_DEF(job)
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, displace_worn = (G.slot in DISPLACEABLE_SLOTS))) // If the job's dresscode compliant, try to put it in its slot, first. Destroy whatever's in there if you must.
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. Destroy whatever's in there if you must.
if(iscarbon(M))
var/mob/living/carbon/C = M
var/obj/item/storage/backpack/B = C.back
Expand Down
35 changes: 23 additions & 12 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define DEFAULT_SLOT_AMT 2
#define MAX_FREE_PER_CAT 4
#define HANDS_SLOT_AMT 2
#define BACKPACK_SLOT_AMT 4

Expand Down Expand Up @@ -1304,7 +1304,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)

dat += "<table align='center' width='100%'>"
dat += "<tr><td colspan=4><center><b><font color='[gear_points == 0 ? "#E62100" : "#CCDDFF"]'>[gear_points]</font> loadout points remaining.</b> \[<a href='?_src_=prefs;preference=gear;clear_loadout=1'>Clear Loadout</a>\]</center></td></tr>"
dat += "<tr><td colspan=4><center>You can only choose one item per category, unless it's an item that spawns in your backpack or hands.</center></td></tr>"
dat += "<tr><td colspan=4><center>You can choose up to [MAX_FREE_PER_CAT] free items per category.</center></td></tr>"
dat += "<tr><td colspan=4><center><b>"

if(!length(GLOB.loadout_items))
Expand Down Expand Up @@ -3794,11 +3794,11 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if(!toggle && has_loadout_gear(loadout_slot, "[G.type]"))//toggling off and the item effectively is in chosen gear)
remove_gear_from_loadout(loadout_slot, "[G.type]")
else if(toggle && !(has_loadout_gear(loadout_slot, "[G.type]")))
/*
if(!is_loadout_slot_available(G.category))
to_chat(user, span_danger("You cannot take this loadout, as you've already chosen too many of the same category!"))

if(!is_loadout_slot_available(G.category, G.cost))
to_chat(user, span_danger("You can only take [MAX_FREE_PER_CAT] free items from this category!"))
return
*/

if(G.donoritem && !G.donator_ckey_check(user.ckey))
to_chat(user, span_danger("This is an item intended for donator use only. You are not authorized to use this item."))
return
Expand Down Expand Up @@ -4044,23 +4044,34 @@ GLOBAL_LIST_EMPTY(preferences_datums)
key_bindings[key] = oldkeys[key]
parent?.ensure_keys_set(src)

/datum/preferences/proc/is_loadout_slot_available(slot)
/datum/preferences/proc/is_loadout_slot_available(category, cost)
if(cost)
return TRUE
var/list/L
LAZYINITLIST(L)
for(var/i in loadout_data["SAVE_[loadout_slot]"])
var/datum/gear/G = i[LOADOUT_ITEM]
var/loadie = i[LOADOUT_ITEM]
var/datum/gear/G = text2path(loadie)
if(initial(G.cost) > 0) // oh right, these are uninitialized, mb
continue // non-free items are self limiting
if(initial(G.category) != category)
continue
var/occupied_slots = L[initial(G.category)] ? L[initial(G.category)] + 1 : 1
LAZYSET(L, initial(G.category), occupied_slots)
switch(slot)
for(var/things_got in L)
if(L[things_got] > MAX_FREE_PER_CAT)
return FALSE
return TRUE
/* switch(slot)
if(SLOT_IN_BACKPACK)
if(L[LOADOUT_CATEGORY_BACKPACK] < BACKPACK_SLOT_AMT)
return TRUE
if(SLOT_HANDS)
if(L[LOADOUT_CATEGORY_HANDS] < HANDS_SLOT_AMT)
return TRUE
else
if(L[slot] < DEFAULT_SLOT_AMT)
return TRUE
if(L[slot] < MAX_FREE_PER_CAT)
return TRUE */

/datum/preferences/proc/has_loadout_gear(save_slot, gear_type)
var/list/gear_list = loadout_data["SAVE_[save_slot]"]
Expand All @@ -4086,6 +4097,6 @@ GLOBAL_LIST_EMPTY(preferences_datums)
to_chat(parent, span_userdanger("Something went wrong! Your quirks have been reset, and you'll need to set up your quirks again."))


#undef DEFAULT_SLOT_AMT
#undef MAX_FREE_PER_CAT
#undef HANDS_SLOT_AMT
#undef BACKPACK_SLOT_AMT

0 comments on commit c82fea9

Please sign in to comment.