mirror of
https://github.com/fulpstation/fulpstation.git
synced 2025-12-10 10:01:40 +00:00
First issue: Certain crafting recipes (for example, Hooch) require a bottle, 100u hooch and a paper bag. If the 100u of hooch is in the bottle, because the crafting recipe has the bottle before the hooch in the requirements list, the craft will runtime as the bottle is "consumed" along with all its reagents. To remedy this, I've created a simple sorter proc that runs when the global recipe list is inited. Before each recipe is added to the global recipe list, it now sorts the crafting requirements so that reagents are always processed first. It's not exactly pretty, but it solves having to either refactor crafting code (please God no) or to go through every recipe datum and manually reorder the req list or create a unit test to ensure all recipe reqs are in the appropriate order. Second issue: When crafting consumes a container, it qdels it and thus qdels all the items inside of it. I've added two snowflake checks to empty the contents of reagent_containers and storage items before they are qdel'd. No more accidentally deleting items through crafting.
81 lines
3.8 KiB
Plaintext
81 lines
3.8 KiB
Plaintext
//////////////////////////
|
|
/////Initial Building/////
|
|
//////////////////////////
|
|
|
|
/proc/make_datum_references_lists()
|
|
//hair
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/hair, GLOB.hairstyles_list, GLOB.hairstyles_male_list, GLOB.hairstyles_female_list)
|
|
//facial hair
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/facial_hair, GLOB.facial_hairstyles_list, GLOB.facial_hairstyles_male_list, GLOB.facial_hairstyles_female_list)
|
|
//underwear
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/underwear, GLOB.underwear_list, GLOB.underwear_m, GLOB.underwear_f)
|
|
//undershirt
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/undershirt, GLOB.undershirt_list, GLOB.undershirt_m, GLOB.undershirt_f)
|
|
//socks
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/socks, GLOB.socks_list)
|
|
//bodypart accessories (blizzard intensifies)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/body_markings, GLOB.body_markings_list)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/lizard, GLOB.tails_list_lizard)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails_animated/lizard, GLOB.animated_tails_list_lizard)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails/human, GLOB.tails_list_human)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/tails_animated/human, GLOB.animated_tails_list_human)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/snouts, GLOB.snouts_list)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/horns,GLOB.horns_list)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/ears, GLOB.ears_list)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/wings, GLOB.wings_list)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/wings_open, GLOB.wings_open_list)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/frills, GLOB.frills_list)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/spines, GLOB.spines_list)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/spines_animated, GLOB.animated_spines_list)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/legs, GLOB.legs_list)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/wings, GLOB.r_wings_list,roundstart = TRUE)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/caps, GLOB.caps_list)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/moth_wings, GLOB.moth_wings_list)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/moth_antennae, GLOB.moth_antennae_list)
|
|
init_sprite_accessory_subtypes(/datum/sprite_accessory/moth_markings, GLOB.moth_markings_list)
|
|
|
|
//Species
|
|
for(var/spath in subtypesof(/datum/species))
|
|
var/datum/species/S = new spath()
|
|
GLOB.species_list[S.id] = spath
|
|
sortList(GLOB.species_list, /proc/cmp_typepaths_asc)
|
|
|
|
//Surgeries
|
|
for(var/path in subtypesof(/datum/surgery))
|
|
GLOB.surgeries_list += new path()
|
|
sortList(GLOB.surgeries_list, /proc/cmp_typepaths_asc)
|
|
|
|
// Keybindings
|
|
init_keybindings()
|
|
|
|
GLOB.emote_list = init_emote_list()
|
|
|
|
init_crafting_recipes(GLOB.crafting_recipes)
|
|
|
|
/// Inits the crafting recipe list, sorting crafting recipe requirements in the process.
|
|
/proc/init_crafting_recipes(list/crafting_recipes)
|
|
for(var/path in subtypesof(/datum/crafting_recipe))
|
|
var/datum/crafting_recipe/recipe = new path()
|
|
recipe.reqs = sortList(recipe.reqs, /proc/cmp_crafting_req_priority)
|
|
crafting_recipes += recipe
|
|
return crafting_recipes
|
|
|
|
//creates every subtype of prototype (excluding prototype) and adds it to list L.
|
|
//if no list/L is provided, one is created.
|
|
/proc/init_subtypes(prototype, list/L)
|
|
if(!istype(L))
|
|
L = list()
|
|
for(var/path in subtypesof(prototype))
|
|
L += new path()
|
|
return L
|
|
|
|
//returns a list of paths to every subtype of prototype (excluding prototype)
|
|
//if no list/L is provided, one is created.
|
|
/proc/init_paths(prototype, list/L)
|
|
if(!istype(L))
|
|
L = list()
|
|
for(var/path in subtypesof(prototype))
|
|
L+= path
|
|
return L
|
|
|