예제 #1
0
파일: AniFridge.cs 프로젝트: yakoder/NRaas
        public override void Initialize(ref InteractionInstanceParameters parameters)
        {
            Fridge_Have.Definition definition = parameters.InteractionDefinition as Fridge_Have.Definition;
            if (definition.ChosenRecipe != null || Actor.IsNPC)
            {
                base.Initialize(ref parameters);
                return;
            }
            Lot lotCurrent = Actor.LotCurrent;

            if (lotCurrent.GetSims(new Predicate <Sim>(ShouldCookFor)).Count > 1)
            {
                Quantity = Recipe.MealQuantity.Group;
            }
            ChosenRecipe = ChooseRecipeRandomly(lotCurrent, Actor, Quantity, false);
            if (ChosenRecipe != null)
            {
                if (!ChosenRecipe.CanMakeSingleServing)
                {
                    Quantity = Recipe.MealQuantity.Group;
                }
                if (!ChosenRecipe.CanMakeGroupServing)
                {
                    Quantity = Recipe.MealQuantity.Single;
                }
                ObjectClickedOn = Target;
            }
        }
예제 #2
0
파일: AniFridge.cs 프로젝트: yakoder/NRaas
            public override void AddInteractions(InteractionObjectPair iop, Sim sim, Fridge fridge, List <InteractionObjectPair> results)
            {
                /*if (sim == null)
                 * {
                 *  return;
                 * }
                 *
                 * bool lotHasCounter = Food.LotHasUsableCounter(fridge.LotCurrent);
                 * bool lotHasStove = Food.LotHasUsableStove(fridge.LotCurrent);
                 * bool lotHasMicrowave = Food.LotHasUsableMicrowave(fridge.LotCurrent);
                 * bool lotHasGrill = Food.LotHasUsableGrill(fridge.LotCurrent);
                 * Lot lotCurrent = fridge.LotCurrent;
                 * if (lotCurrent == sim.LotHome || (lotCurrent.IsResidentialLot && sim.Household.IsGreetedOnLot(lotCurrent, ObjectGuid.InvalidObjectGuid)))
                 * {
                 *  base.AddFoodPrepInteractions(iop, sim, results, null);
                 * }
                 * Food.StringIndices stringIndex;
                 * if (sim.HasTrait(TraitNames.PartyAnimal) && Party.IsInvolvedInAnyTypeOfParty(sim))
                 * {
                 *  stringIndex = Food.StringIndices.PartySnack;
                 * }
                 * else
                 * {
                 *  if (sim.HasTrait(TraitNames.Evil))
                 *  {
                 *      stringIndex = Food.StringIndices.EvilSnack;
                 *  }
                 *  else
                 *  {
                 *      if (sim.HasTrait(TraitNames.EnvironmentallyConscious))
                 *      {
                 *          stringIndex = Food.StringIndices.OrganicSnack;
                 *      }
                 *      else
                 *      {
                 *          if (sim.HasTrait(TraitNames.Good))
                 *          {
                 *              stringIndex = Food.StringIndices.GoodSnack;
                 *          }
                 *          else
                 *          {
                 *              if (sim.TraitManager.HasElement(TraitNames.Mooch) && lotCurrent != sim.LotHome)
                 *              {
                 *                  stringIndex = Food.StringIndices.MoochSnack;
                 *              }
                 *              else
                 *              {
                 *                  stringIndex = Food.StringIndices.HaveSnack;
                 *              }
                 *          }
                 *      }
                 *  }
                 * }
                 * string[] menuPath = new string[]
                 *              {
                 *                      Food.GetString(stringIndex) + Localization.Ellipsis
                 *              };
                 *
                 * foreach (Recipe current in Recipe.Snacks)
                 * {
                 *  if ((!current.CookingProcessData.UsesAMicrowave || !sim.SimDescription.ChildOrBelow) && (!(current.Key == "VampireJuice") || sim.SimDescription.IsVampire) && current.DoesLotHaveRightTech(lotHasCounter, lotHasStove, lotHasMicrowave, lotHasGrill, Recipe.MealQuantity.Single) == Recipe.CanMakeFoodTestResult.Pass)
                 *  {
                 *      InteractionObjectPair item = new InteractionObjectPair(Create(current.GenericName, current, menuPath, null, Recipe.MealDestination.SurfaceOrEat, Recipe.MealQuantity.Single, Recipe.MealRepetition.MakeOne, false, 0), iop.Target);
                 *      results.Add(item);
                 *  }
                 * }*/
                base.AddInteractions(iop, sim, fridge, results);
                List <Ingredient> simIngredients = Recipe.GetCookableIngredients(sim.Inventory);
                List <Ingredient> lotIngredients = sim.Household != null && sim.Household.SharedFridgeInventory != null?Recipe.GetCookableIngredients(sim.Household.SharedFridgeInventory.Inventory) : new List <Ingredient>();

                List <Ingredient> list = null;

                for (int i = results.Count - 1; i >= 0; i--)
                {
                    Fridge_Have.Definition definition = results[i].InteractionDefinition as Fridge_Have.Definition;
                    if (definition == null || definition.ChosenRecipe == null || !definition.ChosenRecipe.IsSnack)
                    {
                        return;
                    }
                    if (definition.ChosenRecipe.BuildIngredientList(simIngredients, lotIngredients, ref list, ref list).Count > 0)
                    {
                        definition.Cost = -2147483648;
                    }
                }
            }