mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 05:00:55 +01:00
[MIRROR] Reagent soup / Soup rework / Stoves - A kitchen expansion [MDB IGNORE] (#20410)
* Reagent soup / Soup rework / Stoves - A kitchen expansion * fixes that stuff * puts the range stove on maps that sohuld have it * fixes some paths that don't exist anymore --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Paxilmaniac <paxilmaniac@gmail.com>
This commit is contained in:
co-authored by
MrMelbert
Paxilmaniac
parent
b8a5682077
commit
6f3befe233
@@ -2,33 +2,47 @@
|
||||
/datum/asset/spritesheet/crafting
|
||||
name = "crafting"
|
||||
|
||||
/datum/asset/spritesheet/crafting/cooking
|
||||
name = "cooking"
|
||||
|
||||
/datum/asset/spritesheet/crafting/create_spritesheets()
|
||||
var/id = 1
|
||||
for(var/atom in GLOB.crafting_recipes_atoms)
|
||||
add_atom_icon(atom, id++)
|
||||
add_tool_icons()
|
||||
|
||||
/datum/asset/spritesheet/crafting/cooking
|
||||
name = "cooking"
|
||||
|
||||
/datum/asset/spritesheet/crafting/cooking/create_spritesheets()
|
||||
var/id = 1
|
||||
for(var/atom in GLOB.cooking_recipes_atoms)
|
||||
add_atom_icon(atom, id++)
|
||||
|
||||
///Adds the atom icon to the spritesheet with given ID
|
||||
/datum/asset/spritesheet/crafting/proc/add_atom_icon(atom, id)
|
||||
var/obj/obj = initial(atom)
|
||||
if(ispath(atom, /datum/reagent))
|
||||
var/datum/reagent/reagent = atom
|
||||
obj = initial(reagent.default_container)
|
||||
var/icon_file = initial(obj.icon_preview) || initial(obj.icon)
|
||||
var/icon_state = initial(obj.icon_state_preview) || initial(obj.icon_state)
|
||||
#ifdef UNIT_TESTS
|
||||
if(!(icon_state in icon_states(icon_file)))
|
||||
stack_trace("Atom [atom] with icon '[icon_file]' missing state '[icon_state]'")
|
||||
return
|
||||
#endif
|
||||
/**
|
||||
* Adds the ingredient icon to the spritesheet with given ID
|
||||
*
|
||||
* ingredient_typepath can be an obj typepath OR a reagent typepath
|
||||
*
|
||||
* If it a reagent, it will use the default container's icon state,
|
||||
* OR if it has a glass style associated, it will use that
|
||||
*/
|
||||
/datum/asset/spritesheet/crafting/proc/add_atom_icon(ingredient_typepath, id)
|
||||
var/icon_file
|
||||
var/icon_state
|
||||
var/obj/preview_item = ingredient_typepath
|
||||
if(ispath(ingredient_typepath, /datum/reagent))
|
||||
var/datum/reagent/reagent = ingredient_typepath
|
||||
preview_item = initial(reagent.default_container)
|
||||
var/datum/glass_style/style = GLOB.glass_style_singletons[preview_item]?[reagent]
|
||||
if(istype(style))
|
||||
icon_file = style.icon
|
||||
icon_state = style.icon_state
|
||||
|
||||
icon_file ||= initial(preview_item.icon_preview) || initial(preview_item.icon)
|
||||
icon_state ||= initial(preview_item.icon_state_preview) || initial(preview_item.icon_state)
|
||||
|
||||
if(PERFORM_ALL_TESTS(focus_only/bad_cooking_crafting_icons))
|
||||
if(!icon_exists(icon_file, icon_state, scream = TRUE))
|
||||
return
|
||||
|
||||
Insert("a[id]", icon(icon_file, icon_state, SOUTH))
|
||||
|
||||
///Adds tool icons to the spritesheet
|
||||
|
||||
Reference in New Issue
Block a user