Instantiator class not being instantiated/run?
I'm trying to add some custom moodlets, based off of this template: :
https://github.com/Cilyan/sims3-moodlet-template
So far I haven't been able to get the custom moodlets I'm trying to add to load.
As a starting point, I've added some test code into the OnWorldLoaded function that, as per my understanding, would just add the phone addict moodlet to everyone in the household, and then added OnWorldLoaded into World.sOnWorldLoadFinishedEventHandler. I'm not seeing the phone addict moodlet getting added either. I am using the nraas unprotected DLLs and changed the code in the template for the world load finished event handler as per
https://www.nraas.net/community/chatterbox/topic2652 .
Just wondering if anyone has any input on what I'm doing wrong. I suspect I've got an XML file named incorrectly or otherwise set up wrong in my package file, and that the bootloader class is never getting instantiated in the first place
Tuning XML, named HamBadger.ExpandedWishMoodlets.Bootloader in the package file:
Code:
<?xml version="1.0" encoding="utf-8"?>
<base>
<Current_Tuning>
<kInstantiator value="True" />
</Current_Tuning>
</base>
AssemblyInfo.cs:
Code:
using System.Reflection;
using System.Runtime.CompilerServices;
using Sims3.SimIFace;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("HamBadger.ExpandedWishMoodlets")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("GPL")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: Tunable]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
Bootstrap.cs:
Code:
using Sims3.Gameplay.ActorSystems;
using Sims3.Gameplay.Actors;
using Sims3.Gameplay.Utilities;
using Sims3.SimIFace;
using Sims3.UI;
using System;
using Sims3.Gameplay.EventSystem;
using System.Reflection;
namespace HamBadger.ExpandedWishMoodlets
{
internal class BuffBooter
{
public void LoadBuffData()
{
this.AddBuffs(null);
UIManager.NewHotInstallStoreBuffData += new UIManager.NewHotInstallStoreBuffCallback(this.AddBuffs);
}
public void AddBuffs(ResourceKey[] resourceKeys)
{
try
{
ResourceKey key = new ResourceKey(ResourceUtils.HashString64("HamBadger.ExpandedWishMoodlets.Buffs"), 0x0333406C, 0x0);
XmlDbData xmlDbData = XmlDbData.ReadData(key, false);
if (xmlDbData != null)
{
BuffManager.ParseBuffData(xmlDbData, true);
}
}
catch
{
}
}
}
public static class Bootloader
{
[Tunable]
internal static bool kInstantiator = false;
static Bootloader()
{
LoadSaveManager.ObjectGroupsPreLoad += OnPreLoad;
World.sOnWorldLoadFinishedEventHandler += OnWorldLoaded;
}
private static void OnPreLoad()
{
new BuffBooter().LoadBuffData();
}
private static void OnWorldLoaded(object sender, System.EventArgs e)
{
// This is test code -- I just want to see if it actually adds an already existing moodlet.
foreach (Sim sim in Sims3.Gameplay.Queries.GetObjects<Sim>())
{
if (sim != null && sim.IsInActiveHousehold)
{
sim.BuffManager.AddElement(BuffNames.PhoneJunkie, Origin.None);
}
}
}
}
}