Custom interaction not showing up
I'm completely new to coding and modding the Sims 3. I'm trying to create a custom interaction where a sim can tell a dog "Good Dog". It is only for a human sim to tell a dog. It is not showing up in game. How can I fix this? What is wrong with the code? Thanks!
using System;
using System.Collections.Generic;
using System.Text;
using Sims3.SimIFace;
using Sims3.Gameplay.Actors;
using Sims3.Gameplay.Interactions;
using Sims3.Gameplay.Autonomy;
using Sims3.Gameplay.EventSystem;
namespace esorsims3_good_dog_interaction
{
public class Good_dog
{
[Tunable]
protected static bool kInstantiator = false;
static Good_dog()
{
World.OnFinishedLoadingWorldFileEventHandler += new EventHandler(OnWorldLoadFinishedHandler);
}
private static void OnWorldLoadFinishedHandler(object sender, EventArgs e)
{
foreach (Sim sim in Sims3.Gameplay.Queries.GetObjects<Sim>())
{
if(sim!= null)
{
AddInteractions(sim);
}
}
}
private static void AddInteractions(Sim sim)
{
sim.AddInteraction(GoodDogInteraction.Singleton, true);
}
public class GoodDogInteraction : ImmediateInteraction<Sim,Sim>
{
public static readonly InteractionDefinition Singleton = new Definition();
protected override bool Run()
{
Actor.RouteTurnToFace(Target.Position);
Actor.PlaySoloAnimation("a2ad_soc_dogTricks_praise_x");
return true;
}
public class Definition : ImmediateInteractionDefinition<Sim, Sim, GoodDogInteraction>
{
protected override string GetInteractionName(Sim actor, Sim target, InteractionObjectPair iop)
{
return "Good Dog";
}
protected override bool Test(Sim actor, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
{
if (actor.SimDescription.ChildOrAbove)
{
if (target.IsADogSpecies)
{
return true;
}
}
return false;
}
}
}
}
}