mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
Fix loadout bugs (#5128)
## About The Pull Request Fix loadout bugs from the latest upstream ## Why It's Good For The Game its bugs ## Proof Of Testing I did ## Changelog 🆑 fix: fixed receiving duplicate loadout items fix: fixed receiving job-restricted loadout items on incorrect jobs /🆑
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
datum/preferences/preference_source,
|
||||
visuals_only = FALSE,
|
||||
datum/job/equipping,
|
||||
) // SKYRAT EDIT CHANGE - Added equipping param
|
||||
) // BUBBER EDIT CHANGE - Added equipping param
|
||||
if(isnull(preference_source))
|
||||
return equipOutfit(outfit, visuals_only)
|
||||
|
||||
@@ -28,8 +28,12 @@
|
||||
else
|
||||
CRASH("Invalid outfit passed to equip_outfit_and_loadout ([outfit])")
|
||||
|
||||
// BUBBER EDIT ADDITION BEGIN - Place in case preference
|
||||
var/obj/item/storage/briefcase/empty/travel_suitcase
|
||||
var/loadout_placement_preference = preference_source.read_preference(/datum/preference/choiced/loadout_override_preference)
|
||||
// BUBBER EDIT ADDITION END
|
||||
var/list/item_details = preference_source.read_preference(/datum/preference/loadout)
|
||||
item_details = item_details[preference_source.read_preference(/datum/preference/loadout_index)] // Bubber Edit Add - Custom Loadouts
|
||||
item_details = item_details[preference_source.read_preference(/datum/preference/loadout_index)] // BUBBER EDIT ADDITION - Custom Loadouts
|
||||
var/list/loadout_datums = loadout_list_to_datums(item_details)
|
||||
// Slap our things into the outfit given
|
||||
for(var/datum/loadout_item/item as anything in loadout_datums)
|
||||
@@ -37,58 +41,59 @@
|
||||
loadout_datums -= item
|
||||
continue
|
||||
|
||||
item.insert_path_into_outfit(equipped_outfit, src, visuals_only)
|
||||
// SKYRAT EDIT ADDITION BEGIN
|
||||
var/obj/item/storage/briefcase/empty/travel_suitcase
|
||||
var/loadout_placement_preference = preference_source.read_preference(/datum/preference/choiced/loadout_override_preference)
|
||||
// Slap our things into the outfit given
|
||||
for(var/datum/loadout_item/item as anything in loadout_datums)
|
||||
// BUBBER EDIT ADDITION BEGIN
|
||||
if(item.restricted_roles && equipping && !(equipping.title in item.restricted_roles))
|
||||
if(preference_source.parent)
|
||||
to_chat(preference_source.parent, span_warning("You were unable to get a loadout item([initial(item.item_path.name)]) due to job restrictions!"))
|
||||
loadout_datums -= item
|
||||
continue
|
||||
|
||||
if(item.blacklisted_roles && equipping && (equipping.title in item.blacklisted_roles))
|
||||
if(preference_source.parent)
|
||||
to_chat(preference_source.parent, span_warning("You were unable to get a loadout item([initial(item.item_path.name)]) due to job blacklists!"))
|
||||
loadout_datums -= item
|
||||
continue
|
||||
|
||||
if(item.restricted_species && !(dna.species.id in item.restricted_species))
|
||||
if(preference_source.parent)
|
||||
to_chat(preference_source.parent, span_warning("You were unable to get a loadout item ([initial(item.item_path.name)]) due to species restrictions!"))
|
||||
loadout_datums -= item
|
||||
continue
|
||||
|
||||
if(item.donator_only && !SSplayer_ranks.is_donator(preference_source?.parent))
|
||||
if(preference_source.parent)
|
||||
to_chat(preference_source.parent, span_warning("You were unable to get a loadout item ([initial(item.item_path.name)]) due to donator restrictions!"))
|
||||
loadout_datums -= item
|
||||
continue
|
||||
|
||||
if(item.ckeywhitelist && !(preference_source?.parent?.ckey in item.ckeywhitelist)) // Sanity checking
|
||||
if(preference_source.parent)
|
||||
to_chat(preference_source.parent, span_warning("You were unable to get a loadout item ([initial(item.item_path.name)]) due to CKEY restrictions!"))
|
||||
loadout_datums -= item
|
||||
continue
|
||||
|
||||
if(loadout_placement_preference == LOADOUT_OVERRIDE_CASE && !visuals_only)
|
||||
if(!travel_suitcase)
|
||||
travel_suitcase = new(loc)
|
||||
new item.item_path(travel_suitcase)
|
||||
else // SKYRAT EDIT END
|
||||
else
|
||||
// BUBBER EDIT ADDITION END
|
||||
item.insert_path_into_outfit(equipped_outfit, src, visuals_only, loadout_placement_preference)
|
||||
// Equip the outfit loadout items included
|
||||
if(!equipped_outfit.equip(src, visuals_only))
|
||||
return FALSE
|
||||
|
||||
// SKYRAT EDIT ADDITION
|
||||
// BUBBER EDIT ADDITION BEGIN
|
||||
if(travel_suitcase)
|
||||
put_in_hands(travel_suitcase)
|
||||
// SKYRAT EDIT END
|
||||
// BUBBER EDIT ADDITION END
|
||||
|
||||
// Handle any snowflake on_equips.
|
||||
var/list/new_contents = get_all_gear(INCLUDE_PROSTHETICS|INCLUDE_ABSTRACT|INCLUDE_ACCESSORIES)
|
||||
var/update = NONE
|
||||
for(var/datum/loadout_item/item as anything in loadout_datums)
|
||||
update |= item.on_equip_item(
|
||||
equipped_item = (loadout_placement_preference == LOADOUT_OVERRIDE_CASE && !visuals_only) ? locate(item.item_path) in travel_suitcase : locate(item.item_path) in new_contents, // BUBBER EDIT CHANGE - ORIGINAL: equipped_item = locate(item.item_path) in new_contents,
|
||||
equipped_item = locate(item.item_path) in (loadout_placement_preference == LOADOUT_OVERRIDE_CASE && !visuals_only) ? travel_suitcase : new_contents, // BUBBER EDIT CHANGE - ORIGINAL: equipped_item = locate(item.item_path) in new_contents,
|
||||
item_details = item_details?[item.item_path] || list(),
|
||||
equipper = src,
|
||||
outfit = equipped_outfit,
|
||||
@@ -123,7 +128,7 @@
|
||||
|
||||
return datums
|
||||
|
||||
// SKYRAT EDIT ADDITION
|
||||
// BUBBER EDIT ADDITION BEGIN
|
||||
/*
|
||||
* Removes all invalid paths from loadout lists.
|
||||
*
|
||||
@@ -148,4 +153,4 @@
|
||||
|
||||
/obj/item/storage/briefcase/empty/PopulateContents()
|
||||
return
|
||||
// SKYRAT EDIT END
|
||||
// BUBBER EDIT ADDITION END
|
||||
|
||||
Reference in New Issue
Block a user