Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed repeating categories in the crafting menu and sorted all the recipes #11272

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 28 additions & 19 deletions beestation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#include "code\__DEFINES\construction.dm"
#include "code\__DEFINES\contracts.dm"
#include "code\__DEFINES\cooldowns.dm"
#include "code\__DEFINES\crafting.dm"
#include "code\__DEFINES\cult.dm"
#include "code\__DEFINES\database.dm"
#include "code\__DEFINES\departments.dm"
Expand Down Expand Up @@ -719,10 +720,35 @@
#include "code\datums\components\waddling.dm"
#include "code\datums\components\wearertargeting.dm"
#include "code\datums\components\wet_floor.dm"
#include "code\datums\components\crafting\_recipes.dm"
#include "code\datums\components\crafting\crafting.dm"
#include "code\datums\components\crafting\guncrafting.dm"
#include "code\datums\components\crafting\recipes.dm"
#include "code\datums\components\crafting\tailoring.dm"
#include "code\datums\components\crafting\crafting_lists\drinks.dm"
#include "code\datums\components\crafting\crafting_lists\misc.dm"
#include "code\datums\components\crafting\crafting_lists\primal.dm"
#include "code\datums\components\crafting\crafting_lists\robots.dm"
#include "code\datums\components\crafting\crafting_lists\structures.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\_recipes.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_bread.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_burger.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_cake.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_egg.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_frozen.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_meat.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_mexican.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_misc.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_pastry.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_pie.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_pizza.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_salad.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_sandwich.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_seafood.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_soup.dm"
#include "code\datums\components\crafting\crafting_lists\foodstuffs\recipes_spaghetti.dm"
#include "code\datums\components\crafting\crafting_lists\tailoring\clothing.dm"
#include "code\datums\components\crafting\crafting_lists\tailoring\eyewear.dm"
#include "code\datums\components\crafting\crafting_lists\weaponry\ammunitions.dm"
#include "code\datums\components\crafting\crafting_lists\weaponry\weapons.dm"
#include "code\datums\components\food\edible.dm"
#include "code\datums\components\food\food_storage.dm"
#include "code\datums\components\plumbing\_plumbing.dm"
Expand Down Expand Up @@ -2681,23 +2707,6 @@
#include "code\modules\food_and_drinks\recipes\drinks_recipes.dm"
#include "code\modules\food_and_drinks\recipes\food_mixtures.dm"
#include "code\modules\food_and_drinks\recipes\processor_recipes.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_bread.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_burger.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_cake.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_drink.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_egg.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_frozen.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_meat.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_mexican.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_misc.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_pastry.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_pie.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_pizza.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_salad.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_sandwich.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_seafood.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_soup.dm"
#include "code\modules\food_and_drinks\recipes\tablecraft\recipes_spaghetti.dm"
#include "code\modules\games\cas.dm"
#include "code\modules\games\tarot.dm"
#include "code\modules\games\unum.dm"
Expand Down
50 changes: 10 additions & 40 deletions code/__DEFINES/construction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,46 +77,16 @@
/// maximum amount of cable in a coil
#define MAXCOIL 30

// tablecrafting defines
#define CAT_NONE ""
#define CAT_WEAPONRY "Weaponry"
#define CAT_WEAPON "Weapons"
#define CAT_AMMO "Ammunition"
#define CAT_ROBOT "Robots"
#define CAT_MISC "Misc"
#define CAT_PRIMAL "Tribal"
#define CAT_CLOTHING "Clothing"
#define CAT_EYEWEAR "Eyewear"
#define CAT_FOOD "Foods"
#define CAT_BREAD "Breads"
#define CAT_BURGER "Burgers"
#define CAT_CAKE "Cakes"
#define CAT_EGG "Egg-Based Food"
#define CAT_MEAT "Meats"
#define CAT_MISCFOOD "Misc. Food"
#define CAT_MEXICAN "Mexican Food"
#define CAT_PASTRY "Pastries"
#define CAT_PIE "Pies"
#define CAT_PIZZA "Pizzas"
#define CAT_SALAD "Salads"
#define CAT_SANDWICH "Sandwiches"
#define CAT_SEAFOOD "Seafood"
#define CAT_SOUP "Soups"
#define CAT_SPAGHETTI "Spaghettis"
#define CAT_ICE "Frozen"
#define CAT_DRINK "Drinks"
#define CAT_STRUCTURE "Structures"


//rcd modes
#define RCD_FLOORWALL 0
#define RCD_AIRLOCK 1
#define RCD_DECONSTRUCT 2
#define RCD_WINDOWGRILLE 3
#define RCD_MACHINE 4
#define RCD_COMPUTER 5
#define RCD_FURNISHING 6
#define RCD_LADDER 7
// rcd buildtype defines
// these aren't even used as bitflags so who even knows why they are treated like them
#define RCD_FLOORWALL (1<<0)
#define RCD_AIRLOCK (1<<1)
#define RCD_DECONSTRUCT (1<<2)
#define RCD_WINDOWGRILLE (1<<3)
#define RCD_MACHINE (1<<4)
#define RCD_COMPUTER (1<<5)
#define RCD_FURNISHING (1<<6)
#define RCD_LADDER (1<<7)

#define RCD_UPGRADE_FRAMES 0
#define RCD_UPGRADE_SIMPLE_CIRCUITS 1
Expand Down
32 changes: 32 additions & 0 deletions code/__DEFINES/crafting.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// tablecrafting defines
#define CAT_NONE ""
#define CAT_WEAPONRY "Weaponry"
#define CAT_WEAPON "Weapons"
#define CAT_AMMO "Ammunition"
#define CAT_ROBOT "Robots"
#define CAT_MISC "Misc"
#define CAT_PRIMAL "Primal"
#define CAT_TAILORING "tailoring"
#define CAT_CLOTHING "Clothing"
#define CAT_EYEWEAR "Eyewear"
#define CAT_STRUCTURE "Structures"

// foodstuffs & drinks
#define CAT_FOOD "Foods"
#define CAT_BREAD "Breads"
#define CAT_BURGER "Burgers"
#define CAT_CAKE "Cakes"
#define CAT_EGG "Egg-Based Food"
#define CAT_MEAT "Meats"
#define CAT_MISCFOOD "Misc. Food"
#define CAT_MEXICAN "Mexican Food"
#define CAT_PASTRY "Pastries"
#define CAT_PIE "Pies"
#define CAT_PIZZA "Pizzas"
#define CAT_SALAD "Salads"
#define CAT_SEAFOOD "Seafood"
#define CAT_SANDWICH "Sandwiches"
#define CAT_SOUP "Soups"
#define CAT_SPAGHETTI "Spaghettis"
#define CAT_ICE "Frozen"
#define CAT_DRINK "Drinks"
2 changes: 1 addition & 1 deletion code/__DEFINES/time.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ When using time2text(), please use "DDD" to find the weekday. Refrain from using
*/

#define MONDAY "Mon"
#define TUESDAY "Tue"
#define TUESDAY "Tue"
#define WEDNESDAY "Wed"
#define THURSDAY "Thu"
#define FRIDAY "Fri"
Expand Down
40 changes: 40 additions & 0 deletions code/datums/components/crafting/_recipes.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

/datum/crafting_recipe
///in-game display name - Optional, if not set uses result name
var/name = ""
///type paths of items consumed associated with how many are needed
var/list/reqs[] = list()
//type paths of items explicitly not allowed as an ingredient
var/list/blacklist[] = list()
//type path of item resulting from this craft
var/result
//type paths of items needed but not consumed
var/list/tools[] = list()
//time in Seconds
var/time = 3 SECONDS
//type paths of items that will be placed in the result
var/list/parts[] = list()
//type paths of reagents that will be placed in the result
var/list/chem_catalysts[] = list()
//where it shows up in the crafting UI, as well it's subcategory
var/category = CAT_NONE
var/subcategory = CAT_NONE
//Set to FALSE if it needs to be learned first.
var/always_available = TRUE
///Should only one object exist on the same turf?
var/one_per_turf = FALSE
/// Should admins be notified about this getting created by a non-antagonist?
var/dangerous_craft = FALSE

/datum/crafting_recipe/New()
if(!(result in reqs))
blacklist += result

/**
* Run custom pre-craft checks for this recipe
*
* user: the /mob that initiated the crafting
* collected_requirements: A list of lists of /obj/item instances that satisfy reqs. Top level list is keyed by requirement path.
*/
/datum/crafting_recipe/proc/check_requirements(mob/user, list/collected_requirements)
return TRUE
19 changes: 11 additions & 8 deletions code/datums/components/crafting/crafting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
RegisterSignal(parent, COMSIG_MOB_CLIENT_LOGIN, PROC_REF(create_mob_button))

/datum/component/personal_crafting/proc/create_mob_button(mob/user, client/CL)
SIGNAL_HANDLER
var/datum/hud/H = user.hud_used
var/atom/movable/screen/craft/C = new()
C.icon = H.ui_style
Expand All @@ -12,16 +13,15 @@

/datum/component/personal_crafting
var/busy
var/viewing_category = 1 //typical powergamer starting on the Weapons tab
var/viewing_subcategory = 1
var/list/categories = list(
CAT_WEAPONRY = list(
CAT_WEAPON,
CAT_AMMO,
),
CAT_ROBOT = CAT_NONE,
CAT_MISC = CAT_NONE,
CAT_PRIMAL = CAT_NONE,
CAT_TAILORING = list(
CAT_CLOTHING,
CAT_EYEWEAR,
),
CAT_FOOD = list(
CAT_BREAD,
CAT_BURGER,
Expand All @@ -38,16 +38,19 @@
CAT_SEAFOOD,
CAT_SOUP,
CAT_SPAGHETTI,
CAT_MEXICAN,
),
CAT_ROBOT = CAT_NONE,
CAT_MISC = CAT_NONE,
CAT_PRIMAL = CAT_NONE,
CAT_STRUCTURE = CAT_NONE,
CAT_DRINK = CAT_NONE,
CAT_CLOTHING = CAT_NONE,
)

var/cur_category = CAT_NONE
var/cur_subcategory = CAT_NONE
var/datum/action/innate/crafting/button
var/display_craftable_only = FALSE
var/display_compact = TRUE
var/datum/action/innate/crafting/button

/* This is what procs do:
get_environment - gets a list of things accessable for crafting by user
Expand Down
Loading
Loading