HasRequiredIngredients() public static method

public static HasRequiredIngredients ( Recipe recipe, Sim sim ) : bool
recipe Recipe
sim Sim
return bool
コード例 #1
0
ファイル: AniMicro.cs プロジェクト: yakoder/NRaas
 public override bool Run()
 {
     Microwave_Have.Definition definition = base.InteractionDefinition as Microwave_Have.Definition;
     if (definition.ChosenRecipe.RecipeClassName == "MicrowaveOnlyMeal")
     {
         if (!AniRecipe.HasRequiredIngredients(definition.ChosenRecipe, Actor))
         {
             return(false);
         }
         return(Microwave.CreateRecipeObjectAndPutInMicrowave(Actor, Target, definition.ChosenRecipe, null, null, Target, definition.Destination, definition.Quantity, definition.Repetition, false, 0));
     }
     return(AniRecipe.ForcePushFridgeHave(Actor, Target, definition.ChosenRecipe, definition.Destination, definition.Quantity, definition.Repetition));
 }
コード例 #2
0
ファイル: AniGrill.cs プロジェクト: yakoder/NRaas
 /*private new bool StartCookingProcessWithFoodTray(string menuText, string[] menuPath, Recipe.MealDestination destination, Recipe.MealQuantity quantity, Recipe.MealRepetition repetition)
  * {
  *  List<Ingredient> ingredientsUsed = new List<Ingredient>();
  *  if (!Actor.IsNPC && !AniRecipe.UseUpIngredientsFrom(ChosenRecipe, Actor, ref ingredientsUsed, quantity, false))
  *  {
  *      return false;
  *  }
  *  Actor.SkillManager.AddElement(SkillNames.Cooking);
  *  FoodTray foodTray = (FoodTray)GlobalFunctions.CreateObject("FoodTray", Vector3.OutOfWorld, 0, Vector3.UnitZ);
  *  foodTray.CookingProcess = new CookingProcess(ChosenRecipe, ingredientsUsed, Target, Target.LotCurrent, destination, quantity, repetition, menuText, menuPath, foodTray, Actor);
  *  foodTray.CreateFoodProp(Slots.Hash("Slot_0"), foodTray.CookingProcess.Recipe.ModelsAndMaterials.GrillModel_FoodTray);
  *  CookingProcess.MoveToNextStep(foodTray, Actor);
  *  CookingProcess.MoveToNextStep(foodTray, Actor);
  *  CookingProcess.MoveToNextStep(foodTray, Actor);
  *  StateMachineClient stateMachineClient = StateMachineClient.Acquire(Actor.Proxy.ObjectId, "Grill");
  *  if (stateMachineClient == null)
  *  {
  *      return false;
  *  }
  *  stateMachineClient.AddInterest<TraitNames>(TraitNames.Clumsy);
  *  stateMachineClient.SetActor("x", Actor);
  *  stateMachineClient.SetActor("FoodTray", foodTray);
  *  stateMachineClient.EnterState("x", "Enter - Hands Empty");
  *  stateMachineClient.RequestState("x", "Take Out Food Tray");
  *  stateMachineClient.RequestState("x", "Exit - Holding Food Tray");
  *  if (Actor.HasExitReason(ExitReason.Canceled))
  *  {
  *      CarrySystem.EnterWhileHolding(Actor, foodTray);
  *      Food.PutHeldObjectDownOnCounterTableOrFloor(Actor, SurfaceType.Normal);
  *      return false;
  *  }
  *  CarrySystem.EnterWhileHolding(Actor, foodTray);
  *  InteractionInstance instance =  FoodTray_Prepare.Singleton.CreateInstance(foodTray, Actor, Actor.InheritedPriority(), base.Autonomous, true);
  *  return Actor.InteractionQueue.PushAsContinuation(instance, true);
  * }
  * public override void Init(ref InteractionInstanceParameters parameters)
  * {
  *  base.Init(ref parameters);
  *  OverridedGrill_Have.Definition definition = base.InteractionDefinition as OverridedGrill_Have.Definition;
  *  if (definition.ChosenRecipe == null)
  *  {
  *      ChosenRecipe = RandomUtil.GetRandomObjectFromList<Recipe>(new List<Recipe>
  *                      {
  *                              Recipe.NameToRecipeHash["HotDog"],
  *                              Recipe.NameToRecipeHash["Hamburger"],
  *                              Recipe.NameToRecipeHash["Cheesesteak"],
  *                              Recipe.NameToRecipeHash["GrilledSalmon"],
  *                              Recipe.NameToRecipeHash["TriTipSteak"]
  *                      });
  *      return;
  *  }
  *  ChosenRecipe = definition.ChosenRecipe;
  * }
  * public override bool OnLoadFixup()
  * {
  *  return ChosenRecipe != null && ChosenRecipe.OnLoadFixup() && base.OnLoadFixup();
  * }*/
 public override bool Run()
 {
     Grill_Have.Definition definition = base.InteractionDefinition as Grill_Have.Definition;
     if (Target.LotCurrent.IsCommunityLot)
     {
         if (!AniRecipe.HasRequiredIngredients(ChosenRecipe, Actor))
         {
             return(false);
         }
         return(StartCookingProcessWithFoodTray(null, null, definition.Destination, Recipe.MealQuantity.Group, definition.Repetition));
     }
     return(AniRecipe.ForcePushFridgeHave(Actor, Target, ChosenRecipe, definition.Destination, Recipe.MealQuantity.Group, definition.Repetition));
 }