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

[DRAFT - don't merge] - making CookingRecipe extensible #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Archina
Copy link

@Archina Archina commented Mar 30, 2021

This is my very first draft of changes, which I want to serve as a basis for feedback from modders and maintainers.

I tried to split the original Cooking Recipe into 4 classes to grow my own understanding of the routine and also to show how this could be used to register a set of different CookingRecipes with different logic sets that are identified through the code string.

At the moment CookingRecipe has to registered manually and this change would require to register the recipes under either essentials or survival as the following:

api.RegisterCookingRecipe("porridge", typeof(PorridgeCookingRecipe));
api.RegisterCookingRecipe("meatystew", typeof(StewCookingRecipe));
api.RegisterCookingRecipe("vegetablestew", typeof(StewCookingRecipe));
api.RegisterCookingRecipe("soup", typeof(SoupCookingRecipe));
api.RegisterCookingRecipe("jam", typeof(JamCookingRecipe));

Sadly I have troubles compiling and trying to run this on my machine, I have however worked under the following assumptions:

RegisterCookingRecipe registers the class so that worldForResolve.CookingRecipes can retrieve the matching class.


Current concerns:

  • Too much messy inheritance stuff.
  • I would prefer separating the CookingRecipe logic altogether from the CookingRecipe class by maybe introducing a CookingRecipeLogic - I have not done so because I wanted to keep the changes low and because I would then also have to rewrite RegisterCookingRecipe.
  • I removed the interface ICookingRecipeNamingHelper that didn't seem necessary any longer, this may however be false or collide with other changes that are made to the game.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant