25 April 2017 Update : Uploaded the right file!23 April 2017 Update : A few bugfixes and changes. See Changelog at the bottom.

Mod Info & Requirements

Game version 1.67 (might work with other patch levels, beats me)

This mod is integrated with Japanese Low Dinner Table, a version updated on 21th June 2016 or later.
This is NOT a requirement, it means that the two mods can get along nicely
(DashBoard will report a conflict but that is intentional).

This mod includes only a script, so it requires third party objects to apply the script to (more info and examples later)

Description

This is a script that can be applied to an object to turn it into a generic food maker.
Using Buy/Build mode interactions you can configure what kind of food can be made
(or bought, depending on the configuration and on your own interpretation) with the object.

In addition to regular food (recipes), the mod also supports morsels (aka driedfood),
beverages (objects implementing the IGlass interface) and also generic objects
(as long as they can go in a Sim's inventory). Sims won't buy generic objects autonomously!

Important: the last 3 categories all need an NGMP entry that associates a name to a specific object (more on that later).

NOTE: To keep it simple (otherwise in addition to the NGMP name in string format you
should also specify a ProductVersion), the mod only supports morsels, beverages and objects whose
OBJD resource has 0 (0x00000000) as GroupID which corresponds to ProductVersion.BaseGame.
This should not be a big limitation because the mod is mainly aimed to CC resources and anyway
you can simply extract to a new package the OBJD (and eventually the OBJK remembering to update
its reference in the OBJD) of an EP related object, and then renumbering the GroupID to 0 and the
InstanceID using an unique hashing key - the way I did for the hot and cold cup from Seasons to
make the custom beverage version of them.

I realize that this could be a mod a bit hard to understand and use, so in the next section I'll make a few examples.

More Info and Examples of use

See the first comments for a few concrete examples with override packages already done
(so you don't have to edit the original objects yourself, and if you do then remember to not
redistribute them if that violates the policy of the author).

Let's say you want to make a beverages vending machine (due to routing's issues,
I strongly suggest to only use counter appliances objects instead of standalone objects
like the vending machine used in this example).

Open the package with S3PE and right click on the OBJK resource to edit it.
Use my script : Sims3.Gameplay.Objects.Arsil.GenericFoodMaker
Make sure to commit and save your changes.

Now start the game, place the object and use the Buy/Build mode interactions
(CTRL+SHIFT click on the object and use the [Settings] sub pie menu) to configure it.
At the very least you have to:
- make sure to set that this is a standalone object (as opposed to a counter appliance)
- Use "Set Recipes" and add at least one recipe using the dialog window

Note: if you use the icecream cone, Sims will eat it using a spoon. Not a good show to watch.

-----

Now, let's say you want an object that creates a morsel.

It doesn't matter what "food maker" you use, I want to make a real example to show how
to add an NGMP resource for an existing CC food (not a recipe!).
There are many of those, ATS3 has loads of them, so let's use one of her items again
for this example: http://aroundthesims3.com/objects/f...n_food_01.shtml
I'll use the very first item on that page: the croissant.

Note: I only use .package files, but you only need to convert the CC to know the InstanceID
of the OBJD resource (you can also get it in game using NRaas DebugEnabler).

So, I convert the Sims3pack to package (with Lepid Llama unpacker) and open it with S3PE.
I copy to the clipboard (or in a temp text document) the InstanceID of the OBJD (0x0B9579...)

Now let's use S3PE to calculate the fnv64 hashing of the unique string we'll use as "name" of the object.
A good example for a name is ATS3_edible_croissant, so we use S3PE's Tools -> FNV Hash...,
we put ATS3_edible_croissant as "text to hash" and click on "calculate" then we copy to the clipboard
(or in a temp text document) the code (0x7441...).

Now, in the same package of the object or in a new one made for this purpose (especially if you
want to keep the CC in Sims3pack format), you can add a new NGMP resource. With S3PE you:
- click on the "Resource" voice in the menu and then choose "Add..."
- set NGMP as type (click "N" to avoid scrolling) and 0 as group
- put a unique name for the resource (e.g. ATS3_croissant_NGMP)
- tick the "Use resource name" and click the "FNV64" button
- click the "OK" button
- Now select the newly created resource and then click the "Grid" button (on the bottom of S3PE interface)
- select the "Data" row and then click on "..." on the right
- click on the "Add" button on the bottom
- in the NameHash field put the fnv64 hashing of the unique string we calculated earlier (0x744...)
- in the Instance field paste the InstanceID of the OBJD that we copied earlier (0x0B9579...)
- click on the OK button and then on the Commit button
- save the package

Now, in game, you can use AT3_edible_croissant as morsel name with the "Set morsels" configuring
interaction. [21th June 2016 UPDATE] The interaction will use the catalog name of the object, so make
sure that it is "pleasant to read" checking the STBL (seeing "Arsil's custom food #4" would be bad, right?).

Note: to keep it simple, this will only work for objects (OBJDs) with 0 (0x00000000) as GroupID.
On the other hand, if a creator makes a CC food using a different GroupID then I'd say it's their fault.

Note: you don't need an NGMP resource for each item, you need an entry in a NGMP,
so you can use the same resource for associating more name-InstanceId couples.

At first this was supposed to be the script for a rice cooker, but I noticed it could be easily
turned into something generic.

