Merge pull request #17243 from tgstation/revert-16978-tablecraft-tweak

Revert "Adds player preference to hide irrelevant tablecraft recipes"
This commit is contained in:
Remie Richards
2016-04-29 15:59:59 +01:00
5 changed files with 15 additions and 33 deletions
-1
View File
@@ -12,7 +12,6 @@
#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)
-5
View File
@@ -39,7 +39,6 @@ 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
@@ -344,7 +343,6 @@ var/list/preferences_datums = list()
dat += "<b>Ghost pda:</b> <a href='?_src=prefs;preference=ghost_pda'>[(chat_toggles & CHAT_GHOSTPDA) ? "All Messages" : "Nearest Creatures"]</a><br>"
dat += "<b>Pull requests:</b> <a href='?_src_=prefs;preference=pull_requests'>[(chat_toggles & CHAT_PULLR) ? "Yes" : "No"]</a><br>"
dat += "<b>Midround Antagonist:</b> <a href='?_src_=prefs;preference=allow_midround_antag'>[(toggles & MIDROUND_ANTAG) ? "Yes" : "No"]</a><br>"
dat += "<b>Hide uncraftable recipes:</b> <a href='?_src_=prefs;preference=hide_recipes'>[(toggles & HIDE_RECIPES) ? "Yes" : "No"]</a><br>"
if(config.allow_Metadata)
dat += "<b>OOC Notes:</b> <a href='?_src_=prefs;preference=metadata;task=input'>Edit </a><br>"
@@ -1125,9 +1123,6 @@ var/list/preferences_datums = list()
if("allow_midround_antag")
toggles ^= MIDROUND_ANTAG
if("hide_recipes")
toggles ^= HIDE_RECIPES
if("save")
save_preferences()
save_character()
@@ -115,15 +115,6 @@
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"
+14 -17
View File
@@ -15,27 +15,24 @@
/obj/structure/table/proc/check_contents(datum/table_recipe/R)
check_table()
var/has_components = 0
main_loop:
for(var/A in R.reqs)
var/stillneed = R.reqs[A]
var/needed_amount = R.reqs[A]
for(var/B in table_contents)
if(ispath(B, A))
if(table_contents[B] >= R.reqs[A])
has_components = 1
continue main_loop
else
stillneed -= table_contents[B]
has_components = 1
if(stillneed <= 0)
needed_amount -= table_contents[B]
if(needed_amount <= 0)
continue main_loop
if(has_components)
return has_components
else
continue
return 0
for(var/A in R.chem_catalysts)
if(table_contents[A] < R.chem_catalysts[A])
return has_components
return -1
return 0
return 1
/obj/structure/table/proc/check_table()
table_contents = list()
@@ -74,10 +71,10 @@
/obj/structure/table/proc/construct_item(mob/user, datum/table_recipe/R)
check_table()
var/send_feedback = 1
if(check_contents(R) < 0)
if(check_contents(R))
if(check_tools(user, R))
if(do_after(user, R.time, target = src))
if(!check_contents(R) < 0)
if(!check_contents(R))
return ", missing component."
if(!check_tools(user, R))
return ", missing tool."
@@ -206,10 +203,9 @@
for(var/datum/table_recipe/R in table_recipes)
if(R.category != categories[viewing_category])
continue
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)
if(check_contents(R))
can_craft += R
else if(matched_contents && !(user.client.prefs.toggles & HIDE_RECIPES && !matched_contents))
else
cant_craft += R
for(var/datum/table_recipe/R in can_craft)
@@ -267,8 +263,9 @@
var/req_text = ""
var/tool_text = ""
var/catalist_text = ""
if(check_contents(R) < 0)
if(check_contents(R))
name_text ="<A href='?src=\ref[src];make=\ref[R]'>[R.name]</A>"
else
name_text = "<span class='linkOff'>[R.name]</span>"
@@ -180,7 +180,7 @@
/datum/table_recipe/spellburger
name = "Spell burger"
reqs = list(
/obj/item/clothing/head/wizard/fake = 1,
/obj/item/clothing/head/wizard/fake,
)
result = /obj/item/weapon/reagent_containers/food/snacks/burger/spell
category = CAT_FOOD