- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- MilkTypes (Cow Pasture Store) objects IDs - can anyone help me with understanding?
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- MilkTypes (Cow Pasture Store) objects IDs - can anyone help me with understanding?
Replies: 5 (Who?), Viewed: 3828 times.
#1
23rd Apr 2017 at 4:58 PM
Posts: 40
Thanks: 2754 in 3 Posts
MilkTypes (Cow Pasture Store) objects IDs - can anyone help me with understanding?
I wanted to find out if the milk types from the CowPasture could be made available in any other way. After looking into every file and into the script (I just can grasp the main functions of scripts but am in no way a scripter myself) I stumbled on something I do not understand:The main object is the accessory.milkbottle, which can be made buyable and placeable easily and then acts as white milk.
Assigning the special milk types is done in the script - so no way for an ITUN and XML modder like me.
There are lots of different material informations in the package seemingly related to different geostates (I hope I am using the right terminolgy).
But:
In game I can get information on the different milk types with Debug Enabler and I DO get different Object IDs although the resource is always the same (pointing to the accessory.milkbottle again). These individual objects even have foreign language strings hidden somewhere.
I also can clone the milk types in game and although doing that their optics are reverted to a base object (not the accessory.milkbottle but an empty glass) they still are useable by the sims and work as the special milk types.
Although I have now read some tutorials on object modding and materials I am not really deep enough into that matter to grasp much about it. And most probably I am just too naive and any good scripter or object modder will think my enterprise futile from the beginning and laugh at me ...
I did some really stupid tests like assigning nmgp names and hashes to these Object IDs to test what I get in game - at the grocery store f.i. it was a buyable but priceless, invisible and nonfunctional object, but at least it did not crash my game and could be deleted from the inventory of my test sim using a cheat.
But I really would like to get an explanation where these mysterious Object IDs do come from an how they are linked to the base object as well as to the specific milk types.
Even if I will not achieve my original goal I might at least learn a little bit more about how these things are connected.
So perhaps someone knowledgeable who has a little bit of time to spare can help me with finding an answer?
One flap of a butterfly´s wing could change the course of weather forever (chaos theory)
Advertisement
#2
24th Apr 2017 at 6:41 PM
Posts: 3,856
Thanks: 8449 in 67 Posts
Helloes
I have been looking around in the store objects.DLL thingy (cuz I don't have the store item myself) though sadly I couldn't find it. However, I've come across a few scripts which I thought only had one objects (And we're talking about accessory meshes, like... well a glass of water! :D) But it seems like the game basically 'breaks' those meshes and replaces them with different ones. I guess you could see them as 'geostates'. Not sure if you're familiar with those? if not, remember how bookcases will look emptier the more books you take away from it? Those are geostates. The game switches to a different mesh due to certain situations and this miiight be the reasson why? But if you could leave the code under a spoiler, that would be awesome! so i can take a look at it, only if you want me to of course
I have been looking around in the store objects.DLL thingy (cuz I don't have the store item myself) though sadly I couldn't find it. However, I've come across a few scripts which I thought only had one objects (And we're talking about accessory meshes, like... well a glass of water! :D) But it seems like the game basically 'breaks' those meshes and replaces them with different ones. I guess you could see them as 'geostates'. Not sure if you're familiar with those? if not, remember how bookcases will look emptier the more books you take away from it? Those are geostates. The game switches to a different mesh due to certain situations and this miiight be the reasson why? But if you could leave the code under a spoiler, that would be awesome! so i can take a look at it, only if you want me to of course
#3
24th Apr 2017 at 8:13 PM
Posts: 40
Thanks: 2754 in 3 Posts
Quote: Originally posted by Greenplumbbob
But if you could leave the code under a spoiler, that would be awesome! so i can take a look at it, only if you want me to of course |
This would be a great favour!
I am just not sure which code you mean - the script? Because there is so much about material and states in the package too.
By the way the Cowpasture is one of the store items I could not locate files of anywhere in any games folder (like the teatimeset). When I try to mod store stuff of that kind I always have to decrap the original pack to get a look at it.
Just to start with here is the script (done with ILSpy)
I have copied everything although only some parts refer to the milktypes - I have mainly looked into Cowpasture.Milk, Cowpasture.MilkDrinkInfo and Cowpasture.MilkType
// I:\Die Sims 3\000 WIP_Spätere Korrekturen für Upload 02 und NoUpload\02 WIP Cowpen\CowpenOriginal\StoreObjectsCowPasture.dll
// StoreObjectsCowPasture, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// Global type: <Module>
// Architecture: AnyCPU (64-bit preferred)
// Runtime: .NET 2.0
using Sims3.SimIFace;
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: Tunable]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("EA.com")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCopyright("Copyright © EA.com 2007-2010")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyProduct("Sims3StoreCowPasture")]
[assembly: AssemblyTitle("Sims3StoreCowPasture")]
[assembly: AssemblyTrademark("")]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: ComVisible(false)]
[assembly: Guid("BC0797E2-CAEC-A5DD-B6CD-E6807E701CD3")]
// Sims3GameplaySystems, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// Sims3GameplayObjects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// SimIFace, Version=1.0.0.50, Culture=neutral, PublicKeyToken=null
// UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
using Sims3.Gameplay.Abstracts;
using Sims3.Gameplay.Actors;
using Sims3.Gameplay.ActorSystems;
using Sims3.Gameplay.Autonomy;
using Sims3.Gameplay.Core;
using Sims3.Gameplay.Interactions;
using Sims3.Gameplay.Interfaces;
using Sims3.Gameplay.ObjectComponents;
using Sims3.Gameplay.Objects;
using Sims3.Gameplay.Objects.CookingObjects;
using Sims3.Gameplay.Objects.FoodObjects;
using Sims3.Gameplay.Objects.Gardening;
using Sims3.Gameplay.Skills;
using Sims3.Gameplay.UI;
using Sims3.Gameplay.Utilities;
using Sims3.SimIFace;
using Sims3.SimIFace.CustomContent;
using Sims3.SimIFace.Enums;
using Sims3.UI;
using System;
using System.Collections.Generic;
namespace Sims3.Store.Objects
{
[RuntimeExport]
public class CowPasture : GameObject
{
public enum MilkType
{
White,
Chocolate,
Soy,
Shake,
ChocolateShake
}
public class MilkDrinkInfo
{
public CowPasture.MilkType mType;
public string mName;
public string mGeometryFullName;
public string mGeometryEmptyName;
public string mMaterialName;
public ProductVersion mPV;
public MilkDrinkInfo(CowPasture.MilkType type, string name, string geoFullName, string geoEmptyName, string materialName, ProductVersion pv)
{
this.mType = type;
this.mName = CowPasture.LocalizeString(false, name, new object[0]);
this.mGeometryFullName = geoFullName;
this.mGeometryEmptyName = geoEmptyName;
this.mMaterialName = materialName;
this.mPV = pv;
}
}
private sealed class PastureInteractions : Interaction<Sim, CowPasture>
{
[DoesntRequireTuning]
private sealed class Definition : InteractionDefinition<Sim, CowPasture, CowPasture.PastureInteractions>
{
protected override bool Test(Sim a, CowPasture target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
return false;
}
protected override void AddInteractions(InteractionObjectPair iop, Sim actor, CowPasture target, List<InteractionObjectPair> results)
{
if (target.mCow != null)
{
InteractionObjectPair iop2 = new InteractionObjectPair(this, target.mCow);
CowPasture.Cow.MilkCow.Singleton.AddInteractions(iop2, actor, results);
CowPasture.Cow.FeedCow.Singleton.AddInteractions(iop2, actor, results);
results.Add(new InteractionObjectPair(CowPasture.Cow.TipCow.Singleton, target.mCow));
results.Add(new InteractionObjectPair(CowPasture.Cow.TicTacCow.Singleton, target.mCow));
}
}
}
public static readonly InteractionDefinition Singleton = new CowPasture.PastureInteractions.Definition();
}
[RuntimeExport]
public class Cow : GameObject
{
public sealed class MilkCow : Interaction<Sim, CowPasture.Cow>
{
private sealed class Definition : InteractionDefinition<Sim, CowPasture.Cow, CowPasture.Cow.MilkCow>
{
public CowPasture.MilkType mMilkType;
private string[] mPath = new string[]
{
string.Empty
};
public Definition()
{
}
public Definition(CowPasture.MilkType mMilkType, string[] mPath)
{
this.mMilkType = mMilkType;
this.mPath = mPath;
}
protected override bool Test(Sim a, CowPasture.Cow target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
if (!target.CanMilkCow())
{
int num = (int)((CowPasture.Cow.kMilkCooldownHours - SimClock.ElapsedTime(TimeUnit.Hours, target.LastMilked)) * 60f);
greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(CowPasture.LocalizeString(a.IsFemale, "MilkCooldown", new object[]
{
num
}));
return false;
}
return target.CanGetMilkType(this.mMilkType);
}
public override string[] GetPath(bool isFemale)
{
return this.mPath;
}
protected override string GetInteractionName(Sim actor, CowPasture.Cow target, InteractionObjectPair iop)
{
string result = CowPasture.LocalizeString(actor.IsFemale, "MilkWhiteMilk", new object[0]);
if (this.mMilkType == CowPasture.MilkType.Chocolate)
{
result = CowPasture.LocalizeString(actor.IsFemale, "MilkChocolateMilk", new object[0]);
}
else if (this.mMilkType == CowPasture.MilkType.ChocolateShake)
{
result = CowPasture.LocalizeString(actor.IsFemale, "MilkChocolateShake", new object[0]);
}
else if (this.mMilkType == CowPasture.MilkType.Shake)
{
result = CowPasture.LocalizeString(actor.IsFemale, "MilkShake", new object[0]);
}
else if (this.mMilkType == CowPasture.MilkType.Soy)
{
result = CowPasture.LocalizeString(actor.IsFemale, "MilkSoy", new object[0]);
}
return result;
}
protected override void AddInteractions(InteractionObjectPair iop, Sim actor, CowPasture.Cow target, List<InteractionObjectPair> results)
{
bool flag = target.CanGetMilkType(CowPasture.MilkType.Chocolate);
bool flag2 = target.CanGetMilkType(CowPasture.MilkType.Soy);
bool flag3 = target.CanGetMilkType(CowPasture.MilkType.Shake);
bool flag4 = target.CanGetMilkType(CowPasture.MilkType.ChocolateShake);
List<string> list = new List<string>();
if (flag || flag2 || flag3 || flag4)
{
list.Add(CowPasture.LocalizeString(actor.IsFemale, "MilkPath", new object[0]) + Localization.Ellipsis);
}
results.Add(new InteractionObjectPair(new CowPasture.Cow.MilkCow.Definition(CowPasture.MilkType.White, list.ToArray()), iop.Target));
if (flag2)
{
results.Add(new InteractionObjectPair(new CowPasture.Cow.MilkCow.Definition(CowPasture.MilkType.Soy, list.ToArray()), iop.Target));
}
if (flag)
{
results.Add(new InteractionObjectPair(new CowPasture.Cow.MilkCow.Definition(CowPasture.MilkType.Chocolate, list.ToArray()), iop.Target));
}
if (flag3)
{
results.Add(new InteractionObjectPair(new CowPasture.Cow.MilkCow.Definition(CowPasture.MilkType.Shake, list.ToArray()), iop.Target));
}
if (flag4)
{
results.Add(new InteractionObjectPair(new CowPasture.Cow.MilkCow.Definition(CowPasture.MilkType.ChocolateShake, list.ToArray()), iop.Target));
}
}
}
public static readonly InteractionDefinition Singleton = new CowPasture.Cow.MilkCow.Definition();
private CowPasture.Milk mMilk;
private ObjectGuid mBucket = ObjectGuid.InvalidObjectGuid;
private ObjectGuid mStool = ObjectGuid.InvalidObjectGuid;
protected override bool Run()
{
CowPasture.Cow.MilkCow.Definition definition = base.InteractionDefinition as CowPasture.Cow.MilkCow.Definition;
if (definition == null)
{
return false;
}
CowPasture.MilkType index = definition.mMilkType;
if (base.Autonomous)
{
List<CowPasture.MilkType> list = new List<CowPasture.MilkType>(5);
list.Add(CowPasture.MilkType.White);
if (this.Target.CanGetMilkType(CowPasture.MilkType.Chocolate))
{
list.Add(CowPasture.MilkType.Chocolate);
}
if (this.Target.CanGetMilkType(CowPasture.MilkType.Soy))
{
list.Add(CowPasture.MilkType.Soy);
}
if (this.Target.CanGetMilkType(CowPasture.MilkType.Shake))
{
list.Add(CowPasture.MilkType.Shake);
}
if (this.Target.CanGetMilkType(CowPasture.MilkType.ChocolateShake))
{
list.Add(CowPasture.MilkType.ChocolateShake);
}
index = RandomUtil.GetRandomObjectFromList<CowPasture.MilkType>(list);
}
if (!this.Target.EnsureOutOfBarn(false))
{
return false;
}
this.Actor.RouteToSlot(this.Target, 824351311);
if (this.Target.InUse && !this.Target.IsActorUsingMe(this.Actor))
{
this.Actor.AddExitReason(ExitReason.ObjectInUse);
return false;
}
base.StandardEntry();
while (this.Target.mIsWalking)
{
Simulator.Sleep(0u);
}
if (!this.Target.EnsureOutOfBarn(true) || !this.Actor.RouteToSlot(this.Target, 824351311))
{
base.StandardExit();
return false;
}
if (!this.Target.CanMilkCow() || !this.Target.CanGetMilkType(definition.mMilkType))
{
base.StandardExit();
return false;
}
base.BeginCommodityUpdates();
base.EnterStateMachine("CowPasture_store", "SimEnter", "x");
IGameObject gameObject = GlobalFunctions.CreateObjectOutOfWorld("accessoryMilkBottle", -1, "Sims3.Store.Objects.CowPasture+Milk", null);
this.mMilk = (gameObject as CowPasture.Milk);
if (this.mMilk == null)
{
if (gameObject != null)
{
gameObject.Destroy();
}
}
else
{
this.mMilk.SetDrinkInfo(CowPasture.sMilkDrinkInfos[(int)index]);
this.mMilk.MakeFull();
this.mMilk.ActorsUsingMe.Add(this.Actor);
base.SetActor("milkbottle", this.mMilk);
}
this.mBucket = GlobalFunctions.CreateProp("accessoryBucket", 1, Vector3.OutOfWorld, 0, Vector3.UnitZ);
if (this.mBucket != ObjectGuid.InvalidObjectGuid)
{
this.mCurrentStateMachine.SetPropActor("bucket", this.mBucket);
}
this.mStool = GlobalFunctions.CreateProp("accessoryStool", -1, Vector3.OutOfWorld, 0, Vector3.UnitZ);
if (this.mStool != ObjectGuid.InvalidObjectGuid)
{
this.mCurrentStateMachine.SetPropActor("stool", this.mStool);
}
base.AnimateSimNoYield("Join");
this.Target.AdvanceToStateYeilding("Join");
base.AnimateSimNoYield("milkCow");
this.Target.AdvanceToStateYeilding("milkCow");
if (this.mMilk != null)
{
this.Actor.Inventory.TryToAdd(this.mMilk);
this.mMilk.ActorsUsingMe.Clear();
this.mMilk = null;
}
base.AnimateSimNoYield("Part");
this.Target.AdvanceToStateYeilding("Part");
base.AnimateSimNoYield("SimExit");
this.Target.AdvanceToStateYeilding(this.Target.mPreviousLocationString);
this.Target.LastMilked = SimClock.CurrentTime();
bool flag = true;
base.EndCommodityUpdates(flag);
base.StandardExit();
return flag;
}
public override void Cleanup()
{
if (base.StandardEntryCalled)
{
if (this.mMilk != null)
{
this.mMilk.Destroy();
}
GameObject @object = GameObject.GetObject(this.mBucket);
if (@object != null)
{
@object.SetOpacity(0f, 0f);
@object.UnParent();
@object.Destroy();
}
GameObject object2 = GameObject.GetObject(this.mStool);
if (object2 != null)
{
object2.SetOpacity(0f, 0f);
object2.UnParent();
object2.Destroy();
}
}
base.Cleanup();
}
}
public sealed class FeedCow : Interaction<Sim, CowPasture.Cow>
{
public enum FoodType
{
Chocolate,
Vegetable
}
private sealed class Definition : InteractionDefinition<Sim, CowPasture.Cow, CowPasture.Cow.FeedCow>
{
public CowPasture.Cow.FeedCow.FoodType mFoodType;
public Definition()
{
}
public Definition(CowPasture.Cow.FeedCow.FoodType foodType)
{
this.mFoodType = foodType;
}
protected override bool Test(Sim a, CowPasture.Cow target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
if (a.FamilyFunds < CowPasture.Cow.kFeedCowCost)
{
greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(CowPasture.LocalizeString(a.IsFemale, "InsufficientFunds", new object[0]));
return false;
}
return true;
}
public override string[] GetPath(bool isFemale)
{
return new string[]
{
CowPasture.LocalizeString(isFemale, "FeedPath", new object[0]) + Localization.Ellipsis
};
}
protected override string GetInteractionName(Sim actor, CowPasture.Cow target, InteractionObjectPair iop)
{
string result = CowPasture.LocalizeString(actor.IsFemale, "FeedChocolate", new object[0]);
if (this.mFoodType == CowPasture.Cow.FeedCow.FoodType.Vegetable)
{
result = CowPasture.LocalizeString(actor.IsFemale, "FeedVegetable", new object[0]);
}
return result;
}
protected override void AddInteractions(InteractionObjectPair iop, Sim actor, CowPasture.Cow target, List<InteractionObjectPair> results)
{
results.Add(new InteractionObjectPair(new CowPasture.Cow.FeedCow.Definition(CowPasture.Cow.FeedCow.FoodType.Chocolate), iop.Target));
results.Add(new InteractionObjectPair(new CowPasture.Cow.FeedCow.Definition(CowPasture.Cow.FeedCow.FoodType.Vegetable), iop.Target));
}
}
public static readonly InteractionDefinition Singleton = new CowPasture.Cow.FeedCow.Definition();
protected override bool Run()
{
CowPasture.Cow.FeedCow.Definition definition = base.InteractionDefinition as CowPasture.Cow.FeedCow.Definition;
if (definition == null)
{
return false;
}
bool flag = definition.mFoodType == CowPasture.Cow.FeedCow.FoodType.Vegetable;
if (base.Autonomous)
{
flag = RandomUtil.CoinFlip();
}
if (!this.Target.EnsureOutOfBarn(false))
{
return false;
}
this.Actor.RouteToSlot(this.Target, 824351310);
if (this.Target.InUse && !this.Target.IsActorUsingMe(this.Actor))
{
this.Actor.AddExitReason(ExitReason.ObjectInUse);
return false;
}
base.StandardEntry();
while (this.Target.mIsWalking)
{
Simulator.Sleep(0u);
}
if (!this.Target.EnsureOutOfBarn(false) || !this.Actor.RouteToSlot(this.Target, 824351310))
{
base.StandardExit();
return false;
}
base.BeginCommodityUpdates();
base.EnterStateMachine("CowPasture_store", "SimEnter", "x");
if (flag)
{
base.SetParameter("UseSoyFood", true);
this.Target.mStateMachine.SetParameter("UseSoyFood", true);
}
else
{
base.SetParameter("UseSoyFood", false);
this.Target.mStateMachine.SetParameter("UseSoyFood", false);
}
base.AnimateSimNoYield("Join");
this.Target.AdvanceToStateYeilding("Join");
if (RandomUtil.RandomChance(CowPasture.Cow.kFeedCowRejectChance))
{
base.AnimateSimNoYield("feedcow_accept");
this.Target.AdvanceToStateYeilding("feedcow_accept");
this.Actor.ModifyFunds(-CowPasture.Cow.kFeedCowCost);
if (flag)
{
this.Target.LastVeggies = SimClock.CurrentTime();
}
else
{
this.Target.LastChocolate = SimClock.CurrentTime();
}
}
else
{
base.AnimateSimNoYield("feedcow_reject");
this.Target.AdvanceToStateYeilding("feedcow_reject");
}
base.AnimateSimNoYield("Part");
this.Target.AdvanceToStateYeilding("Part");
base.AnimateSimNoYield("SimExit");
this.Target.AdvanceToStateYeilding(this.Target.mPreviousLocationString);
bool flag2 = true;
base.EndCommodityUpdates(flag2);
base.StandardExit();
return flag2;
}
}
public sealed class TipCow : Interaction<Sim, CowPasture.Cow>
{
private sealed class Definition : InteractionDefinition<Sim, CowPasture.Cow, CowPasture.Cow.TipCow>
{
protected override bool Test(Sim a, CowPasture.Cow target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
if (a.SimDescription.IsVisuallyPregnant)
{
greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(Localization.LocalizeString(a.IsFemale, "Gameplay/Actors/Sim:PregnantFailure", new object[]
{
a
}));
return false;
}
return true;
}
protected override string GetInteractionName(Sim actor, CowPasture.Cow target, InteractionObjectPair iop)
{
return CowPasture.LocalizeString(actor.IsFemale, "TipCow", new object[0]);
}
}
public static readonly InteractionDefinition Singleton = new CowPasture.Cow.TipCow.Definition();
protected override bool Run()
{
if (!this.Target.EnsureOutOfBarn(false))
{
return false;
}
this.Actor.RouteToSlot(this.Target, 824351308);
if (this.Target.InUse && !this.Target.IsActorUsingMe(this.Actor))
{
this.Actor.AddExitReason(ExitReason.ObjectInUse);
return false;
}
base.StandardEntry();
while (this.Target.mIsWalking)
{
Simulator.Sleep(0u);
}
if (!this.Target.EnsureOutOfBarn(true) || !this.Actor.RouteToSlot(this.Target, 824351308))
{
base.StandardExit();
return false;
}
base.BeginCommodityUpdates();
this.Target.mStateMachine.SetActor("x", this.Actor);
this.Target.mStateMachine.EnterState("x", "SimEnter");
this.Target.mStateMachine.RequestState(true, "cow", "Join");
this.Target.mStateMachine.RequestState(true, "x", "Join");
if (RandomUtil.RandomChance(CowPasture.Cow.kTipCowFailChance))
{
this.Target.mStateMachine.RequestState(false, "cow", "tipCow_fail");
this.Target.mStateMachine.RequestState(true, "x", "tipCow_fail");
this.Actor.BuffManager.AddElement(5462585249724625719uL, Origin.None);
}
else
{
this.Target.mStateMachine.RequestState(false, "cow", "tipCow_success");
this.Target.mStateMachine.RequestState(true, "x", "tipCow_success");
this.Target.LastTipped = SimClock.CurrentTime();
this.Actor.BuffManager.AddElement(5462585249724625718uL, Origin.None);
}
this.Target.mStateMachine.RequestState(false, "cow", "Part");
this.Target.mStateMachine.RequestState(true, "x", "Part");
this.Target.mStateMachine.RequestState(true, "x", "SimExit");
this.Target.mStateMachine.RequestState(true, "cow", this.Target.mPreviousLocationString);
this.Target.mStateMachine.RemoveActor("x");
bool flag = true;
base.EndCommodityUpdates(flag);
base.StandardExit();
return flag;
}
}
public sealed class TicTacCow : Interaction<Sim, CowPasture.Cow>
{
private sealed class Definition : InteractionDefinition<Sim, CowPasture.Cow, CowPasture.Cow.TicTacCow>
{
protected override bool Test(Sim a, CowPasture.Cow target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
return true;
}
protected override string GetInteractionName(Sim actor, CowPasture.Cow target, InteractionObjectPair iop)
{
return CowPasture.LocalizeString(actor.IsFemale, "TicTacCow", new object[0]);
}
}
private const uint kHumanStompEvent = 333u;
private const uint kCowStompEvent = 334u;
public static readonly InteractionDefinition Singleton = new CowPasture.Cow.TicTacCow.Definition();
private CowPasture.TicTacBoard mBoard;
private bool DoesSimWin()
{
float num = CowPasture.Cow.kTicTacBaseWinChance;
int skillLevel = this.Actor.SkillManager.GetSkillLevel(SkillNames.Logic);
if (skillLevel > 0)
{
num += CowPasture.Cow.kTicTacOddsPerLogic;
}
int skillLevel2 = this.Actor.SkillManager.GetSkillLevel(SkillNames.Chess);
if (skillLevel2 > 0)
{
num += CowPasture.Cow.kTicTacOddsChess;
}
if (this.Actor.TraitManager.HasElement(TraitNames.Genius))
{
num += CowPasture.Cow.kTicTacOddsGenius;
}
if (this.Actor.TraitManager.HasElement(TraitNames.AbsentMinded))
{
num += CowPasture.Cow.kTicTacOddsAbsentMinded;
}
if (this.Actor.BuffManager.HasElement(BuffNames.FeelingLucky))
{
num += CowPasture.Cow.kTicTacOddsLucky;
}
if (this.Actor.BuffManager.HasElement(BuffNames.FeelingUnlucky))
{
num += CowPasture.Cow.kTicTacOddsUnlucky;
}
return RandomUtil.RandomChance(num);
}
protected override bool Run()
{
if (!this.Target.EnsureOutOfBarn(false))
{
return false;
}
this.Actor.RouteToSlot(this.Target, 824351309);
if (this.Target.InUse && !this.Target.IsActorUsingMe(this.Actor))
{
this.Actor.AddExitReason(ExitReason.ObjectInUse);
return false;
}
base.StandardEntry();
while (this.Target.mIsWalking)
{
Simulator.Sleep(0u);
}
if (!this.Target.EnsureOutOfBarn(true) || !this.Actor.RouteToSlot(this.Target, 824351309))
{
base.StandardExit();
return false;
}
base.BeginCommodityUpdates();
this.Actor.PlaySoloAnimation("a_genericSwipe_pickUp_floor_x", true);
base.EnterStateMachine("CowPasture_store", "SimEnter", "x");
this.mBoard = (GlobalFunctions.CreateObjectOutOfWorld("accessoryTicTacBoard", -1) as CowPasture.TicTacBoard);
if (this.mBoard != null)
{
this.mBoard.ParentToSlot(this.Target, -1474234202);
VisualEffect visualEffect = VisualEffect.Create("store_cow_TTT_cowTurn");
Vector3 zero = Vector3.Zero;
Vector3 zero2 = Vector3.Zero;
if (Slots.AttachToBone(visualEffect.get_ObjectId(), this.mBoard.ObjectId, ResourceUtils.HashString32("transformBone"), false, ref zero, ref zero2, 0f) == null)
{
visualEffect.SetAutoDestroy(true);
visualEffect.Start();
}
else
{
visualEffect.Dispose();
}
}
base.AnimateSimNoYield("Join");
this.Target.AdvanceToStateYeilding("Join");
base.AnimateSimNoYield("tttSimIdle");
this.Target.AdvanceToStateYeilding("tttCowIdle");
base.AddPersistentScriptEventHandler(333u, new SacsEventHandler(this.OnStompEvent));
this.Target.mStateMachine.AddOneShotScriptEventHandler(334u, new SacsEventHandler(this.OnStompEvent));
if (this.DoesSimWin())
{
for (int i = 0; i < 3; i++)
{
if (this.mBoard != null)
{
this.mBoard.SetNextGeoState("win1_turn" + (i * 2 + 1));
}
base.AnimateSim("tttSimStomp");
base.AnimateSim("tttSimIdle");
if (this.mBoard != null)
{
this.mBoard.SetNextGeoState("win1_turn" + (i * 2 + 2));
}
this.Target.mStateMachine.AddOneShotScriptEventHandler(334u, new SacsEventHandler(this.OnStompEvent));
this.Target.mStateMachine.RequestState(true, "cow", "tttCowStomp");
this.Target.mStateMachine.RequestState(true, "cow", "tttCowIdle");
}
if (this.mBoard != null)
{
this.mBoard.SetNextGeoState("win1_turn7");
}
base.AnimateSim("tttSimStomp");
base.AnimateSim("tttSimIdle");
if (this.mBoard != null)
{
this.mBoard.FadeOut(false, false, CowPasture.Cow.kBoardFadeOutTime);
}
base.AnimateSimNoYield("tttWinSim");
this.Target.mStateMachine.RequestState(true, "cow", "tttWinSim");
this.Actor.BuffManager.AddElement(5462585249724625717uL, Origin.None);
}
else
{
if (RandomUtil.CoinFlip())
{
for (int j = 0; j < 3; j++)
{
if (this.mBoard != null)
{
this.mBoard.SetNextGeoState("lose1_turn" + (j * 2 + 1));
}
base.AnimateSim("tttSimStomp");
base.AnimateSim("tttSimIdle");
if (this.mBoard != null)
{
this.mBoard.SetNextGeoState("lose1_turn" + (j * 2 + 2));
}
this.Target.mStateMachine.AddOneShotScriptEventHandler(334u, new SacsEventHandler(this.OnStompEvent));
this.Target.mStateMachine.RequestState(true, "cow", "tttCowStomp");
this.Target.mStateMachine.RequestState(true, "cow", "tttCowIdle");
}
this.Actor.BuffManager.AddElement(5462585249724625716uL, Origin.None);
}
else
{
for (int k = 0; k < 4; k++)
{
if (this.mBoard != null)
{
this.mBoard.SetNextGeoState("draw1_turn" + (k * 2 + 1));
}
base.AnimateSim("tttSimStomp");
base.AnimateSim("tttSimIdle");
if (this.mBoard != null)
{
this.mBoard.SetNextGeoState("draw1_turn" + (k * 2 + 2));
}
this.Target.mStateMachine.AddOneShotScriptEventHandler(334u, new SacsEventHandler(this.OnStompEvent));
this.Target.mStateMachine.RequestState(true, "cow", "tttCowStomp");
this.Target.mStateMachine.RequestState(true, "cow", "tttCowIdle");
}
if (this.mBoard != null)
{
this.mBoard.SetNextGeoState("draw1_turn9");
}
base.AnimateSim("tttSimStomp");
base.AnimateSim("tttSimIdle");
}
if (this.mBoard != null)
{
this.mBoard.FadeOut(false, false, CowPasture.Cow.kBoardFadeOutTime);
}
base.AnimateSimNoYield("tttWinCow");
this.Target.AdvanceToStateYeilding("tttWinCow");
}
base.AnimateSimNoYield("Part");
this.Target.AdvanceToStateYeilding("Part");
base.AnimateSimNoYield("SimExit");
this.Target.AdvanceToStateYeilding(this.Target.mPreviousLocationString);
bool flag = true;
base.EndCommodityUpdates(flag);
base.StandardExit();
return flag;
}
private void OnStompEvent(StateMachineClient smc, IEvent evt)
{
if (evt == null)
{
return;
}
if (this.mBoard != null)
{
this.mBoard.DoNextGeoState();
}
}
public override void Cleanup()
{
if (base.StandardEntryCalled && this.mBoard != null)
{
this.mBoard.SetOpacity(0f, 0f);
this.mBoard.UnParent();
this.mBoard.Destroy();
}
base.Cleanup();
}
}
public sealed class DEBUG_MoveCow : Interaction<Sim, CowPasture.Cow>
{
[DoesntRequireTuning]
private sealed class Definition : InteractionDefinition<Sim, CowPasture.Cow, CowPasture.Cow.DEBUG_MoveCow>
{
public string mLocation = string.Empty;
public Definition()
{
}
public Definition(string location)
{
this.mLocation = location;
}
protected override bool Test(Sim a, CowPasture.Cow target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
return true;
}
public override string[] GetPath(bool isFemale)
{
return new string[]
{
"DEBUG_MoveCow" + Localization.Ellipsis
};
}
protected override string GetInteractionName(Sim actor, CowPasture.Cow target, InteractionObjectPair iop)
{
return this.mLocation;
}
protected override void AddInteractions(InteractionObjectPair iop, Sim actor, CowPasture.Cow target, List<InteractionObjectPair> results)
{
results.Add(new InteractionObjectPair(new CowPasture.Cow.DEBUG_MoveCow.Definition("Barn"), target));
results.Add(new InteractionObjectPair(new CowPasture.Cow.DEBUG_MoveCow.Definition("location1"), target));
results.Add(new InteractionObjectPair(new CowPasture.Cow.DEBUG_MoveCow.Definition("location2"), target));
results.Add(new InteractionObjectPair(new CowPasture.Cow.DEBUG_MoveCow.Definition("location3"), target));
}
}
public static readonly InteractionDefinition Singleton = new CowPasture.Cow.DEBUG_MoveCow.Definition();
protected override bool Run()
{
CowPasture.Cow.DEBUG_MoveCow.Definition definition = base.InteractionDefinition as CowPasture.Cow.DEBUG_MoveCow.Definition;
if (definition == null)
{
return false;
}
base.StandardEntry();
base.BeginCommodityUpdates();
this.Target.AdvanceToStateYeilding(definition.mLocation);
bool flag = true;
base.EndCommodityUpdates(flag);
base.StandardExit();
return flag;
}
}
private sealed class DEBUG_AllowAllMilk : ImmediateInteraction<IActor, CowPasture.Cow>
{
[DoesntRequireTuning]
private sealed class Definition : ActorlessInteractionDefinition<IActor, CowPasture.Cow, CowPasture.Cow.DEBUG_AllowAllMilk>
{
protected override string GetInteractionName(IActor a, CowPasture.Cow target, InteractionObjectPair interaction)
{
return "DEBUG_AllowAllMilk";
}
protected override bool Test(IActor a, CowPasture.Cow target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
return true;
}
}
public static readonly InteractionDefinition Singleton = new CowPasture.Cow.DEBUG_AllowAllMilk.Definition();
protected override bool Run()
{
this.Target.LastMilked = DateAndTime.Invalid;
this.Target.LastChocolate = SimClock.CurrentTime();
this.Target.LastVeggies = SimClock.CurrentTime();
this.Target.LastTipped = SimClock.CurrentTime();
return true;
}
}
private const uint kAnimEventBarn = 300u;
private const uint kAnimEventFront = 301u;
private const uint kAnimEventSide = 302u;
private const uint kAnimEventBack = 303u;
private const uint kAnimCowbell = 400u;
public ObjectGuid mParentPasture = ObjectGuid.InvalidObjectGuid;
private StateMachineClient mStateMachine;
private AlarmHandle mWalkAlarm = AlarmHandle.kInvalidHandle;
private bool mIsWalking;
private string[] kLocations = new string[]
{
"Barn",
"location1",
"location2",
"location3"
};
private string mPreviousLocationString = "Barn";
[Tunable, TunableComment("Minimum hours between milkings. Default: 6")]
private static float kMilkCooldownHours = 6f;
[Tunable, TunableComment("Number of hours that chocolate/veggies feeding goes to flavored milk. Default: 12")]
private static float kMilkFoodEffectDuration = 12f;
[Tunable, TunableComment("Number of hours that tipping a cow allows milk shake. Default: 6")]
private static float kMilkTipEffectDuration = 6f;
[Tunable, TunableComment("Percent chance cow will reject food. Default: 40")]
private static float kFeedCowRejectChance = 40f;
[Tunable, TunableComment("Percent chance cow tipping will fail. Default: 70")]
private static float kTipCowFailChance = 70f;
[Tunable, TunableComment("Base chance to win Tic Tac Hoove. Default: 40")]
private static float kTicTacBaseWinChance = 40f;
[Tunable, TunableComment("Bonus chance to win for each logic point. Default: 5")]
private static float kTicTacOddsPerLogic = 5f;
[Tunable, TunableComment("Bonus chance to win for each chess point. Default: 3")]
private static float kTicTacOddsChess = 3f;
[Tunable, TunableComment("Bonus chance for genius trait. Default:10")]
private static float kTicTacOddsGenius = 10f;
[Tunable, TunableComment("Bonus chance for absent minded trait. Default:10")]
private static float kTicTacOddsAbsentMinded = -10f;
[Tunable, TunableComment("Bonus chance for lucky. Default: 10")]
private static float kTicTacOddsLucky = 10f;
[Tunable, TunableComment("Bonus chance for unlucky. Default: -10")]
private static float kTicTacOddsUnlucky = -10f;
[Tunable, TunableComment("Cost to feed a cow. Default: 5")]
private static int kFeedCowCost = 5;
[Tunable, TunableComment("Sim minutes for the cow to sit idle before walking. Default: 30")]
private static float kWalkingMinutesBetweenWalk = 30f;
[Tunable, TunableComment("Sim minutes maximum variance to add randomly before walking. Default: 5")]
private static float kWalkingMinutesVariance = 5f;
[Tunable, TunableComment("Chance that a nearby sim will get the moodlet when the cow's bell makes noise. Default: 5")]
private static float kBellOddsOfMoodlet = 5f;
[Tunable, TunableComment("Distance (meters) that the cow bell will affect. Default: 20")]
private static float kBellRadius = 20f;
[Tunable, TunableComment("Clock seconds needed to fade out the tic tac toe board")]
private static float kBoardFadeOutTime = 2f;
[Tunable, TunableComment("Weighted odds to walk 0, 1, 2, or 3 distances")]
private static float[] kWeightedOddsToWalkCowDistance = new float[]
{
1f,
3f,
2f,
1f
};
public DateAndTime LastMilked
{
get
{
CowPasture cowPasture = base.Parent as CowPasture;
if (cowPasture != null)
{
return cowPasture.mLastMilked;
}
return DateAndTime.Invalid;
}
set
{
CowPasture cowPasture = base.Parent as CowPasture;
if (cowPasture != null)
{
cowPasture.mLastMilked = value;
}
}
}
public DateAndTime LastChocolate
{
get
{
CowPasture cowPasture = base.Parent as CowPasture;
if (cowPasture != null)
{
return cowPasture.mLastChocolate;
}
return DateAndTime.Invalid;
}
set
{
CowPasture cowPasture = base.Parent as CowPasture;
if (cowPasture != null)
{
cowPasture.mLastChocolate = value;
}
}
}
public DateAndTime LastVeggies
{
get
{
CowPasture cowPasture = base.Parent as CowPasture;
if (cowPasture != null)
{
return cowPasture.mLastVeggies;
}
return DateAndTime.Invalid;
}
set
{
CowPasture cowPasture = base.Parent as CowPasture;
if (cowPasture != null)
{
cowPasture.mLastVeggies = value;
}
}
}
public DateAndTime LastTipped
{
get
{
CowPasture cowPasture = base.Parent as CowPasture;
if (cowPasture != null)
{
return cowPasture.mLastTipped;
}
return DateAndTime.Invalid;
}
set
{
CowPasture cowPasture = base.Parent as CowPasture;
if (cowPasture != null)
{
cowPasture.mLastTipped = value;
}
}
}
public override void OnCreation()
{
base.OnCreation();
}
public override void OnStartup()
{
base.AddInteraction(CowPasture.Cow.MilkCow.Singleton);
base.AddInteraction(CowPasture.Cow.FeedCow.Singleton);
base.AddInteraction(CowPasture.Cow.TipCow.Singleton);
base.AddInteraction(CowPasture.Cow.TicTacCow.Singleton);
this.mWalkAlarm = base.AddAlarm(0f, TimeUnit.Minutes, new AlarmTimerCallback(this.DoCowWalk), "Walk the cow", AlarmType.AlwaysPersisted);
base.AlarmWillYield(this.mWalkAlarm);
base.OnStartup();
}
protected override void AddDebugInteractions(List<InteractionDefinition> debugInteractions)
{
debugInteractions.Add(CowPasture.Cow.DEBUG_MoveCow.Singleton);
debugInteractions.Add(CowPasture.Cow.DEBUG_AllowAllMilk.Singleton);
base.AddDebugInteractions(debugInteractions);
}
protected override void DoReset(GameObject.ResetInformation resetInformation)
{
base.DoReset(resetInformation);
this.Cleanup();
this.mWalkAlarm = base.AddAlarm(0f, TimeUnit.Minutes, new AlarmTimerCallback(this.DoCowWalk), "Walk the cow", AlarmType.AlwaysPersisted);
base.AlarmWillYield(this.mWalkAlarm);
}
public override void Dispose()
{
this.Cleanup();
base.Dispose();
}
public void Cleanup()
{
if (this.mStateMachine != null)
{
this.mStateMachine.Dispose();
this.mStateMachine = null;
}
base.RemoveAlarm(this.mWalkAlarm);
this.mWalkAlarm = AlarmHandle.kInvalidHandle;
}
public override bool HandToolAllowPlacementInSlot(IGameObject objectToPlaceInSlot, Slot slot, AdditionalSlotPlacementCheckResults checks)
{
return false;
}
public override bool CanBeSold()
{
return false;
}
public override bool HandToolAllowUserPickup()
{
return false;
}
public override ThumbnailKey GetThumbnailKey()
{
ThumbnailKey thumbnailKey = base.GetThumbnailKey();
thumbnailKey.mDescKey.InstanceId = 7571546255803752419uL;
thumbnailKey.mDescKey.TypeId = 779470692u;
return thumbnailKey;
}
private string GetNextCowLocationString()
{
int num = 0;
while (num < this.kLocations.Length && !this.mPreviousLocationString.Equals(this.kLocations[num]))
{
num++;
}
num++;
num %= this.kLocations.Length;
return this.kLocations[num];
}
private void DoCowWalk()
{
base.RemoveAlarm(this.mWalkAlarm);
float time = RandomUtil.RandomFloatGaussianDistribution(CowPasture.Cow.kWalkingMinutesBetweenWalk - CowPasture.Cow.kWalkingMinutesVariance, CowPasture.Cow.kWalkingMinutesBetweenWalk + CowPasture.Cow.kWalkingMinutesVariance);
this.mWalkAlarm = base.AddAlarm(time, TimeUnit.Minutes, new AlarmTimerCallback(this.DoCowWalk), "Walk the cow", AlarmType.AlwaysPersisted);
base.AlarmWillYield(this.mWalkAlarm);
if (!this.InUse && !this.mIsWalking)
{
this.mIsWalking = true;
int weightedIndex = RandomUtil.GetWeightedIndex(CowPasture.Cow.kWeightedOddsToWalkCowDistance);
if (weightedIndex == 0)
{
this.AdvanceToStateYeilding(this.mPreviousLocationString);
}
else
{
for (int i = 0; i < weightedIndex; i++)
{
string nextCowLocationString = this.GetNextCowLocationString();
this.AdvanceToStateYeilding(nextCowLocationString);
}
}
this.mIsWalking = false;
}
}
private bool CanMilkCow()
{
return !(this.LastMilked != DateAndTime.Invalid) || SimClock.ElapsedTime(TimeUnit.Hours, this.LastMilked) >= CowPasture.Cow.kMilkCooldownHours;
}
private bool CanGetMilkType(CowPasture.MilkType flavor)
{
bool result = false;
switch (flavor)
{
case CowPasture.MilkType.White:
result = true;
break;
case CowPasture.MilkType.Chocolate:
if (this.LastChocolate != DateAndTime.Invalid && SimClock.ElapsedTime(TimeUnit.Hours, this.LastChocolate) < CowPasture.Cow.kMilkFoodEffectDuration)
{
return true;
}
break;
case CowPasture.MilkType.Soy:
if (this.LastVeggies != DateAndTime.Invalid && SimClock.ElapsedTime(TimeUnit.Hours, this.LastVeggies) < CowPasture.Cow.kMilkFoodEffectDuration)
{
return true;
}
break;
case CowPasture.MilkType.Shake:
if (this.LastTipped != DateAndTime.Invalid && SimClock.ElapsedTime(TimeUnit.Hours, this.LastTipped) < CowPasture.Cow.kMilkTipEffectDuration)
{
return true;
}
break;
case CowPasture.MilkType.ChocolateShake:
if (this.LastChocolate != DateAndTime.Invalid && this.LastTipped != DateAndTime.Invalid && SimClock.ElapsedTime(TimeUnit.Hours, this.LastChocolate) < CowPasture.Cow.kMilkFoodEffectDuration && SimClock.ElapsedTime(TimeUnit.Hours, this.LastTipped) < CowPasture.Cow.kMilkTipEffectDuration)
{
return true;
}
break;
}
return result;
}
private void AcquireStateMachine()
{
if (this.mStateMachine == null && Objects.IsValid(base.ObjectId))
{
this.mStateMachine = StateMachineClient.Acquire(base.ObjectId, "CowPasture_store");
this.mStateMachine.SetActor("cow", this);
this.mStateMachine.EnterState("cow", "enterCow");
this.mStateMachine.RequestState("cow", "Barn");
return;
}
if (this.mStateMachine != null)
{
this.mStateMachine.SetActor("cow", this);
}
}
private void AdvanceToStateYeilding(string state)
{
this.AcquireStateMachine();
if (this.mStateMachine != null)
{
this.mStateMachine.RemoveAllEventHandlers();
this.mStateMachine.AddOneShotScriptEventHandler(300u, new SacsEventHandler(this.OnReparentEvent));
this.mStateMachine.AddOneShotScriptEventHandler(301u, new SacsEventHandler(this.OnReparentEvent));
this.mStateMachine.AddOneShotScriptEventHandler(302u, new SacsEventHandler(this.OnReparentEvent));
this.mStateMachine.AddOneShotScriptEventHandler(303u, new SacsEventHandler(this.OnReparentEvent));
this.mStateMachine.AddOneShotScriptEventHandler(400u, new SacsEventHandler(this.OnCowbellEvent));
this.mStateMachine.RequestState(true, "cow", state);
}
}
private void OnCowbellEvent(StateMachineClient smc, IEvent evt)
{
List<Sim> list = new List<Sim>(base.LotCurrent.GetSims());
for (int i = 0; i < list.Count; i++)
{
if (RandomUtil.RandomChance(CowPasture.Cow.kBellOddsOfMoodlet) && list[i].RoomId == base.RoomId && base.GetDistanceToObjectSquared(list[i]) < CowPasture.Cow.kBellRadius * CowPasture.Cow.kBellRadius)
{
list[i].BuffManager.AddElement(5462585249724625715uL, Origin.None);
}
}
}
private void OnReparentEvent(StateMachineClient smc, IEvent evt)
{
if (evt == null)
{
return;
}
CowPasture cowPasture = GlobalFunctions.ConvertGuidToObject<CowPasture>(this.mParentPasture);
if (cowPasture == null)
{
this.Destroy();
return;
}
TransformParentingReturnCode transformParentingReturnCode = 2;
switch (evt.get_EventId())
{
case 300u:
base.ParentToSlot(cowPasture, -1474234206, ref transformParentingReturnCode);
this.mPreviousLocationString = this.kLocations[0];
return;
case 301u:
base.ParentToSlot(cowPasture, -1474234201, ref transformParentingReturnCode);
this.mPreviousLocationString = this.kLocations[1];
return;
case 302u:
base.ParentToSlot(cowPasture, -1474234204, ref transformParentingReturnCode);
this.mPreviousLocationString = this.kLocations[2];
return;
case 303u:
base.ParentToSlot(cowPasture, -1474234203, ref transformParentingReturnCode);
this.mPreviousLocationString = this.kLocations[3];
return;
default:
return;
}
}
private bool EnsureOutOfBarn(bool skipTests)
{
while (this.mIsWalking)
{
Simulator.Sleep(0u);
}
if (this.mPreviousLocationString == "Barn")
{
if (!skipTests && (this.InUse || this.mIsWalking))
{
return false;
}
this.mIsWalking = true;
this.AdvanceToStateYeilding("location1");
this.mIsWalking = false;
}
return true;
}
}
[RuntimeExport]
public class Milk : GameObject, IGlass, IEdible, ICantUseAnimatedSittingSocialsWhenUsing, ICarryable, IBaseCarryable, IHasRouteRadius, IThrowAwayable, IPartOfCookingProcess, IGameObject, IScriptObject, IScriptLogic, IHasScriptProxy, IObjectUI, IExportableContent, ICarryDestroyOnPutDown
{
public class DrinkGlass : Eat.Definition
{
public static readonly CowPasture.Milk.DrinkGlass Singleton = new CowPasture.Milk.DrinkGlass();
protected override bool Test(Sim a, IEdible target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
return base.Test(a, target, isAutonomous, ref greyedOutTooltipCallback);
}
}
private sealed class MakeCheese : ImmediateInteraction<Sim, CowPasture.Milk>
{
private sealed class Definition : InteractionDefinition<Sim, CowPasture.Milk, CowPasture.Milk.MakeCheese>
{
protected override bool Test(Sim a, CowPasture.Milk target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
if (!a.Inventory.Contains(target))
{
return false;
}
if (target.mType != CowPasture.MilkType.White)
{
return false;
}
List<CowPasture.Milk> list = a.Inventory.FindAll<CowPasture.Milk>(false);
int num = 0;
for (int i = 0; i < list.Count; i++)
{
if (list[i].mType == CowPasture.MilkType.White)
{
num++;
}
}
if (num < CowPasture.Milk.kMilkNeededToMakeCheese)
{
greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(CowPasture.LocalizeString(a.IsFemale, "MilkNeededToCreateCheese", new object[]
{
CowPasture.Milk.kMilkNeededToMakeCheese
}));
return false;
}
return true;
}
protected override string GetInteractionName(Sim actor, CowPasture.Milk target, InteractionObjectPair iop)
{
return CowPasture.LocalizeString(actor.IsFemale, "MakeCheese", new object[0]);
}
}
public static readonly InteractionDefinition Singleton = new CowPasture.Milk.MakeCheese.Definition();
protected override bool RunFromInventory()
{
return this.Run();
}
protected override bool Run()
{
List<CowPasture.Milk> list = this.Actor.Inventory.FindAll<CowPasture.Milk>(false);
List<CowPasture.Milk> list2 = new List<CowPasture.Milk>(CowPasture.Milk.kMilkNeededToMakeCheese);
for (int i = 0; i < list.Count; i++)
{
if (list[i].mType == CowPasture.MilkType.White)
{
list2.Add(list[i]);
if (list2.Count >= CowPasture.Milk.kMilkNeededToMakeCheese)
{
break;
}
}
}
Quality quality = CowPasture.Milk.kCheeseQualityVarieties[RandomUtil.GetWeightedIndex(CowPasture.Milk.kCheeseQualityWeights)];
Ingredient.AddIngredientsToSimInventory(this.Actor, 1, "Cheese", quality, false, PlayerDisclosure.Exposed);
for (int j = 0; j < list2.Count; j++)
{
this.Actor.Inventory.RemoveByForce(list2[j]);
base.DestroyObject(list2[j]);
}
return true;
}
}
public int FoodUnits;
public Recipe mRecipe;
public CowPasture.MilkType mType;
public string mName;
public string mGeometryFullName;
public string mGeometryEmptyName;
public string mMaterialName;
public ProductVersion mPV;
[Tunable, TunableComment("Days the Soy Milk extends a Sims life. Default: 1")]
private static float kSoyAgeExtension = 1f;
[Tunable, TunableComment("Motive to give when this milk is drunk")]
private static float kMilkMotiveHunger = 10f;
[Tunable, TunableComment("Motive to give when this milk is drunk")]
private static float kSoyMotiveHunger = 10f;
[Tunable, TunableComment("Motive to give when this milk is drunk")]
private static float kChocolateMotiveHunger = 10f;
[Tunable, TunableComment("Motive to give when this milk is drunk")]
private static float kChocolateMotiveFun = 10f;
[Tunable, TunableComment("Motive to give when this milk is drunk")]
private static float kShakeMotiveHunger = 10f;
[Tunable, TunableComment("Motive to give when this milk is drunk")]
private static float kShakeMotiveFun = 10f;
[Tunable, TunableComment("Motive to give when this milk is drunk")]
private static float kChocShakeMotiveHunger = 10f;
[Tunable, TunableComment("Motive to give when this milk is drunk")]
private static float kChocShakeMotiveFun = 10f;
[Tunable, TunableComment("Number of white milk consumed in the process of making cheese")]
private static int kMilkNeededToMakeCheese = 2;
[Tunable, TunableComment("Odds of getting the various qualities. Number of weights must match number of qualities")]
private static float[] kCheeseQualityWeights = new float[]
{
5f,
4f,
3f,
2f,
1f,
1f
};
[Tunable, TunableComment("Types of qualities of cheese. Number of qualities must match number of weights")]
private static Quality[] kCheeseQualityVarieties = new Quality[]
{
Quality.Nice,
Quality.VeryNice,
Quality.Great,
Quality.Excellent,
Quality.Outstanding,
Quality.Putrid
};
[Tunable, TunableComment("Amount of food in a full container. Equates to how many drinks are needed to chug it all. Default:10")]
private static int kMilkFoodUnits = 10;
private uint kTypeField = 2954315994u;
private uint kNameField = 2486342905u;
private uint kFullField = 2486342906u;
private uint kEmptyField = 2486342907u;
private uint kMaterialField = 2486342908u;
private uint kProductVersionField = 2486342909u;
private CookingProcess mCookingProcess = new CookingProcess();
private static ThumbnailKey[] mThumbnailCache = new ThumbnailKey[5];
public bool IsPoolbarDrink
{
get
{
return false;
}
set
{
}
}
public float CarryRouteToObjectRadius
{
get
{
return 1f;
}
}
public virtual string CarryModelName
{
get
{
return "glassBar";
}
}
public virtual string FoodName
{
get
{
return this.mName ?? string.Empty;
}
}
public Recipe Recipe
{
get
{
return this.mRecipe;
}
}
public bool IsEmpty
{
get
{
return this.FoodUnits <= 0;
}
}
public bool IsDrinkable
{
get
{
return true;
}
}
public bool Spoiled
{
get
{
return false;
}
}
public bool CountsAsFood
{
get
{
return true;
}
}
public bool CanPutDownToEat
{
get
{
return false;
}
}
public bool CanBeCleanedUp
{
get
{
return false;
}
}
public string UtensilName
{
get
{
return "no utensil";
}
}
public UtensilType UtensilType
{
get
{
return 2;
}
}
public virtual string EatLoopStateName
{
get
{
return "Loop Drink Glass";
}
}
public GameObject ThingToEat
{
get
{
return this;
}
}
public InteractionDefinition CleanUpInteraction
{
get
{
return null;
}
}
public virtual bool IsVampireFood
{
get
{
return false;
}
}
public bool IsMermaidFood
{
get
{
return false;
}
}
public CookingProcess CookingProcess
{
get
{
return this.mCookingProcess;
}
set
{
this.mCookingProcess = value;
}
}
public string ActorName
{
get
{
return this.mName;
}
}
public bool IsRecycleable
{
get
{
return false;
}
}
public override void OnCreation()
{
base.OnCreation();
this.FoodUnits = CowPasture.Milk.kMilkFoodUnits;
}
public override void OnStartup()
{
base.AddComponent<ItemComponent>(new object[]
{
ItemComponent.SimInventoryItem
});
Recipe.NameToRecipeHash.TryGetValue("Juice", out this.mRecipe);
this.mCookingProcess.Recipe = this.mRecipe;
base.AddInteraction(Eat.Singleton);
base.AddInventoryInteraction(Eat.Singleton);
base.AddInventoryInteraction(CowPasture.Milk.MakeCheese.Singleton);
base.OnStartup();
}
public override string GetLocalizedName()
{
return this.FoodName;
}
public bool PushDrinkAsContinuation(Sim Actor)
{
InteractionInstance instance = EatHeldFood.Singleton.CreateInstance(this, Actor, Actor.InheritedPriority(), false, true);
return Actor.InteractionQueue.PushAsContinuation(instance, false);
}
public void SetDrinkInfo(CowPasture.MilkDrinkInfo drinkInfo)
{
this.mType = drinkInfo.mType;
this.mName = drinkInfo.mName;
this.mGeometryFullName = drinkInfo.mGeometryFullName;
this.mGeometryEmptyName = drinkInfo.mGeometryEmptyName;
this.mMaterialName = drinkInfo.mMaterialName;
this.mPV = drinkInfo.mPV;
}
public void PutGlassAway()
{
this.Destroy();
}
public void MakeFull()
{
base.SetGeometryState(this.mGeometryFullName);
base.SetMaterial(this.mMaterialName);
}
public void MakeEmpty()
{
base.SetGeometryState(this.mGeometryEmptyName);
base.SetMaterial(this.mMaterialName);
}
public override bool ImportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamReader reader)
{
bool flag = base.ImportContent(resKeyTable, objIdTable, reader);
if (flag)
{
int num = 0;
flag = reader.ReadInt32(this.kTypeField, ref num, num);
if (flag)
{
this.mType = (CowPasture.MilkType)num;
}
flag &= reader.ReadString(this.kNameField, ref this.mName, "White");
flag &= reader.ReadString(this.kFullField, ref this.mGeometryFullName, "Full");
flag &= reader.ReadString(this.kEmptyField, ref this.mGeometryEmptyName, "Empty");
flag &= reader.ReadString(this.kMaterialField, ref this.mMaterialName, "Milk");
uint num2 = 4294967295u;
flag &= reader.ReadUint32(this.kProductVersionField, ref num2, 4294967295u);
if (flag)
{
this.mPV = num2;
}
}
return flag;
}
public override bool ExportContent(ResKeyTable resKeyTable, ObjectIdTable objIdTable, IPropertyStreamWriter writer)
{
bool flag = base.ExportContent(resKeyTable, objIdTable, writer);
flag &= writer.WriteInt32(this.kTypeField, (int)this.mType);
flag &= writer.WriteString(this.kNameField, this.mName);
flag &= writer.WriteString(this.kFullField, this.mGeometryFullName);
flag &= writer.WriteString(this.kEmptyField, this.mGeometryEmptyName);
flag &= writer.WriteString(this.kMaterialField, this.mMaterialName);
return flag & writer.WriteUint32(this.kProductVersionField, this.mPV);
}
public void DecrementFoodUnits()
{
this.FoodUnits--;
if (this.FoodUnits == 0)
{
this.MakeEmpty();
}
}
public int FoodUnitsTotal()
{
return CowPasture.Milk.kMilkFoodUnits;
}
public bool GetAddedHerb(ref Herb.HerbData herbData)
{
return false;
}
public void BeforeEatingCallback(Sim actor)
{
}
public void FinishedEatingCallback(Sim actor)
{
if (actor == null)
{
return;
}
this.MakeEmpty();
switch (this.mType)
{
case CowPasture.MilkType.White:
actor.Motives.ChangeValue(CommodityKind.Hunger, CowPasture.Milk.kMilkMotiveHunger);
break;
case CowPasture.MilkType.Chocolate:
actor.Motives.ChangeValue(CommodityKind.Hunger, CowPasture.Milk.kChocolateMotiveHunger);
actor.Motives.ChangeValue(CommodityKind.Fun, CowPasture.Milk.kChocolateMotiveFun);
break;
case CowPasture.MilkType.Soy:
{
actor.Motives.ChangeValue(CommodityKind.Hunger, CowPasture.Milk.kSoyMotiveHunger);
AgingState agingState = actor.SimDescription.AgingState;
if (agingState != null)
{
agingState.ExtendAgingState(CowPasture.Milk.kSoyAgeExtension);
(Responder.Instance.HudModel as HudModel).OnSimAgeChanged(actor.ObjectId);
}
break;
}
case CowPasture.MilkType.Shake:
actor.Motives.ChangeValue(CommodityKind.Hunger, CowPasture.Milk.kShakeMotiveHunger);
actor.Motives.ChangeValue(CommodityKind.Fun, CowPasture.Milk.kShakeMotiveFun);
actor.BuffManager.AddElement(5462585249724625713uL, Origin.None);
break;
case CowPasture.MilkType.ChocolateShake:
actor.Motives.ChangeValue(CommodityKind.Hunger, CowPasture.Milk.kChocShakeMotiveHunger);
actor.Motives.ChangeValue(CommodityKind.Fun, CowPasture.Milk.kChocShakeMotiveFun);
actor.BuffManager.AddElement(5462585249724625714uL, Origin.None);
break;
}
actor.BuffManager.RemoveElement(BuffNames.GettingWarm);
actor.BuffManager.RemoveElement(BuffNames.SweatingProfusely);
actor.BuffManager.RemoveElement(BuffNames.OnFire);
actor.Motives.SetValue(CommodityKind.Temperature, 0f);
}
public void FoodCookStateChanged(FoodCookState newState)
{
}
public void StopVFX()
{
}
public void OnRecipeUninstalled()
{
this.Destroy();
}
public bool ShouldBeThrownAway()
{
return this.FoodUnits == 0;
}
public void ThrowAwayImmediately()
{
this.Destroy();
}
public override bool StacksWith(IGameObject other)
{
CowPasture.Milk milk = other as CowPasture.Milk;
return milk != null && milk.mType == this.mType;
}
public override ThumbnailKey GetThumbnailKey()
{
if (CowPasture.Milk.mThumbnailCache[(int)this.mType] == ThumbnailKey.kInvalidThumbnailKey)
{
ThumbnailKey thumbnailKey = base.GetThumbnailKey();
thumbnailKey.mMaterialState = ResourceUtils.HashString32(this.mMaterialName);
thumbnailKey.mGeometryState = ResourceUtils.HashString32(this.mGeometryFullName);
thumbnailKey.mDescKey.GroupId = (uint)((int)thumbnailKey.mDescKey.GroupId + this.mType);
CowPasture.Milk.mThumbnailCache[(int)this.mType] = thumbnailKey;
}
return CowPasture.Milk.mThumbnailCache[(int)this.mType];
}
public override string ToTooltipString()
{
return CowPasture.LocalizeString(false, Enum.GetName(typeof(CowPasture.MilkType), this.mType), new object[0]);
}
public override Tooltip CreateTooltip(Vector2 mousePosition, WindowBase mousedOverWindow, ref Vector2 tooltipPosition)
{
return new SimpleTextTooltip(this.ToTooltipString());
}
}
[RuntimeExport]
public class TicTacBoard : GameObject
{
private string mNextGeoState;
public override void OnCreation()
{
base.OnCreation();
}
public override void OnStartup()
{
base.OnStartup();
}
public void SetNextGeoState(string next)
{
this.mNextGeoState = next;
}
public void DoNextGeoState()
{
if (this.mNextGeoState != null)
{
base.SetGeometryState(this.mNextGeoState);
this.mNextGeoState = null;
}
}
}
private const ulong kGuidCowStore_MilkShakes = 5462585249724625713uL;
private const ulong kGuidCowStore_ChocolateMilkShakes = 5462585249724625714uL;
private const ulong kGuidCowStore_MoreCowbell = 5462585249724625715uL;
private const ulong kGuidCowStore_UdderlyRediculous = 5462585249724625716uL;
private const ulong kGuidCowStore_SmarterThanCow = 5462585249724625717uL;
private const ulong kGuidCowStore_ShakenNotStirred = 5462585249724625718uL;
private const ulong kGuidCowStore_CowPieFail = 5462585249724625719uL;
private static readonly string sLocalizationKey = "Sims3.Store.Objects".Substring(6).Replace('.', '/') + "/CowPasture";
private CowPasture.Cow mCow;
private StateMachineClient mStateMachine;
private ObjectSound mPastureAudio;
private DateAndTime mLastMilked = DateAndTime.Invalid;
private DateAndTime mLastChocolate = DateAndTime.Invalid;
private DateAndTime mLastVeggies = DateAndTime.Invalid;
private DateAndTime mLastTipped = DateAndTime.Invalid;
public static List<CowPasture.MilkDrinkInfo> sMilkDrinkInfos = new List<CowPasture.MilkDrinkInfo>();
private static string LocalizeString(bool isFemale, string name, params object[] parameters)
{
return Localization.LocalizeString(isFemale, CowPasture.sLocalizationKey + ":" + name, parameters);
}
public override void OnCreation()
{
base.OnCreation();
}
public override void OnStartup()
{
base.AddInteraction(CowPasture.PastureInteractions.Singleton);
Simulator.AddObject(new OneShotFunction(new Function(this.KickstartCows)));
this.RegenerateCowIfNecessary();
if (CowPasture.sMilkDrinkInfos.Count == 0)
{
CowPasture.sMilkDrinkInfos.Add(new CowPasture.MilkDrinkInfo(CowPasture.MilkType.White, "White", "Full", "Empty", "Milk", -1));
CowPasture.sMilkDrinkInfos.Add(new CowPasture.MilkDrinkInfo(CowPasture.MilkType.Chocolate, "Chocolate", "Full", "Empty", "Chocolate", -1));
CowPasture.sMilkDrinkInfos.Add(new CowPasture.MilkDrinkInfo(CowPasture.MilkType.Soy, "Soy", "Full", "Empty", "SoyMilk", -1));
CowPasture.sMilkDrinkInfos.Add(new CowPasture.MilkDrinkInfo(CowPasture.MilkType.Shake, "Shake", "MilkshakeFull", "MilkshakeEmpty", "MilkShake", -1));
CowPasture.sMilkDrinkInfos.Add(new CowPasture.MilkDrinkInfo(CowPasture.MilkType.ChocolateShake, "ChocolateShake", "MilkshakeFull", "MilkshakeEmpty", "ChocolateShake", -1));
}
}
protected override void AddDebugInteractions(List<InteractionDefinition> debugInteractions)
{
base.AddDebugInteractions(debugInteractions);
}
public override void Dispose()
{
if (this.mPastureAudio != null)
{
this.mPastureAudio.Stop();
this.mPastureAudio.Dispose();
this.mPastureAudio = null;
}
base.Dispose();
}
private void Cleanup()
{
if (this.mStateMachine != null)
{
this.mStateMachine.Dispose();
this.mStateMachine = null;
}
if (this.mPastureAudio != null)
{
this.mPastureAudio.Stop();
this.mPastureAudio.Dispose();
this.mPastureAudio = null;
}
}
protected override void DoReset(GameObject.ResetInformation resetInformation)
{
base.DoReset(resetInformation);
this.Cleanup();
if (this.mCow != null)
{
this.mCow.UnParent();
this.mCow.Destroy();
this.mCow = null;
}
this.RegenerateCowIfNecessary();
Simulator.AddObject(new OneShotFunction(new Function(this.KickstartCows)));
}
public override bool HandToolAllowPlacementInSlot(IGameObject objectToPlaceInSlot, Slot slot, AdditionalSlotPlacementCheckResults checks)
{
return false;
}
public override void OnHandToolDeleted()
{
this.Cleanup();
base.OnHandToolDeleted();
}
public override void Destroy()
{
this.Cleanup();
base.Destroy();
}
public override void RemoveFromWorld()
{
this.Cleanup();
if (this.mCow != null)
{
this.mCow.UnParent();
this.mCow.Destroy();
this.mCow = null;
}
base.RemoveFromWorld();
}
public override void AddToWorld()
{
base.AddToWorld();
this.RegenerateCowIfNecessary();
Simulator.AddObject(new OneShotFunction(new Function(this.KickstartCows)));
}
public override void OnHandToolPlacement()
{
this.RegenerateCowIfNecessary();
Simulator.AddObject(new OneShotFunction(new Function(this.KickstartCows)));
base.OnHandToolPlacement();
}
private void KickstartCows()
{
this.AcquireStateMachine();
if (this.mStateMachine != null && Objects.IsValid(base.ObjectId))
{
this.mStateMachine.RequestState("Pasture", "PastureIdle");
}
}
private void RegenerateCowIfNecessary()
{
if ((GameStates.IsInWorld() && GameStates.GetInWorldSubState() == null) || Environment.get_HasEditInGameModeSwitch())
{
return;
}
if (base.LotCurrent != null)
{
if (this.mCow == null)
{
IGameObject gameObject = GlobalFunctions.CreateObjectOutOfWorld("accessoryCowStore", -1, "Sims3.Store.Objects.CowPasture+Cow", null);
this.mCow = (gameObject as CowPasture.Cow);
if (this.mCow == null)
{
gameObject.Destroy();
}
else
{
this.mCow.mParentPasture = base.ObjectId;
this.mCow.ParentToSlot(this, -1474234206);
}
}
if (this.mPastureAudio == null)
{
this.mPastureAudio = new ObjectSound(base.ObjectId, "cowpast_cows_lp");
}
if (this.mPastureAudio != null)
{
this.mPastureAudio.StartLoop();
}
}
}
private void AcquireStateMachine()
{
if (this.mStateMachine == null && Objects.IsValid(base.ObjectId))
{
this.mStateMachine = StateMachineClient.Acquire(base.ObjectId, "CowPasture_store");
this.mStateMachine.SetActor("Pasture", this);
this.mStateMachine.EnterState("Pasture", "PastureIdle");
}
}
}
}
I am at my PC only in the evenings for some time, so if you are so kind to help me it will be a little bit of a slow discussion
EDIT: Attached the milkbottle:package
Attached files:
acessorymilkbottle_Complete.rar (50.2 KB, 4 downloads) - View custom content | ||||||||||
----------- --------- -------- ----- -------- ----- -------- ---- I.A.... 58365 51290 87% 27-02-17 00:09 9981F3C4 acessorymilkbottle_Complete.package ----------- --------- -------- ----- -------- ----- -------- ---- 58365 51290 87% 1 |
One flap of a butterfly´s wing could change the course of weather forever (chaos theory)
#4
24th Apr 2017 at 9:53 PM
Posts: 3,856
Thanks: 8449 in 67 Posts
Ahh called for it! It seems like they are geostates:
public enum MilkType
{
White,
Chocolate,
Soy,
Shake,
ChocolateShake
}
public string mGeometryFullName;
public string mGeometryEmptyName;
So the white, chocolate, etc are basically changed (the color) By the materials/ shaders. Which sounds like a reasonable thing to do when creating stuff like that. Luckily for you, this doesn't seem to be happening in the script
the accessory.milkbottle you're reffering to, would be the original glass in this case, and would be affected by those changing materials. So, let's just say the glass is linked to the milk types.
What I would do is to follow this entire tutorial but extract the glass with S3OC: http://modthesims.info/showthread.php?t=474083
this one would be pretty interesting to check out too! http://modthesims.info/t/540902
although don't go as far as putting your milk glasses on a bunch of trees XD
public enum MilkType
{
White,
Chocolate,
Soy,
Shake,
ChocolateShake
}
public string mGeometryFullName;
public string mGeometryEmptyName;
So the white, chocolate, etc are basically changed (the color) By the materials/ shaders. Which sounds like a reasonable thing to do when creating stuff like that. Luckily for you, this doesn't seem to be happening in the script
the accessory.milkbottle you're reffering to, would be the original glass in this case, and would be affected by those changing materials. So, let's just say the glass is linked to the milk types.
What I would do is to follow this entire tutorial but extract the glass with S3OC: http://modthesims.info/showthread.php?t=474083
this one would be pretty interesting to check out too! http://modthesims.info/t/540902
although don't go as far as putting your milk glasses on a bunch of trees XD
#5
25th Apr 2017 at 10:22 PM
Last edited by Nadira : 25th Apr 2017 at 10:55 PM.
Posts: 40
Thanks: 2754 in 3 Posts
Just exactly what I thought - you make me feeling not so completely dumb - thanks a lot! :lovestruc
I had been through both tutorials already prior to my first post and had already been experimenting with adding the milktypes as recepies or ingredients but always with a failure
Sorry I did not mention this to start with, for once I tried to do a short posting (usually having a tendency to write whole novels )
I probably failed because I am completely new to this field, so I will reread everything and do some more tests.
I think one of my problems is to identify the correct hashes. accessory.milkbottle has one in the package, but I am not sure what name was hashed - really accessory.milkbottle ?? I don´t know if there is a way to decode hashes from the number to the name? I tried to hash the other milktype names to the object numbers given with DebugEnabler, but that did not work either when trying to make a new recepy.
My second problem is that there are two sections of geostates in the MLOD. I suspect the second is the one needed for the glasses, but until now had a failure there too when trying to enter them into the recepy, either related to me not correctly identifying the geostates or again to the fact that accessory.milkbottle is not the correct name for the first part of the geostate reference in the recepy file. I did not experience any game lags or even crashes, the sim simply fell out of the action before starting to walk to the fridge.
Concerning my ingredient test I had a good laugh when reading about sims eating sponges but failed to make them eat milkbottles (why not grow these on trees in simlish land of milk and honey ?). Problem is: (citation from the discussion thread) "It's important to make your CC Ingredient inherits from the default ingredient" - but when doing that the milkbottle just will behave as the default plant ingredient and looses the ability to be used as drink And additionally everything referring to the original accessory.milkbottle.OBJD will not pick up the attributes of the other milktypes (which can be tuned in the XML) and just remains white milk
So this means - ??? - scratching her head - that I have to try again to create a non edible non plantable non functional ingredient and IF that works try to use it in a custom recipy which refers to the same object and its geostates as outcome of the recipy hopefully picking up its original attributes and animations??? Getting confused Just cannot imagine how I should get that working at the moment!
But since I now know - thanks to your help - that I was not completely on the wrong track I will give it a try and do some more test. I will report in case I get any usable results but currently not having much spare time to do the testing it will take a while.
In case anyone else is doing tests of his/her own please let me know your results - I really would love to understand this tricky little problem of mine and two or more heads are usually better than one!
Greenplumbbob -I am really VERY VERY thankful for your help and - by the way - I immediately fell in love with those boots you did, all of EA´s are so ugly, and having the Sim2Bughouse back is so cute !
One flap of a butterfly´s wing could change the course of weather forever (chaos theory)
I had been through both tutorials already prior to my first post and had already been experimenting with adding the milktypes as recepies or ingredients but always with a failure
Sorry I did not mention this to start with, for once I tried to do a short posting (usually having a tendency to write whole novels )
I probably failed because I am completely new to this field, so I will reread everything and do some more tests.
I think one of my problems is to identify the correct hashes. accessory.milkbottle has one in the package, but I am not sure what name was hashed - really accessory.milkbottle ?? I don´t know if there is a way to decode hashes from the number to the name? I tried to hash the other milktype names to the object numbers given with DebugEnabler, but that did not work either when trying to make a new recepy.
My second problem is that there are two sections of geostates in the MLOD. I suspect the second is the one needed for the glasses, but until now had a failure there too when trying to enter them into the recepy, either related to me not correctly identifying the geostates or again to the fact that accessory.milkbottle is not the correct name for the first part of the geostate reference in the recepy file. I did not experience any game lags or even crashes, the sim simply fell out of the action before starting to walk to the fridge.
Concerning my ingredient test I had a good laugh when reading about sims eating sponges but failed to make them eat milkbottles (why not grow these on trees in simlish land of milk and honey ?). Problem is: (citation from the discussion thread) "It's important to make your CC Ingredient inherits from the default ingredient" - but when doing that the milkbottle just will behave as the default plant ingredient and looses the ability to be used as drink And additionally everything referring to the original accessory.milkbottle.OBJD will not pick up the attributes of the other milktypes (which can be tuned in the XML) and just remains white milk
So this means - ??? - scratching her head - that I have to try again to create a non edible non plantable non functional ingredient and IF that works try to use it in a custom recipy which refers to the same object and its geostates as outcome of the recipy hopefully picking up its original attributes and animations??? Getting confused Just cannot imagine how I should get that working at the moment!
But since I now know - thanks to your help - that I was not completely on the wrong track I will give it a try and do some more test. I will report in case I get any usable results but currently not having much spare time to do the testing it will take a while.
In case anyone else is doing tests of his/her own please let me know your results - I really would love to understand this tricky little problem of mine and two or more heads are usually better than one!
Greenplumbbob -I am really VERY VERY thankful for your help and - by the way - I immediately fell in love with those boots you did, all of EA´s are so ugly, and having the Sim2Bughouse back is so cute !
One flap of a butterfly´s wing could change the course of weather forever (chaos theory)
#6
26th Apr 2017 at 12:11 PM
Posts: 3,856
Thanks: 8449 in 67 Posts
lol well you're not the only one writing entire novels when trying to explain them, I do the same so I don't mind reading them either I guess that's also required when reading mod downloads.
I think I will go over the tutorial again, see if there's somehow a way to skip the ingredient thing. I think I do need to take a look at noma's edible food tutorial as well, if not, see if there's some way to get the drinking option or at least making it possible with a script. So I'll take a look at it as well. I only know how to make custom foods and stuff though so it's always fun to discover something else
Unless our great script modders on here sees this thread
And thanks! I really appreciate it! ^-^ I really should go back to meshing stuff though! I love doing conversions but I guess I should also turn some of my non-sims related meshes to the sims. And maybe give interactionable (if that's even a word lol) a try as well
I think I will go over the tutorial again, see if there's somehow a way to skip the ingredient thing. I think I do need to take a look at noma's edible food tutorial as well, if not, see if there's some way to get the drinking option or at least making it possible with a script. So I'll take a look at it as well. I only know how to make custom foods and stuff though so it's always fun to discover something else
Unless our great script modders on here sees this thread
And thanks! I really appreciate it! ^-^ I really should go back to meshing stuff though! I love doing conversions but I guess I should also turn some of my non-sims related meshes to the sims. And maybe give interactionable (if that's even a word lol) a try as well
Who Posted
|