Ingredients required by recipes are completely ignored.
Handling them and setting the price accordingly should not be too hard, but I'm not familiar
with it (gameplay- nor code-wise) and IIRC there are mods that change how ingredients work,
so that would require quite some work and research that ATM I don't feel like doing.

There's no skill gaining creating foods with this mod (due to the generic nature of the mod).
I guess I could add that too, making it optional for every food maker, but see previous paragraph.

The cost of the food, even in residential lots, is based on the register cost of the recipe
(the VenueCost field in the recipe xml definition - see RecipeMasterList in GameplayData.package).
The cost of morsels, beverages and objects is the cost of the object itself (as defined in the OBJD resource).

You have to configure each single food maker, so it can be a little tedious since there's no option to copy
the same settings of an existing one. I guess some kind of copy/paste mechanism could be implemented.

Autonomy: if Sims already have a morsel or beverage in their inventory, they can't make/buy new ones,
otherwise they would keep making/buying new ones instead of eating those they already have in their
inventory (because the former interaction is "more advertised" than the latter).

This mod is integrated with Japanese Low Dinner Table. If there's a free table and the food maker
is configured to use it, Sims will place the food (if it's a recipe) in the low dinner table.

If you set an object as a counter appliance, make sure you place it in a counter.
Due to routing's issues with standalone objects, I strongly suggest to only use counter appliances.

You can also specify an animation for the Sim to play that should represent making the food,
but of course you'll be limited to simple animations not involving the food maker.
Here are 2 examples that work for children too:
- a2o_object_genericSwipe_x
- a2o_door_ringbell_x
Of course the success (will they look good?) of the animations is dependant on the object used as food maker.

Additional Credits

All respective authors and contributors of the tools and tutorials for modding TS3.
MTS and all modders who made the game much more enjoyable.

Changelog (ordered from most recent to oldest changes)

25 April 2017 Update : Uploaded the right file!

23 April 2017 Update - List of changes:

It's now possible to make/buy any kind of object as long as it can go in a Sim's inventory,
using the Set Objects Buy/Build mode interaction. Example: the cigarette pack from cmomoney's
mod won't get Sims reset.

Fixed the related issue, so I've re-introduced the option to buy beverages also when using the
"Disable eating after making food" option. The beverages will now correctly go into the inventory.

Renamed option "Set as NO counter appliance" as "Set as standalone object", opposed to "Set as counter appliance",
hoping this will make things more clear.

Added ITUN for the MakeObject interaction, now toddlers and pets can no longer use it.
The interaction is not advertised, so Sims won't use it autonomously (and I'm ok with that,
for the reason I've already explained, see 9th July 2016 Update notes)

I tried to improve the routing on standalone objects, but I strongly suggest to use counter appliances.
In the former case, Sims won't shoo other Sims loithering in front of the object so the routing will fail.

Note: clicking on the "X" button in the dialog windows to specify items to make/sell, will reset that field.

BugFix: due to lack of checks (robust code for the win), a food maker could become unusable
(no interactions on the object) and the only workaround was to replace it with a new one.
Now that should not happen again. Note that my parsers are still very naive, so don't put a morsel
in place of a beverage for example.

13th July 2016 Update - Fixed the recipe name in the "serve" interaction.

9th July 2016 Update - there's a fair chance I've fu**ed up somewhere, so let me know if something doesn't work
You will probably have to get rid of existing foodMakers and buy new ones from
the catalog for some of the new features to take effect.

Added a modal dialog window to pick recipes, no more manual data entry.

Added support to beverages (they need an NGMP entry, like morsels), those from this mod are supported
but should work with any object that implements the IGlass interface (and that are carryable). Don't ask me a list.
NOTE: due to a bug I wasn't able to fix, I've had to disable beverages making/buying if the foodMaker has the option to
"Not eat after making food" (because beverages weren't added to the Sim's inventory for some reason)
Disable the option "Child can use" (or whatever is called) if you use super alcoholics.

Added support to generic* objects, so "someone" can buy my bag of chips (using ArsilBagOfChips as name) ^^
*This should support any object with an NGMP entry AND carryable AND that can go in a Sim's inventory.
Don't ask me what objects work with it because I don't know.
Of course there's no automatic eating (it may not be something edible) and Sims won't make/buy these objects autonomously
because I haven't thought of a satisfying way to regulate it (they might keep buying and buying non consumable items
filling their inventory with junk that slows the game)

26th June 2016 Update

Major BugFix: now Sims will use the interactions autonomously

Minor BugFix: corrected the text displayed by the "Set morsels" dialog window (before it mentioned recipes, now it mentions morsels)

New interaction to allow/disallow the "Serve" interaction on community lots (I can see some circumstances where it would be out ot place)

Added a check for not valid morsel names (like the check for recipes, it will only report the first invalid entry found)

Added a fixed footprint for the vending machine mentioned in the example (the attachment is in a comment)

23th June 2016 Update

Now the interaction to make/serve food displays the name of the recipe instead of the
Recipe_Key (I did a very similar fix for the morsels too).

I've removed an unnecessary check that prevented to use some recipes that you can't
get from a fridge (mostly snacks).

changed the valid routing cone from 120 to a 60 degree angle. Otherwise Sims would
(when starting from a lateral position) approach the non-counter-appliance object more
from its side than its front.

Key: - File was updated after upload was posted

Filename - Tip: You can click the magnifying glass to see the archive contents