diff --git a/code/__DEFINES/preferences.dm b/code/__DEFINES/preferences.dm
index 207c01db0dc..26c682d487e 100644
--- a/code/__DEFINES/preferences.dm
+++ b/code/__DEFINES/preferences.dm
@@ -12,6 +12,7 @@
#define SOUND_PRAYERS 512
#define ANNOUNCE_LOGIN 1024
#define SOUND_ANNOUNCEMENTS 2048
+#define HIDE_RECIPES 4096
#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|MEMBER_PUBLIC|INTENT_STYLE|MIDROUND_ANTAG|SOUND_INSTRUMENTS|SOUND_SHIP_AMBIENCE|SOUND_PRAYERS|SOUND_ANNOUNCEMENTS)
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index 7ffb0c72eb0..58745f48fd9 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -39,6 +39,7 @@ var/list/preferences_datums = list()
var/ghost_hud = 1
var/inquisitive_ghost = 1
var/allow_midround_antag = 1
+ var/hide_recipes = 0
var/preferred_map = null
//character preferences
@@ -343,6 +344,7 @@ var/list/preferences_datums = list()
dat += "Ghost pda: [(chat_toggles & CHAT_GHOSTPDA) ? "All Messages" : "Nearest Creatures"]
"
dat += "Pull requests: [(chat_toggles & CHAT_PULLR) ? "Yes" : "No"]
"
dat += "Midround Antagonist: [(toggles & MIDROUND_ANTAG) ? "Yes" : "No"]
"
+ dat += "Hide uncraftable recipes: [(toggles & HIDE_RECIPES) ? "Yes" : "No"]
"
if(config.allow_Metadata)
dat += "OOC Notes: Edit
"
@@ -1123,6 +1125,9 @@ var/list/preferences_datums = list()
if("allow_midround_antag")
toggles ^= MIDROUND_ANTAG
+ if("hide_recipes")
+ toggles ^= HIDE_RECIPES
+
if("save")
save_preferences()
save_character()
diff --git a/code/modules/client/preferences_toggles.dm b/code/modules/client/preferences_toggles.dm
index 8e8e856b4ae..118d8c55e47 100644
--- a/code/modules/client/preferences_toggles.dm
+++ b/code/modules/client/preferences_toggles.dm
@@ -115,6 +115,15 @@
src << "You will [(prefs.toggles & MIDROUND_ANTAG) ? "now" : "no longer"] be considered for midround antagonist positions."
feedback_add_details("admin_verb","TMidroundA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
+/client/verb/togglehiderecipes()
+ set name = "Toggle Hidden Recipes"
+ set category = "Preferences"
+ set desc = "Toggles whether or not recipes you have no components for will be hidden from the tablecrafting menu."
+ prefs.toggles ^= HIDE_RECIPES
+ prefs.save_preferences()
+ src << "Recipes will [(prefs.toggles & HIDE_RECIPES) ? "now" : "no longer"] be hidden if you have no matching components."
+ feedback_add_details("admin_verb", "HiddenRecipes")
+
/client/verb/toggletitlemusic()
set name = "Hear/Silence LobbyMusic"
set category = "Preferences"
diff --git a/code/modules/crafting/table.dm b/code/modules/crafting/table.dm
index 687cae5be3b..8b0f3ff6e32 100644
--- a/code/modules/crafting/table.dm
+++ b/code/modules/crafting/table.dm
@@ -15,24 +15,30 @@
/obj/structure/table/proc/check_contents(datum/table_recipe/R)
check_table()
+ var/has_components = 0
+ var/stillneed = 0
main_loop:
for(var/A in R.reqs)
- var/needed_amount = R.reqs[A]
+ stillneed += R.reqs[A]
for(var/B in table_contents)
if(ispath(B, A))
if(table_contents[B] >= R.reqs[A])
+ has_components += R.reqs[A]
+ stillneed -= R.reqs[A]
continue main_loop
else
- needed_amount -= table_contents[B]
- if(needed_amount <= 0)
+ stillneed -= table_contents[B]
+ has_components += table_contents[B]
+ if(stillneed <= 0)
continue main_loop
- else
- continue
- return 0
+ // Early return was causing has_components to return less than it should.
+ if(stillneed)
+ return has_components
+
for(var/A in R.chem_catalysts)
if(table_contents[A] < R.chem_catalysts[A])
- return 0
- return 1
+ return has_components
+ return -1
/obj/structure/table/proc/check_table()
table_contents = list()
@@ -71,10 +77,10 @@
/obj/structure/table/proc/construct_item(mob/user, datum/table_recipe/R)
check_table()
var/send_feedback = 1
- if(check_contents(R))
+ if(check_contents(R) < 0)
if(check_tools(user, R))
if(do_after(user, R.time, target = src))
- if(!check_contents(R))
+ if(!check_contents(R) < 0)
return ", missing component."
if(!check_tools(user, R))
return ", missing tool."
@@ -203,9 +209,10 @@
for(var/datum/table_recipe/R in table_recipes)
if(R.category != categories[viewing_category])
continue
- if(check_contents(R))
+ var/matched_contents = check_contents(R) // Really had no reason to be calling this loop 400+ times for an if/else statement.
+ if(matched_contents < 0)
can_craft += R
- else
+ else if(matched_contents && !(user.client.prefs.toggles & HIDE_RECIPES && !matched_contents))
cant_craft += R
for(var/datum/table_recipe/R in can_craft)
@@ -263,9 +270,8 @@
var/req_text = ""
var/tool_text = ""
var/catalist_text = ""
- if(check_contents(R))
+ if(check_contents(R) < 0)
name_text ="[R.name]"
-
else
name_text = "[R.name]"
diff --git a/code/modules/food&drinks/recipes/tablecraft/recipes_burger.dm b/code/modules/food&drinks/recipes/tablecraft/recipes_burger.dm
index a775bcbad99..e147affcf4b 100644
--- a/code/modules/food&drinks/recipes/tablecraft/recipes_burger.dm
+++ b/code/modules/food&drinks/recipes/tablecraft/recipes_burger.dm
@@ -180,7 +180,7 @@
/datum/table_recipe/spellburger
name = "Spell burger"
reqs = list(
- /obj/item/clothing/head/wizard/fake,
+ /obj/item/clothing/head/wizard/fake = 1,
)
result = /obj/item/weapon/reagent_containers/food/snacks/burger/spell
category = CAT_FOOD