- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Arrest Mod
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Arrest Mod
Posts: 433
Thanks: 792 in 6 Posts
using System; using Sims3.Gameplay.Utilities; using Sims3.SimIFace; using Sims3.Gameplay.ActiveCareer.ActiveCareers; using Sims3.Gameplay.Abstracts; using Sims3.Gameplay.Situations; using Sims3.Gameplay.EventSystem; using Sims3.Gameplay.Autonomy; using Sims3.Gameplay.Actors; using Sims3.Gameplay.ActorSystems; using Sims3.Gameplay.Interactions; using Sims3.Gameplay.Core; using Sims3.Gameplay.Socializing; using Sims3.Gameplay.Opportunities; using Sims3.Gameplay.Skills; using Sims3.Gameplay.Interfaces; using System.Collections.Generic; using Sims3.Gameplay.Objects.Vehicles; using Sims3.Gameplay.CAS; using Sims3.Gameplay.Services; using Sims3.SimIFace.CAS; using Sims3.UI; namespace Jadaytime { public class BreakIntoHouse : Interaction<Sim, Lot>, IPreventSocialization { [Tunable] public static bool kInstantiator = false; // value and type aren't important static BreakIntoHouse() { World.OnWorldLoadFinishedEventHandler += new EventHandler(BreakIntoHouse.SomeEventHandler); } static void AddInteractions(Lot lot) { foreach (InteractionObjectPair pair in lot.Interactions) { if (pair.InteractionDefinition.GetType() == BreakIntoHouse.Singleton.GetType()) { return; } } lot.AddInteraction(BreakIntoHouse.Singleton); } public static void SomeEventHandler(object sender, EventArgs e) { foreach (Lot lot in Sims3.Gameplay.Queries.GetObjects<Lot>()) { AddInteractions(lot); } // implement initialization code here } private static ReactionBroadcasterParams kBreakIntoHouseBroadcastParams = new ReactionBroadcasterParams(); private static readonly ulong kIconNameHash = ResourceUtils.HashString64("hud_interactions_ringbell"); [Tunable, TunableComment("Multiplier on how long it takes to pick a lock per Logic level")] private static float[] kPickLockTimeMultiplierPerLogicLevel = new float[] { 1.5f, 1.4f, 1.3f, 1.2f, 1.1f, 1f, 0.9f, 0.8f, 0.7f, 0.6f, 0.5f }; [Tunable, TunableComment("Time to pick a lock in sim minutes")] private static float kTimeToPickLock = 30f; private ReactionBroadcaster mBreakIntoHouseBroadcast; private Door mDoor; public static readonly InteractionDefinition Singleton = new Definition(); private const string sLocalizationKey = "Gameplay/Core/SneakIntoHouse"; private void BreakIntoHouseBroadcasterCreate() { Sims3.UI.StyledNotification.Show(new Sims3.UI.StyledNotification.Format("BreakIntoHouseBroadcasterCreate", Sims3.UI.StyledNotification.NotificationStyle.kGameMessagePositive)); this.mBreakIntoHouseBroadcast = new ReactionBroadcaster(base.Actor, kBreakIntoHouseBroadcastParams, new ReactionBroadcaster.BroadcastCallback(Jadaytime.BreakIntoHouse.BreakIntoHouseReactionCallback)); } private void BreakIntoHouseBroadcasterDestroy() { if (this.mBreakIntoHouseBroadcast != null) { this.mBreakIntoHouseBroadcast.Dispose(); this.mBreakIntoHouseBroadcast = null; } } private static void BreakIntoHouseReactionCallback(Sim s, ReactionBroadcaster rb) { if (!s.InteractionQueue.HasInteractionOfType(PrivateEyeInteractions.PrivateEyeCaught.Singleton)) { Sims3.UI.StyledNotification.Show(new Sims3.UI.StyledNotification.Format("BreakIntoHouseReactionCallback", Sims3.UI.StyledNotification.NotificationStyle.kGameMessagePositive)); Sim broadcastingObject = rb.BroadcastingObject as Sim; if (broadcastingObject != null) { InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstance(broadcastingObject, s, new InteractionPriority(InteractionPriorityLevel.High), false, true); s.InteractionQueue.AddNext(entry); } } } InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstanceWithCallbacks(s, s, new InteractionPriority(InteractionPriorityLevel.High), false, false, null, new Callback(Arrest), null); public static IActor s; private static void Arrest(Sim s, float x) { throw new NotImplementedException(); } public class ArrestSuspectSituation : RootSituation { // Fields private const InteractionPriorityLevel Priority = InteractionPriorityLevel.CriticalNPCBehavior; private static List<string> SimsBeingArrested = new List<string>(); public Lot ArrestLocation; public Sim Cop; public CarService CopCar; public RabbitHole SimsLocation; public Sim SimToArrest; public IPoliceStation Station; // Methods private ArrestSuspectSituation() { } private ArrestSuspectSituation(Lot lot, Sim simToArrest) : base(lot) { lock (SimsBeingArrested) { if (SimsBeingArrested.Contains(simToArrest.Name)) { base.Exit(); } else { SimsBeingArrested.Add(simToArrest.Name); this.SimToArrest = simToArrest; this.ArrestLocation = lot; this.SimsLocation = RabbitHole.GetRandomRabbitHoleOfType(RabbitHoleType.PoliceStation); base.SetState(new CreateCopAndRoute(this)); } } } internal void CancelArrest() { this.SimToArrest.InteractionQueue.CancelAllInteractions(); for (int i = 0; i < 20; i++) { Simulator.Sleep(10); if (!this.SimToArrest.CurrentInteraction.CancellableByPlayer) { this.SimToArrest.InteractionQueue.CancelAllInteractions(); } } } public static ArrestSuspectSituation Create(Lot lot, Sim simToArrest) { return new ArrestSuspectSituation(lot, simToArrest); } private SimDescription CreateNewCopFromPool() { List<SimDescription> randomList = new List<SimDescription>(); Police instance = Police.Instance; if (instance != null) { foreach (SimDescription description in instance.Pool) { if (!Police.Instance.IsServiceAssigned(description)) { randomList.Add(description); } } } return ((randomList.Count <= 0) ? null : RandomUtil.GetRandomObjectFromList<SimDescription>(randomList)); } public override void Dispose() { if (this.SimToArrest != null) { lock (SimsBeingArrested) { if (SimsBeingArrested.Contains(this.SimToArrest.Name)) { SimsBeingArrested.Remove(this.SimToArrest.Name); } } } if (this.CopCar != null) { this.CopCar.Destroy(); this.CopCar = null; } base.Dispose(); } public override void OnParticipantDeleted(Sim participant) { if (ReferenceEquals(participant, this.Cop) || ReferenceEquals(participant, this.SimToArrest)) { base.Exit(); } } // Nested Types private class ArrestSimInRabbitHole : RabbitHole.ArrestSimInRabbitHole { // Methods public override bool InRabbitHole() { base.StartStages(); base.BeginCommodityUpdates(); base.DoLoop(~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); base.EndCommodityUpdates(true); return true; } } private class CreateCopAndRoute : ChildSituation<ArrestSuspectSituation> { // Methods protected CreateCopAndRoute() { } public CreateCopAndRoute(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { IPoliceStation randomRabbitHoleOfType = (IPoliceStation)RabbitHole.GetRandomRabbitHoleOfType(RabbitHoleType.PoliceStation); if (randomRabbitHoleOfType == null) { base.Exit(); } else { parent.Station = randomRabbitHoleOfType; } SimDescription description = parent.CreateNewCopFromPool(); if (description == null) { base.Exit(); } else { if (description.CreatedSim != null) { parent.Cop = description.CreatedSim; parent.Cop.SwitchToOutfitWithoutSpin(OutfitCategories.Career); } else { SimOutfit outfit = description.GetOutfit(OutfitCategories.Career, 0); parent.Cop = (outfit != null) ? description.Instantiate(Vector3.OutOfWorld, outfit.Key) : description.Instantiate(Vector3.OutOfWorld); } parent.CopCar = CarNpcManager.Singleton.CreateServiceCar(ServiceType.None | ServiceType.Police); base.ForceSituationSpecificInteraction(parent.Cop, parent.Cop, new ArrestSuspectSituation.GoToCulpritsLocation.Definition(base.Parent), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.MakeArrest(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Exit(); } } private class GetCulpritInCar : ChildSituation<ArrestSuspectSituation> { // Methods protected GetCulpritInCar() { } public GetCulpritInCar(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { Sim simToArrest = parent.SimToArrest; Sim cop = parent.Cop; CarService copCar = parent.CopCar; base.ForceSituationSpecificInteraction(base.Parent.CopCar, base.Parent.Cop, new ArrestSuspectSituation.GetInPoliceCar.Definition(base.Parent), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.ThrowInJail(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Parent.CancelArrest(); base.Exit(); } } public sealed class GetInPoliceCar : Interaction<Sim, IGameObject> { // Fields public static readonly InteractionDefinition Singleton = new Definition(); // Methods public override void ConfigureInteraction() { base.CancellableByPlayer = false; } public override bool Run() { ArrestSuspectSituation arrestSituation = (base.InteractionDefinition as Definition).ArrestSituation; CarService copCar = arrestSituation.CopCar; Sim simToArrest = arrestSituation.SimToArrest; if (base.Actor != simToArrest) { copCar.RouteToAndGetIn(arrestSituation.Cop, true); CarNpcManager.Singleton.DriveToLotInCar(copCar, arrestSituation.Cop, arrestSituation.Station.LotCurrent, false); } else { copCar.RouteToAndGetIn(simToArrest, false); InteractionInstance instance = PoliceSituation.Wait.Singleton.CreateInstance(simToArrest, simToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); simToArrest.InteractionQueue.PushAsContinuation(instance, true); } return true; } // Nested Types [DoesntRequireTuning] public sealed class Definition : InteractionDefinition<Sim, IGameObject, ArrestSuspectSituation.GetInPoliceCar> { // Fields public ArrestSuspectSituation ArrestSituation; // Methods public Definition() { } public Definition(ArrestSuspectSituation situation) { this.ArrestSituation = situation; } public override string GetInteractionName(Sim a, IGameObject target, InteractionObjectPair interaction) { return Localization.LocalizeString(a.IsFemale, "Gameplay/Objects/RabbitHoles/PoliceStation/GoToJail:InteractionName", new object[0]); } public override bool Test(Sim a, IGameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { return true; } } } public sealed class GoToCulpritsLocation : Interaction<Sim, IGameObject> { // Fields public static readonly InteractionDefinition Singleton = new Definition(); // Methods public override bool Run() { Definition interactionDefinition = base.InteractionDefinition as Definition; Sim cop = interactionDefinition.arrestSituation.Cop; CarService copCar = interactionDefinition.arrestSituation.CopCar; Lot arrestLocation = interactionDefinition.arrestSituation.ArrestLocation; if ((copCar == null) || !CarNpcManager.Singleton.DriveToLotInServiceCarWithinTime(copCar, cop, arrestLocation, 10f, true)) { return false; } copCar.GetOut(cop); return true; } // Nested Types [DoesntRequireTuning] public sealed class Definition : InteractionDefinition<Sim, IGameObject, ArrestSuspectSituation.GoToCulpritsLocation> { // Fields public ArrestSuspectSituation arrestSituation; // Methods public Definition() { } public Definition(ArrestSuspectSituation situation) { this.arrestSituation = situation; } public override string GetInteractionName(Sim a, IGameObject target, InteractionObjectPair interaction) { return "PickUpCulprit"; } public override bool Test(Sim a, IGameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { return true; } } } private class MakeArrest : ChildSituation<ArrestSuspectSituation> { // Fields public ArrestSuspectSituation arrestSituation; // Methods public MakeArrest() { } public MakeArrest(ArrestSuspectSituation parent) : base(parent) { this.arrestSituation = parent; } public void ArrestFailure(Sim actor, float x) { base.UnrequestWalkStyle(actor, Sim.WalkStyle.Run); base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } public void ArrestFinished(Sim actor, float x) { InteractionInstance entry = new ArrestSuspectSituation.GetInPoliceCar.Definition(this.arrestSituation).CreateInstance(this.arrestSituation.CopCar, this.arrestSituation.SimToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); this.arrestSituation.SimToArrest.InteractionQueue.Add(entry); while (((this.arrestSituation.SimToArrest.GetDistanceToObject(this.arrestSituation.CopCar) + 3f) >= this.arrestSituation.Cop.GetDistanceToObject(this.arrestSituation.CopCar)) && !(this.arrestSituation.SimToArrest.Posture is SittingInVehicle)) { Simulator.Sleep(30); } base.UnrequestWalkStyle(actor, Sim.WalkStyle.Run); base.Parent.SetState(new ArrestSuspectSituation.GetCulpritInCar(base.Parent)); } public override void CleanUp() { base.UnrequestWalkStyle(base.Parent.Cop, Sim.WalkStyle.Run); base.CleanUp(); } public override void Init(ArrestSuspectSituation parent) { if (base.Parent.SimToArrest == null) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } else { base.RequestWalkStyle(parent.Cop, Sim.WalkStyle.Run); SituationSocial.Definition i = new SituationSocial.Definition("Policeman Express Disappointment", new string[0], null, false); InteractionInstance instance = base.ForceSituationSpecificInteraction(parent.SimToArrest, parent.Cop, i, null, new Callback(this.ArrestFinished), new Callback(this.ArrestFailure), InteractionPriorityLevel.CriticalNPCBehavior); if (instance != null) { instance.CancellableByPlayer = false; } } } } private class RideOffIntoTheSunset : ChildSituation<ArrestSuspectSituation> { // Methods protected RideOffIntoTheSunset() { } public RideOffIntoTheSunset(ArrestSuspectSituation parent) : base(parent) { } private void ExitSituation(Sim actor, float x) { base.Exit(); } public override void Init(ArrestSuspectSituation parent) { base.ForceSituationSpecificInteraction(base.Parent.Lot, base.Parent.Cop, new DriveAwayInServiceCar.Definition(base.Parent.CopCar), null, new Callback(this.ExitSituation), new Callback(this.ExitSituation)); } } private class ThrowInJail : ChildSituation<ArrestSuspectSituation> { // Methods protected ThrowInJail() { } public ThrowInJail(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { Sim simToArrest = parent.SimToArrest; Sim cop = parent.Cop; CarService copCar = parent.CopCar; IPoliceStation target = parent.Station; InteractionInstance entry = target.GetGoToJailDefinition().CreateInstance(target, simToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); simToArrest.AddExitReason(ExitReason.CanceledByScript); simToArrest.InteractionQueue.AddNext(entry); copCar.GetOut(cop); base.ForceSituationSpecificInteraction(target, cop, new RabbitHole.ArrestSimInRabbitHole.Definition(), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); base.Parent.CancelArrest(); } } } public static bool CheckOpportunitiesForLot(Sim actor, ulong targetId) { return true; } public override void Cleanup() { if (this.mDoor != null) { this.mDoor.SetLockType(CommonDoor.tLock.Anybody); this.mDoor = null; } this.BreakIntoHouseBroadcasterDestroy(); base.Cleanup(); } public override ThumbnailKey GetIconKey() { return new ThumbnailKey(new ResourceKey(kIconNameHash, 0x2f7d0004, 0), ThumbnailSize.Medium); } public string GreyedOutTooltipText(Sim simA, Sim simB) { string entryKey = "Gameplay/Socializing/SocialInteractionA:CannotSocializeAtWork"; return Localization.LocalizeString(simB.IsFemale, entryKey, new object[] { simB.SimDescription }); } private static string LocalizeString(string name, params object[] parameters) { return Localization.LocalizeString("Gameplay/Core/SneakIntoHouse:" + name, parameters); } public override bool Run() { bool succeeded = false; bool flag2 = false; PrivateEye.SwitchToWorkOutfit(base.Actor); if (base.Actor.LotCurrent != base.Target) { Route route = base.Actor.CreateRoute(); if (base.Target.PlanToLotEx(route).Succeeded()) { succeeded = base.Actor.DoRoute(route); flag2 = base.Actor.LotCurrent == base.Target; } } else { flag2 = true; } if (flag2) { Slot slot; int index = MathUtils.Clamp(base.Actor.SkillManager.GetSkillLevel(SkillNames.Logic), 0, 10); this.mDoor = base.Target.FindFrontDoor(); if (!base.Actor.RouteToSlotListAndCheckInUse(this.mDoor, new Slot[] { Door.RoutingSlots.Upgrade_Front, Door.RoutingSlots.Upgrade_Rear }, out slot)) { return false; } this.mDoor.SetLockType(CommonDoor.tLock.Nobody); float duration = (kTimeToPickLock * kPickLockTimeMultiplierPerLogicLevel[index]); base.StandardEntry(); base.BeginCommodityUpdates(); base.EnterStateMachine("PrivateEyeBreakIntoHome", "Enter", "x"); bool paramValue = slot == Door.RoutingSlots.Upgrade_Front; if (this.mDoor is DoorDouble) { paramValue = true; } base.mCurrentStateMachine.SetParameter("usingFrontSlot", paramValue); base.SetActor("Door", this.mDoor); base.AnimateSim("BreakInto"); this.BreakIntoHouseBroadcasterCreate(); succeeded = base.DoTimedLoop(duration); this.BreakIntoHouseBroadcasterDestroy(); base.AnimateSim("Exit"); if (succeeded) { this.SimArrivedAtLot(); Sim.RemoveGoHomeInteractions(base.Actor, false); } base.EndCommodityUpdates(succeeded); base.StandardExit(); } return succeeded; } protected void SimArrivedAtLot() { base.Actor.GreetSimOnLot(base.Target); SneakOntoLotSituation.Create(base.Actor, base.Target, SneakOntoLotSituation.SneakType.WithBroadcaster); EventTracker.SendEvent(EventTypeId.kVisitLot, base.Actor, base.Target); } public bool SocializationAllowed(Sim simA, Sim simB) { return false; } // Nested Types public class Definition : InteractionDefinition<Sim, Lot, Jadaytime.BreakIntoHouse> { // Fields public bool bRingDoorbell = true; // Methods public static bool CanBreakIntoHouse(Sim actor, ulong targetId) { if (actor.HasTrait(TraitNames.Good)) { return false; } return true; } public override string GetInteractionName(Sim actor, Lot target, InteractionObjectPair iop) { return Jadaytime.BreakIntoHouse.LocalizeString("BreakIntoHouse", new object[0]); } public override bool Test(Sim actor, Lot target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (isAutonomous) { return false; } if (target.IsCommunityLot) { return false; } if (actor.IsGreetedOnLot(target)) { return false; } if (!CanBreakIntoHouse(actor, target.LotId)) { return false; } return true; } } } }
Posts: 195
Thanks: 2012 in 7 Posts
try this
Code:
using System; using Sims3.Gameplay.Utilities; using Sims3.SimIFace; using Sims3.Gameplay.ActiveCareer.ActiveCareers; using Sims3.Gameplay.Abstracts; using Sims3.Gameplay.Situations; using Sims3.Gameplay.EventSystem; using Sims3.Gameplay.Autonomy; using Sims3.Gameplay.Actors; using Sims3.Gameplay.ActorSystems; using Sims3.Gameplay.Interactions; using Sims3.Gameplay.Core; using Sims3.Gameplay.Socializing; using Sims3.Gameplay.Opportunities; using Sims3.Gameplay.Skills; using Sims3.Gameplay.Interfaces; using System.Collections.Generic; using Sims3.Gameplay.Objects.Vehicles; using Sims3.Gameplay.CAS; using Sims3.Gameplay.Services; using Sims3.SimIFace.CAS; using Sims3.UI; namespace Jadaytime { public class BreakIntoHouse : Interaction<Sim, Lot>, IPreventSocialization { [Tunable] public static bool kInstantiator = false; // value and type aren't important static BreakIntoHouse() { World.OnWorldLoadFinishedEventHandler += new EventHandler(BreakIntoHouse.SomeEventHandler); } static void AddInteractions(Lot lot) { foreach (InteractionObjectPair pair in lot.Interactions) { if (pair.InteractionDefinition.GetType() == BreakIntoHouse.Singleton.GetType()) { return; } } lot.AddInteraction(BreakIntoHouse.Singleton); } public static void SomeEventHandler(object sender, EventArgs e) { foreach (Lot lot in Sims3.Gameplay.Queries.GetObjects<Lot>()) { AddInteractions(lot); } // implement initialization code here } private static ReactionBroadcasterParams kBreakIntoHouseBroadcastParams = new ReactionBroadcasterParams(); private static readonly ulong kIconNameHash = ResourceUtils.HashString64("hud_interactions_ringbell"); [Tunable, TunableComment("Multiplier on how long it takes to pick a lock per Logic level")] private static float[] kPickLockTimeMultiplierPerLogicLevel = new float[] { 1.5f, 1.4f, 1.3f, 1.2f, 1.1f, 1f, 0.9f, 0.8f, 0.7f, 0.6f, 0.5f }; [Tunable, TunableComment("Time to pick a lock in sim minutes")] private static float kTimeToPickLock = 30f; private ReactionBroadcaster mBreakIntoHouseBroadcast; private Door mDoor; public static readonly InteractionDefinition Singleton = new Definition(); private const string sLocalizationKey = "Gameplay/Core/SneakIntoHouse"; private void BreakIntoHouseBroadcasterCreate() { Sims3.UI.StyledNotification.Show(new Sims3.UI.StyledNotification.Format("BreakIntoHouseBroadcasterCreate", Sims3.UI.StyledNotification.NotificationStyle.kGameMessagePositive)); this.mBreakIntoHouseBroadcast = new ReactionBroadcaster(base.Actor, kBreakIntoHouseBroadcastParams, new ReactionBroadcaster.BroadcastCallback(Jadaytime.BreakIntoHouse.BreakIntoHouseReactionCallback)); } private void BreakIntoHouseBroadcasterDestroy() { if (this.mBreakIntoHouseBroadcast != null) { this.mBreakIntoHouseBroadcast.Dispose(); this.mBreakIntoHouseBroadcast = null; } } private static void BreakIntoHouseReactionCallback(Sim s, ReactionBroadcaster rb) { if (!s.InteractionQueue.HasInteractionOfType(PrivateEyeInteractions.PrivateEyeCaught.Singleton)) { Sims3.UI.StyledNotification.Show(new Sims3.UI.StyledNotification.Format("BreakIntoHouseReactionCallback", Sims3.UI.StyledNotification.NotificationStyle.kGameMessagePositive)); Sim broadcastingObject = rb.BroadcastingObject as Sim; if (broadcastingObject != null) { InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstance(broadcastingObject, s, new InteractionPriority(InteractionPriorityLevel.High), false, true); s.InteractionQueue.AddNext(entry); } } } InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstanceWithCallbacks(s, s, new InteractionPriority(InteractionPriorityLevel.High), false, false, null, new Callback(Arrest), null); public static IActor s; private static void Arrest(Sim s, float x) { throw new NotImplementedException(); } public class ArrestSuspectSituation : RootSituation { // Fields private const InteractionPriorityLevel Priority = InteractionPriorityLevel.CriticalNPCBehavior; private static List<string> SimsBeingArrested = new List<string>(); public Lot ArrestLocation; public Sim Cop; public CarService CopCar; public RabbitHole SimsLocation; public Sim SimToArrest; public IPoliceStation Station; // Methods private ArrestSuspectSituation() { } private ArrestSuspectSituation(Lot lot, Sim simToArrest) : base(lot) { lock (SimsBeingArrested) { if (SimsBeingArrested.Contains(simToArrest.Name)) { base.Exit(); } else { SimsBeingArrested.Add(simToArrest.Name); this.SimToArrest = simToArrest; this.ArrestLocation = lot; this.SimsLocation = RabbitHole.GetRandomRabbitHoleOfType(RabbitHoleType.PoliceStation); base.SetState(new CreateCopAndRoute(this)); } } } internal void CancelArrest() { this.SimToArrest.InteractionQueue.CancelAllInteractions(); for (int i = 0; i < 20; i++) { Simulator.Sleep(10); if (!this.SimToArrest.CurrentInteraction.CancellableByPlayer) { this.SimToArrest.InteractionQueue.CancelAllInteractions(); } } } public static ArrestSuspectSituation Create(Lot lot, Sim simToArrest) { return new ArrestSuspectSituation(lot, simToArrest); } private SimDescription CreateNewCopFromPool() { List<SimDescription> randomList = new List<SimDescription>(); Police instance = Police.Instance; if (instance != null) { foreach (SimDescription description in instance.Pool) { if (!Police.Instance.IsServiceAssigned(description)) { randomList.Add(description); } } } return ((randomList.Count <= 0) ? null : RandomUtil.GetRandomObjectFromList<SimDescription>(randomList)); } public override void Dispose() { if (this.SimToArrest != null) { lock (SimsBeingArrested) { if (SimsBeingArrested.Contains(this.SimToArrest.Name)) { SimsBeingArrested.Remove(this.SimToArrest.Name); } } } if (this.CopCar != null) { this.CopCar.Destroy(); this.CopCar = null; } base.Dispose(); } public override void OnParticipantDeleted(Sim participant) { if (ReferenceEquals(participant, this.Cop) || ReferenceEquals(participant, this.SimToArrest)) { base.Exit(); } } // Nested Types private class ArrestSimInRabbitHole : RabbitHole.ArrestSimInRabbitHole { // Methods public override bool InRabbitHole() { base.StartStages(); base.BeginCommodityUpdates(); base.DoLoop(~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); base.EndCommodityUpdates(true); return true; } } private class CreateCopAndRoute : ChildSituation<ArrestSuspectSituation> { // Methods protected CreateCopAndRoute() { } public CreateCopAndRoute(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { IPoliceStation randomRabbitHoleOfType = (IPoliceStation)RabbitHole.GetRandomRabbitHoleOfType(RabbitHoleType.PoliceStation); if (randomRabbitHoleOfType == null) { base.Exit(); } else { parent.Station = randomRabbitHoleOfType; } SimDescription description = parent.CreateNewCopFromPool(); if (description == null) { base.Exit(); } else { if (description.CreatedSim != null) { parent.Cop = description.CreatedSim; parent.Cop.SwitchToOutfitWithoutSpin(OutfitCategories.Career); } else { SimOutfit outfit = description.GetOutfit(OutfitCategories.Career, 0); parent.Cop = (outfit != null) ? description.Instantiate(Vector3.OutOfWorld, outfit.Key) : description.Instantiate(Vector3.OutOfWorld); } parent.CopCar = CarNpcManager.Singleton.CreateServiceCar(ServiceType.None | ServiceType.Police); base.ForceSituationSpecificInteraction(parent.Cop, parent.Cop, new ArrestSuspectSituation.GoToCulpritsLocation.Definition(base.Parent), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.MakeArrest(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Exit(); } } private class GetCulpritInCar : ChildSituation<ArrestSuspectSituation> { // Methods protected GetCulpritInCar() { } public GetCulpritInCar(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { Sim simToArrest = parent.SimToArrest; Sim cop = parent.Cop; CarService copCar = parent.CopCar; base.ForceSituationSpecificInteraction(base.Parent.CopCar, base.Parent.Cop, new ArrestSuspectSituation.GetInPoliceCar.Definition(base.Parent), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.ThrowInJail(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Parent.CancelArrest(); base.Exit(); } } public sealed class GetInPoliceCar : Interaction<Sim, IGameObject> { // Fields public static readonly InteractionDefinition Singleton = new Definition(); // Methods public override void ConfigureInteraction() { base.CancellableByPlayer = false; } public override bool Run() { ArrestSuspectSituation arrestSituation = (base.InteractionDefinition as Definition).ArrestSituation; CarService copCar = arrestSituation.CopCar; Sim simToArrest = arrestSituation.SimToArrest; if (base.Actor != simToArrest) { copCar.RouteToAndGetIn(arrestSituation.Cop, true); CarNpcManager.Singleton.DriveToLotInCar(copCar, arrestSituation.Cop, arrestSituation.Station.LotCurrent, false); } else { copCar.RouteToAndGetIn(simToArrest, false); InteractionInstance instance = PoliceSituation.Wait.Singleton.CreateInstance(simToArrest, simToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); simToArrest.InteractionQueue.PushAsContinuation(instance, true); } return true; } // Nested Types [DoesntRequireTuning] public sealed class Definition : InteractionDefinition<Sim, IGameObject, ArrestSuspectSituation.GetInPoliceCar> { // Fields public ArrestSuspectSituation ArrestSituation; // Methods public Definition() { } public Definition(ArrestSuspectSituation situation) { this.ArrestSituation = situation; } public override string GetInteractionName(Sim a, IGameObject target, InteractionObjectPair interaction) { return Localization.LocalizeString(a.IsFemale, "Gameplay/Objects/RabbitHoles/PoliceStation/GoToJail:InteractionName", new object[0]); } public override bool Test(Sim a, IGameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { return true; } } } public sealed class GoToCulpritsLocation : Interaction<Sim, IGameObject> { // Fields public static readonly InteractionDefinition Singleton = new Definition(); // Methods public override bool Run() { Definition interactionDefinition = base.InteractionDefinition as Definition; Sim cop = interactionDefinition.arrestSituation.Cop; CarService copCar = interactionDefinition.arrestSituation.CopCar; Lot arrestLocation = interactionDefinition.arrestSituation.ArrestLocation; if ((copCar == null) || !CarNpcManager.Singleton.DriveToLotInServiceCarWithinTime(copCar, cop, arrestLocation, 10f, true)) { return false; } copCar.GetOut(cop); return true; } // Nested Types [DoesntRequireTuning] public sealed class Definition : InteractionDefinition<Sim, IGameObject, ArrestSuspectSituation.GoToCulpritsLocation> { // Fields public ArrestSuspectSituation arrestSituation; // Methods public Definition() { } public Definition(ArrestSuspectSituation situation) { this.arrestSituation = situation; } public override string GetInteractionName(Sim a, IGameObject target, InteractionObjectPair interaction) { return "PickUpCulprit"; } public override bool Test(Sim a, IGameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { return true; } } } private class MakeArrest : ChildSituation<ArrestSuspectSituation> { // Fields public ArrestSuspectSituation arrestSituation; // Methods public MakeArrest() { } public MakeArrest(ArrestSuspectSituation parent) : base(parent) { this.arrestSituation = parent; } public void ArrestFailure(Sim actor, float x) { base.UnrequestWalkStyle(actor, Sim.WalkStyle.Run); base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } public void ArrestFinished(Sim actor, float x) { InteractionInstance entry = new ArrestSuspectSituation.GetInPoliceCar.Definition(this.arrestSituation).CreateInstance(this.arrestSituation.CopCar, this.arrestSituation.SimToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); this.arrestSituation.SimToArrest.InteractionQueue.Add(entry); while (((this.arrestSituation.SimToArrest.GetDistanceToObject(this.arrestSituation.CopCar) + 3f) >= this.arrestSituation.Cop.GetDistanceToObject(this.arrestSituation.CopCar)) && !(this.arrestSituation.SimToArrest.Posture is SittingInVehicle)) { Simulator.Sleep(30); } base.UnrequestWalkStyle(actor, Sim.WalkStyle.Run); base.Parent.SetState(new ArrestSuspectSituation.GetCulpritInCar(base.Parent)); } public override void CleanUp() { base.UnrequestWalkStyle(base.Parent.Cop, Sim.WalkStyle.Run); base.CleanUp(); } public override void Init(ArrestSuspectSituation parent) { if (base.Parent.SimToArrest == null) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } else { base.RequestWalkStyle(parent.Cop, Sim.WalkStyle.Run); SituationSocial.Definition i = new SituationSocial.Definition("Policeman Express Disappointment", new string[0], null, false); InteractionInstance instance = base.ForceSituationSpecificInteraction(parent.SimToArrest, parent.Cop, i, null, new Callback(this.ArrestFinished), new Callback(this.ArrestFailure), InteractionPriorityLevel.CriticalNPCBehavior); if (instance != null) { instance.CancellableByPlayer = false; } } } } private class RideOffIntoTheSunset : ChildSituation<ArrestSuspectSituation> { // Methods protected RideOffIntoTheSunset() { } public RideOffIntoTheSunset(ArrestSuspectSituation parent) : base(parent) { } private void ExitSituation(Sim actor, float x) { base.Exit(); } public override void Init(ArrestSuspectSituation parent) { base.ForceSituationSpecificInteraction(base.Parent.Lot, base.Parent.Cop, new DriveAwayInServiceCar.Definition(base.Parent.CopCar), null, new Callback(this.ExitSituation), new Callback(this.ExitSituation)); } } private class ThrowInJail : ChildSituation<ArrestSuspectSituation> { // Methods protected ThrowInJail() { } public ThrowInJail(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { Sim simToArrest = parent.SimToArrest; Sim cop = parent.Cop; CarService copCar = parent.CopCar; IPoliceStation target = parent.Station; InteractionInstance entry = target.GetGoToJailDefinition().CreateInstance(target, simToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); simToArrest.AddExitReason(ExitReason.CanceledByScript); simToArrest.InteractionQueue.AddNext(entry); copCar.GetOut(cop); base.ForceSituationSpecificInteraction(target, cop, new RabbitHole.ArrestSimInRabbitHole.Definition(), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); base.Parent.CancelArrest(); } } } public static bool CheckOpportunitiesForLot(Sim actor, ulong targetId) { return true; } public override void Cleanup() { if (this.mDoor != null) { this.mDoor.SetLockType(CommonDoor.tLock.Anybody); this.mDoor = null; } this.BreakIntoHouseBroadcasterDestroy(); base.Cleanup(); } public override ThumbnailKey GetIconKey() { return new ThumbnailKey(new ResourceKey(kIconNameHash, 0x2f7d0004, 0), ThumbnailSize.Medium); } public string GreyedOutTooltipText(Sim simA, Sim simB) { string entryKey = "Gameplay/Socializing/SocialInteractionA:CannotSocializeAtWork"; return Localization.LocalizeString(simB.IsFemale, entryKey, new object[] { simB.SimDescription }); } private static string LocalizeString(string name, params object[] parameters) { return Localization.LocalizeString("Gameplay/Core/SneakIntoHouse:" + name, parameters); } public override bool Run() { bool succeeded = false; bool flag2 = false; PrivateEye.SwitchToWorkOutfit(base.Actor); if (base.Actor.LotCurrent != base.Target) { Route route = base.Actor.CreateRoute(); if (base.Target.PlanToLotEx(route).Succeeded()) { succeeded = base.Actor.DoRoute(route); flag2 = base.Actor.LotCurrent == base.Target; } } else { flag2 = true; } if (flag2) { Slot slot; int index = MathUtils.Clamp(base.Actor.SkillManager.GetSkillLevel(SkillNames.Logic), 0, 10); this.mDoor = base.Target.FindFrontDoor(); if (!base.Actor.RouteToSlotListAndCheckInUse(this.mDoor, new Slot[] { Door.RoutingSlots.Upgrade_Front, Door.RoutingSlots.Upgrade_Rear }, out slot)) { return false; } this.mDoor.SetLockType(CommonDoor.tLock.Nobody); float duration = (kTimeToPickLock * kPickLockTimeMultiplierPerLogicLevel[index]); base.StandardEntry(); base.BeginCommodityUpdates(); base.EnterStateMachine("PrivateEyeBreakIntoHome", "Enter", "x"); bool paramValue = slot == Door.RoutingSlots.Upgrade_Front; if (this.mDoor is DoorDouble) { paramValue = true; } base.mCurrentStateMachine.SetParameter("usingFrontSlot", paramValue); base.SetActor("Door", this.mDoor); base.AnimateSim("BreakInto"); this.BreakIntoHouseBroadcasterCreate(); succeeded = base.DoTimedLoop(duration); this.BreakIntoHouseBroadcasterDestroy(); base.AnimateSim("Exit"); if (succeeded) { this.SimArrivedAtLot(); Sim.RemoveGoHomeInteractions(base.Actor, false); } base.EndCommodityUpdates(succeeded); base.StandardExit(); } return succeeded; } protected void SimArrivedAtLot() { base.Actor.GreetSimOnLot(base.Target); SneakOntoLotSituation.Create(base.Actor, base.Target, SneakOntoLotSituation.SneakType.WithBroadcaster); EventTracker.SendEvent(EventTypeId.kVisitLot, base.Actor, base.Target); } public bool SocializationAllowed(Sim simA, Sim simB) { return false; } // Nested Types public class Definition : InteractionDefinition<Sim, Lot, Jadaytime.BreakIntoHouse> { // Fields public bool bRingDoorbell = true; // Methods public static bool CanBreakIntoHouse(Sim actor, ulong targetId) { if (actor.HasTrait(TraitNames.Good)) { return false; } return true; } public override string GetInteractionName(Sim actor, Lot target, InteractionObjectPair iop) { return Jadaytime.BreakIntoHouse.LocalizeString("BreakIntoHouse", new object[0]); } public override bool Test(Sim actor, Lot target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (isAutonomous) { return false; } if (target.IsCommunityLot) { return false; } if (actor.IsGreetedOnLot(target)) { return false; } if (!CanBreakIntoHouse(actor, target.LotId)) { return false; } return true; } } } } |
This doesn't generate any errors. I will check if the 2 messages appear in game.
Posts: 195
Thanks: 2012 in 7 Posts
Posts: 433
Thanks: 792 in 6 Posts
E: before you do you might want to modify your code
private static void Arrest(Sim s, float x) { Sims3.UI.StyledNotification.Show(new Sims3.UI.StyledNotification.Format("Arrest", Sims3.UI.StyledNotification.NotificationStyle.kGameMessagePositive)); }
this should pop a message when the arrest should happen
Posts: 195
Thanks: 2012 in 7 Posts
you did test with an other sim nearby ? since the reaction broacaster broadcasts to other sims |
Yes, I had my sim get caught by another sim. A message only pops up only when my sim starts lockpicking
Posts: 195
Thanks: 2012 in 7 Posts
Posts: 433
Thanks: 792 in 6 Posts
Posts: 195
Thanks: 2012 in 7 Posts
well the broadcaster should only appear during the interaction since its linked to the interaction |
So it shouldn't appear when my sim gets caught in the actual house? Only when they get caught lockpicking?
Posts: 433
Thanks: 792 in 6 Posts
So it shouldn't appear when my sim gets caught in the actual house? Only when they get caught lockpicking? |
If its just tied to the break into house interaction then yes
Posts: 195
Thanks: 2012 in 7 Posts
If its just tied to the break into house interaction then yes |
Won't that make it so that the sim breaking in will only be arrested if they get caught lockpicking, not when caught inside the house? (That is if we get the arrest code to work)
Posts: 433
Thanks: 792 in 6 Posts
Posts: 195
Thanks: 2012 in 7 Posts
I did not dive deep into the code but if that is the case then yes after the lockpicking is finished the broadcaster will vanish and no arrest wshould occur (but again didnt dive into the code really) |
Wouldn't it just be easier to use the game's code for PrivateEyeCaught and in some way insert the code for the arrest. Here is the code for the PrivateEyeCaught:
using Sims3.Gameplay.Abstracts; using Sims3.Gameplay.Actors; using Sims3.Gameplay.Autonomy; using Sims3.Gameplay.CAS; using Sims3.Gameplay.Core; using Sims3.Gameplay.Interactions; using Sims3.Gameplay.Interfaces; using Sims3.Gameplay.Objects.Vehicles; using Sims3.Gameplay.Services; using Sims3.Gameplay.Utilities; using Sims3.SimIFace; using Sims3.SimIFace.CAS; using System; using System.Collections.Generic; using Sims3.Gameplay.ActiveCareer; using Sims3.Gameplay.EventSystem; using Sims3.Gameplay.Socializing; using Sims3.Gameplay.Opportunities; using Sims3.Gameplay.Skills; using Sims3.Gameplay.ActiveCareer.ActiveCareers; using Sims3.Gameplay.Objects; using Sims3.Gameplay.SimDebug; using static Sims3.Gameplay.Situations.CaughtSituation; using Sims3.Gameplay.CelebritySystem; using Sims3.Gameplay.Objects.RabbitHoles; using Sims3.Gameplay.ActorSystems; using Sims3.Gameplay.ThoughtBalloons; using Sims3.Gameplay.Situations; namespace xantak22 { public class PrivateEyeCaught : Interaction<Sim, Sim> { // Fields private const string sLocalizationKey = "Gameplay/ActiveCareer/ActiveCareers/PrivateEyeInteractions/PrivateEyeCaught"; public static readonly InteractionDefinition Singleton = new Definition(); // Methods private static string LocalizeString(string name, params object[] parameters) => Localization.LocalizeString("Gameplay/ActiveCareer/ActiveCareers/PrivateEyeInteractions/PrivateEyeCaught:" + name, parameters); protected override bool Run() { ReactionTypes[] typesArray = new ReactionTypes[] { ReactionTypes.ViewHate, ReactionTypes.ViewDistressed }; base.Actor.RouteTurnToFace(base.Target.Position); ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.BalloonData(base.Actor.GetThumbnailKey()) { BalloonType = ThoughtBalloonTypes.kSpeechBalloon }; base.Target.ThoughtBalloonManager.ShowBalloon(bd); ThoughtBalloonManager.BalloonData data2 = new ThoughtBalloonManager.BalloonData(base.Target.GetThumbnailKey()) { BalloonType = ThoughtBalloonTypes.kSpeechBalloon }; base.Actor.ThoughtBalloonManager.ShowBalloon(data2); base.Actor.PlayReaction(typesArray[RandomUtil.GetInt(typesArray.Length - 1)], ReactionSpeed.ImmediateWithoutOverlay); if ((base.Target.CurrentInteraction is PrivateEyeInteractions.SearchThroughGarbage) || (Target.CurrentInteraction is PrivateEyeInteractions.BreakIntoHouse)) { base.Target.AddExitReason(ExitReason.CanceledByScript); } if (base.Actor.IsNPC) { if (!ReferenceEquals(base.Actor.LotHome, base.Target.LotCurrent)) { Sim.ForceSocial(base.Actor, base.Target, "Yell At", InteractionPriorityLevel.High, false); } else if (base.Actor.TraitManager.HasAnyElement(guids: new TraitNames[] { (TraitNames)(5_175_480_303_478_029_360L), (TraitNames)(5_175_480_303_478_029_664L), TraitNames.MeanSpirited })) { Sim.ForceSocial(base.Actor, base.Target, "Fight!", InteractionPriorityLevel.High, false); } else { Sim.ForceSocial(base.Actor, base.Target, "Yell At", InteractionPriorityLevel.High, false); } } if ((Sims3.Gameplay.Situations.VisitSituation.FindVisitSituationInvolvingGuest(base.Target) != null) && !LotManager.RoomIdIsOutside(base.Target.RoomId)) { VisitSituation.MakeGuestHouseholdExitToYard(base.Target.LotCurrent, base.Actor, base.Target, VisitSituation.GuestLeaveReason.InappropriateBehavior, true); } else if (!(base.Target.CurrentInteraction is PrivateEyeInteractions.SearchThroughGarbage)) { base.Target.ShowTNSIfSelectable(TNSNames.PrivateEyeCaughtBreakingIn, base.Target, null, null, base.Target.IsFemale, base.Target.IsFemale, new object[0]); Sim.MakeSimGoHome(base.Target, false, new InteractionPriority(InteractionPriorityLevel.NonCriticalNPCBehavior)); } return true; } // Nested Types [DoesntRequireTuning] private sealed class Definition : InteractionDefinition<Sim, Sim, PrivateEyeInteractions.PrivateEyeCaught> { // Methods protected override string GetInteractionName(Sim a, Sim target, InteractionObjectPair interaction) => PrivateEyeInteractions.PrivateEyeCaught.LocalizeString("InteractionName", new object[0]); protected override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) => !ReferenceEquals(a, target); } } }
It might generate 1 error.
Posts: 433
Thanks: 792 in 6 Posts
It might generate 1 error. |
Posts: 195
Thanks: 2012 in 7 Posts
Does the PrivateEyeCaught class show the desired behaivour ? look at the time when the broadcaster gets destroyed is it after the break in interaction finishes or at another time ? Need specifics here what error ? |
I'm not sure when the broadcaster gets destroyed, maybe it gets destroyed just like in the break into house code?
The error which appears for me is with the "LocalizeString", where is says that PrivateEyeCaught doesn't contain a definition for it.
Maybe we could use the game's code for SneakOntoLotSituation instead?
Posts: 433
Thanks: 792 in 6 Posts
Posts: 195
Thanks: 2012 in 7 Posts
Again unfortunately im not familiar with how these game mechanics work ingame, you could trigger the destruction of the broadcaster when the lot is left though |
In the break into house code? or the PrivaetEyeCaught or SneakOntoLotSituation code?
Posts: 433
Thanks: 792 in 6 Posts
Posts: 195
Thanks: 2012 in 7 Posts
in the break into house code |
Maybe there's a way to trigger the broadcaster destruction at the moment the sim gets caught in the house
Posts: 433
Thanks: 792 in 6 Posts
Maybe there's a way to trigger the broadcaster destruction at the moment the sim gets caught in the house |
Definetely thats easy but if i gathered correctly thats not the "big" Problem. You might want to create an broadcaster when you begin the interaction and destroy it as you suggested either if the sim got caught or if you leave the lot undetected.
just out of the top of my head creating a buff or an class for just that purpose might solve this problem
E: actually the idea you had seems to fit here you might be able to adapt the SneakOntoLotSituation to serve your needs
Posts: 195
Thanks: 2012 in 7 Posts
Definetely thats easy but if i gathered correctly thats not the "big" Problem. You might want to create an broadcaster when you begin the interaction and destroy it as you suggested either if the sim got caught or if you leave the lot undetected. just out of the top of my head creating a buff or an class for just that purpose might solve this problem E: actually the idea you had seems to fit here you might be able to adapt the SneakOntoLotSituation to serve your needs |
Wouldn't it be possible to use the SneakOntoLotSituation code and add broadcasters and the arrest in there instead of in the Break into house code?
Posts: 433
Thanks: 792 in 6 Posts
Wouldn't it be possible to use the SneakOntoLotSituation code and add broadcasters and the arrest in there instead of in the Break into house code? |
It seems the SneakOntoLotSituation already got everything you need only lacking the arresting part so yes this could be your ticket.
Posts: 195
Thanks: 2012 in 7 Posts
It seems the SneakOntoLotSituation already got everything you need only lacking the arresting part so yes this could be your ticket. |
I will try that
Posts: 195
Thanks: 2012 in 7 Posts
It seems the SneakOntoLotSituation already got everything you need only lacking the arresting part so yes this could be your ticket. |
I put the arrest code in the SneakOntoLotSituation code but it still won't work, maybe there's something wrong with the arrest code? Here is the code (No errors, for me atleast):
using Sims3.Gameplay.Abstracts; using Sims3.Gameplay.Actors; using Sims3.Gameplay.Autonomy; using Sims3.Gameplay.CAS; using Sims3.Gameplay.Core; using Sims3.Gameplay.Interactions; using Sims3.Gameplay.Interfaces; using Sims3.Gameplay.Objects.Vehicles; using Sims3.Gameplay.Services; using Sims3.Gameplay.Utilities; using Sims3.SimIFace; using Sims3.SimIFace.CAS; using System; using System.Collections.Generic; using Sims3.Gameplay.ActiveCareer; using Sims3.Gameplay.EventSystem; using Sims3.Gameplay.Socializing; using Sims3.Gameplay.Opportunities; using Sims3.Gameplay.Skills; using Sims3.Gameplay.ActiveCareer.ActiveCareers; using Sims3.Gameplay.Objects; using Sims3.Gameplay.SimDebug; using Sims3.Gameplay.Situations; using Sims3.Gameplay.ActorSystems; using Sims3.Gameplay.ThoughtBalloons; using xantak22; using Sims3.Gameplay; namespace xantak22 { public class SneakOntoLotSituation : RootSituation { // Fields private const string sLocalizationKey = "Gameplay/Situations/SneakOntoLotSituation"; [Tunable, TunableComment("Broadcaster for after sim has broken into a house")] private static ReactionBroadcasterParams kBrokeIntoHouseBroadcastParams = new ReactionBroadcasterParams(); public bool mSneakingEnded; private EventListener mEventListener; private ReactionBroadcaster mBrokeIntoHouseBroadcast; private SneakType mCurrentSneakType; private Sim mSneakingSim; private AlarmHandle mCheckForArrivingAndLeaving; // Methods private SneakOntoLotSituation() { } private SneakOntoLotSituation(Sim sneakingSim, Lot lot, SneakType currentSneakType) : base(lot) { this.mCurrentSneakType = currentSneakType; lot.TimeOfLastVisit = SimClock.CurrentTime(); switch (this.mCurrentSneakType) { case SneakType.IsEmptyLot: this.mCheckForArrivingAndLeaving = base.AlarmManager.AddAlarmRepeating(5f, TimeUnit.Minutes, new AlarmTimerCallback(this.CheckForArrivingAndLeaving), 10f, TimeUnit.Minutes, "Visit checking if hosts have arrived or left", AlarmType.AlwaysPersisted, this.mSneakingSim); break; case SneakType.WithBroadcaster: this.mCheckForArrivingAndLeaving = base.AlarmManager.AddAlarmRepeating(5f, TimeUnit.Minutes, new AlarmTimerCallback(this.CheckForArrivingAndLeaving), 10f, TimeUnit.Minutes, "Visit checking if hosts have arrived or left", AlarmType.AlwaysPersisted, this.mSneakingSim); this.BreakIntoHouseBroadcasterCreate(sneakingSim); break; default: break; } this.mSneakingSim = sneakingSim.AssignRole(this); this.mEventListener = EventTracker.AddListener(EventTypeId.kEventSimMovedToLot, new ProcessEventDelegate(this.SneakingSimLeftLot), this.mSneakingSim); } private void BreakIntoHouseBroadcasterCreate(Sim sneakingSim) { this.mBrokeIntoHouseBroadcast = new ReactionBroadcaster(sneakingSim, kBrokeIntoHouseBroadcastParams, new ReactionBroadcaster.BroadcastCallback(this.BrokeIntoHouseReactionCallback)); } private void BreakIntoHouseBroadcasterDestroy() { if (this.mBrokeIntoHouseBroadcast != null) { this.mBrokeIntoHouseBroadcast.Dispose(); this.mBrokeIntoHouseBroadcast = null; } } private void BrokeIntoHouseReactionCallback(Sim s, ReactionBroadcaster rb) { Sim broadcastingObject = rb.BroadcastingObject as Sim; if (broadcastingObject != null) { InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstance(broadcastingObject, s, new InteractionPriority(InteractionPriorityLevel.UserDirected), false, true); if (s.InteractionQueue.AddNext(entry)) { s.StartOneShotFunction(new Function(this.Exit), GameObject.OneShotFunctionDisposeFlag.OnReset); } } } InteractionInstance entry = PrivateEyeInteractions.PrivateEyeCaught.Singleton.CreateInstanceWithCallbacks(s, s, new InteractionPriority(InteractionPriorityLevel.High), false, false, null, new Callback(Arrest), null); public static IActor s; private static void Arrest(Sim s, float x) { throw new NotImplementedException(); } public class ArrestSuspectSituation : RootSituation { // Fields private const InteractionPriorityLevel Priority = InteractionPriorityLevel.CriticalNPCBehavior; private static List<string> SimsBeingArrested = new List<string>(); public Lot ArrestLocation; public Sim Cop; public CarService CopCar; public RabbitHole SimsLocation; public Sim SimToArrest; public IPoliceStation Station; // Methods private ArrestSuspectSituation() { } private ArrestSuspectSituation(Lot lot, Sim simToArrest) : base(lot) { lock (SimsBeingArrested) { if (SimsBeingArrested.Contains(simToArrest.Name)) { base.Exit(); } else { SimsBeingArrested.Add(simToArrest.Name); this.SimToArrest = simToArrest; this.ArrestLocation = lot; this.SimsLocation = RabbitHole.GetRandomRabbitHoleOfType(RabbitHoleType.PoliceStation); base.SetState(new CreateCopAndRoute(this)); } } } internal void CancelArrest() { this.SimToArrest.InteractionQueue.CancelAllInteractions(); for (int i = 0; i < 20; i++) { Simulator.Sleep(10); if (!this.SimToArrest.CurrentInteraction.CancellableByPlayer) { this.SimToArrest.InteractionQueue.CancelAllInteractions(); } } } public static ArrestSuspectSituation Create(Lot lot, Sim simToArrest) { return new ArrestSuspectSituation(lot, simToArrest); } private SimDescription CreateNewCopFromPool() { List<SimDescription> randomList = new List<SimDescription>(); Police instance = Police.Instance; if (instance != null) { foreach (SimDescription description in instance.Pool) { if (!Police.Instance.IsServiceAssigned(description)) { randomList.Add(description); } } } return ((randomList.Count <= 0) ? null : RandomUtil.GetRandomObjectFromList<SimDescription>(randomList)); } public override void Dispose() { if (this.SimToArrest != null) { lock (SimsBeingArrested) { if (SimsBeingArrested.Contains(this.SimToArrest.Name)) { SimsBeingArrested.Remove(this.SimToArrest.Name); } } } if (this.CopCar != null) { this.CopCar.Destroy(); this.CopCar = null; } base.Dispose(); } public override void OnParticipantDeleted(Sim participant) { if (ReferenceEquals(participant, this.Cop) || ReferenceEquals(participant, this.SimToArrest)) { base.Exit(); } } // Nested Types private class ArrestSimInRabbitHole : RabbitHole.ArrestSimInRabbitHole { // Methods public override bool InRabbitHole() { base.StartStages(); base.BeginCommodityUpdates(); base.DoLoop(~(ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); base.EndCommodityUpdates(true); return true; } } private class CreateCopAndRoute : ChildSituation<ArrestSuspectSituation> { // Methods protected CreateCopAndRoute() { } public CreateCopAndRoute(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { IPoliceStation randomRabbitHoleOfType = (IPoliceStation)RabbitHole.GetRandomRabbitHoleOfType(RabbitHoleType.PoliceStation); if (randomRabbitHoleOfType == null) { base.Exit(); } else { parent.Station = randomRabbitHoleOfType; } SimDescription description = parent.CreateNewCopFromPool(); if (description == null) { base.Exit(); } else { if (description.CreatedSim != null) { parent.Cop = description.CreatedSim; parent.Cop.SwitchToOutfitWithoutSpin(OutfitCategories.Career); } else { SimOutfit outfit = description.GetOutfit(OutfitCategories.Career, 0); parent.Cop = (outfit != null) ? description.Instantiate(Vector3.OutOfWorld, outfit.Key) : description.Instantiate(Vector3.OutOfWorld); } parent.CopCar = CarNpcManager.Singleton.CreateServiceCar(ServiceType.None | ServiceType.Police); base.ForceSituationSpecificInteraction(parent.Cop, parent.Cop, new ArrestSuspectSituation.GoToCulpritsLocation.Definition(base.Parent), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.MakeArrest(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Exit(); } } private class GetCulpritInCar : ChildSituation<ArrestSuspectSituation> { // Methods protected GetCulpritInCar() { } public GetCulpritInCar(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { Sim simToArrest = parent.SimToArrest; Sim cop = parent.Cop; CarService copCar = parent.CopCar; base.ForceSituationSpecificInteraction(base.Parent.CopCar, base.Parent.Cop, new ArrestSuspectSituation.GetInPoliceCar.Definition(base.Parent), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.ThrowInJail(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Parent.CancelArrest(); base.Exit(); } } public sealed class GetInPoliceCar : Interaction<Sim, IGameObject> { // Fields public static readonly InteractionDefinition Singleton = new Definition(); // Methods public override void ConfigureInteraction() { base.CancellableByPlayer = false; } public override bool Run() { ArrestSuspectSituation arrestSituation = (base.InteractionDefinition as Definition).ArrestSituation; CarService copCar = arrestSituation.CopCar; Sim simToArrest = arrestSituation.SimToArrest; if (base.Actor != simToArrest) { copCar.RouteToAndGetIn(arrestSituation.Cop, true); CarNpcManager.Singleton.DriveToLotInCar(copCar, arrestSituation.Cop, arrestSituation.Station.LotCurrent, false); } else { copCar.RouteToAndGetIn(simToArrest, false); InteractionInstance instance = PoliceSituation.Wait.Singleton.CreateInstance(simToArrest, simToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); simToArrest.InteractionQueue.PushAsContinuation(instance, true); } return true; } // Nested Types [DoesntRequireTuning] public sealed class Definition : InteractionDefinition<Sim, IGameObject, ArrestSuspectSituation.GetInPoliceCar> { // Fields public ArrestSuspectSituation ArrestSituation; // Methods public Definition() { } public Definition(ArrestSuspectSituation situation) { this.ArrestSituation = situation; } public override string GetInteractionName(Sim a, IGameObject target, InteractionObjectPair interaction) { return Localization.LocalizeString(a.IsFemale, "Gameplay/Objects/RabbitHoles/PoliceStation/GoToJail:InteractionName", new object[0]); } public override bool Test(Sim a, IGameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { return true; } } } public sealed class GoToCulpritsLocation : Interaction<Sim, IGameObject> { // Fields public static readonly InteractionDefinition Singleton = new Definition(); // Methods public override bool Run() { Definition interactionDefinition = base.InteractionDefinition as Definition; Sim cop = interactionDefinition.arrestSituation.Cop; CarService copCar = interactionDefinition.arrestSituation.CopCar; Lot arrestLocation = interactionDefinition.arrestSituation.ArrestLocation; if ((copCar == null) || !CarNpcManager.Singleton.DriveToLotInServiceCarWithinTime(copCar, cop, arrestLocation, 10f, true)) { return false; } copCar.GetOut(cop); return true; } // Nested Types [DoesntRequireTuning] public sealed class Definition : InteractionDefinition<Sim, IGameObject, ArrestSuspectSituation.GoToCulpritsLocation> { // Fields public ArrestSuspectSituation arrestSituation; // Methods public Definition() { } public Definition(ArrestSuspectSituation situation) { this.arrestSituation = situation; } public override string GetInteractionName(Sim a, IGameObject target, InteractionObjectPair interaction) { return "PickUpCulprit"; } public override bool Test(Sim a, IGameObject target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { return true; } } } private class MakeArrest : ChildSituation<ArrestSuspectSituation> { // Fields public ArrestSuspectSituation arrestSituation; // Methods public MakeArrest() { } public MakeArrest(ArrestSuspectSituation parent) : base(parent) { this.arrestSituation = parent; } public void ArrestFailure(Sim actor, float x) { base.UnrequestWalkStyle(actor, Sim.WalkStyle.Run); base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } public void ArrestFinished(Sim actor, float x) { InteractionInstance entry = new ArrestSuspectSituation.GetInPoliceCar.Definition(this.arrestSituation).CreateInstance(this.arrestSituation.CopCar, this.arrestSituation.SimToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); this.arrestSituation.SimToArrest.InteractionQueue.Add(entry); while (((this.arrestSituation.SimToArrest.GetDistanceToObject(this.arrestSituation.CopCar) + 3f) >= this.arrestSituation.Cop.GetDistanceToObject(this.arrestSituation.CopCar)) && !(this.arrestSituation.SimToArrest.Posture is SittingInVehicle)) { Simulator.Sleep(30); } base.UnrequestWalkStyle(actor, Sim.WalkStyle.Run); base.Parent.SetState(new ArrestSuspectSituation.GetCulpritInCar(base.Parent)); } public override void CleanUp() { base.UnrequestWalkStyle(base.Parent.Cop, Sim.WalkStyle.Run); base.CleanUp(); } public override void Init(ArrestSuspectSituation parent) { if (base.Parent.SimToArrest == null) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } else { base.RequestWalkStyle(parent.Cop, Sim.WalkStyle.Run); SituationSocial.Definition i = new SituationSocial.Definition("Policeman Express Disappointment", new string[0], null, false); InteractionInstance instance = base.ForceSituationSpecificInteraction(parent.SimToArrest, parent.Cop, i, null, new Callback(this.ArrestFinished), new Callback(this.ArrestFailure), InteractionPriorityLevel.CriticalNPCBehavior); if (instance != null) { instance.CancellableByPlayer = false; } } } } private class RideOffIntoTheSunset : ChildSituation<ArrestSuspectSituation> { // Methods protected RideOffIntoTheSunset() { } public RideOffIntoTheSunset(ArrestSuspectSituation parent) : base(parent) { } private void ExitSituation(Sim actor, float x) { base.Exit(); } public override void Init(ArrestSuspectSituation parent) { base.ForceSituationSpecificInteraction(base.Parent.Lot, base.Parent.Cop, new DriveAwayInServiceCar.Definition(base.Parent.CopCar), null, new Callback(this.ExitSituation), new Callback(this.ExitSituation)); } } private class ThrowInJail : ChildSituation<ArrestSuspectSituation> { // Methods protected ThrowInJail() { } public ThrowInJail(ArrestSuspectSituation parent) : base(parent) { } public override void Init(ArrestSuspectSituation parent) { Sim simToArrest = parent.SimToArrest; Sim cop = parent.Cop; CarService copCar = parent.CopCar; IPoliceStation target = parent.Station; InteractionInstance entry = target.GetGoToJailDefinition().CreateInstance(target, simToArrest, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); simToArrest.AddExitReason(ExitReason.CanceledByScript); simToArrest.InteractionQueue.AddNext(entry); copCar.GetOut(cop); base.ForceSituationSpecificInteraction(target, cop, new RabbitHole.ArrestSimInRabbitHole.Definition(), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior)); } private void OnCompletion(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); } private void OnFailure(Sim actor, float x) { base.Parent.SetState(new ArrestSuspectSituation.RideOffIntoTheSunset(base.Parent)); base.Parent.CancelArrest(); } } } private void CheckForArrivingAndLeaving() { if ((this.mCurrentSneakType == SneakType.IsEmptyLot) && (this.Lot.Household != null)) { if (!ReferenceEquals(this.Lot.Household, this.mSneakingSim.Household)) { VisitSituation.Create(this.mSneakingSim, this.Lot); VisitSituation.SetVisitToGreeted(this.mSneakingSim); } base.Exit(); } if (!ReferenceEquals(this.mSneakingSim.LotCurrent, this.Lot)) { base.Exit(); } } public override void CleanUp() { bool flag = false; if (this.mSneakingSim != null) { if (!this.mSneakingEnded) { this.mSneakingSim.UnrequestWalkStyle(Sim.WalkStyle.Sneak); this.mSneakingEnded = true; } this.mSneakingSim.RemoveRole(this); } foreach (Sim sim in this.Lot.GetSims()) { if (!ReferenceEquals(sim, this.mSneakingSim) && ReferenceEquals(sim.Household, this.mSneakingSim.Household)) { flag = true; } } if (!flag && ((this.mSneakingSim.Household != null) && !ReferenceEquals(this.mSneakingSim.LotCurrent, this.Lot))) { this.mSneakingSim.RemoveSimGreetedOnLot(this.Lot); } this.BreakIntoHouseBroadcasterDestroy(); EventTracker.RemoveListener(this.mEventListener); base.AlarmManager.RemoveAlarm(this.mCheckForArrivingAndLeaving); base.CleanUp(); } public static SneakOntoLotSituation Create(Sim guest, Lot lot, SneakType currentSneakType) { if (lot != null) { if (guest.LotCurrent == null) { return null; } if (ReferenceEquals(guest.LotHome, lot)) { return null; } SneakOntoLotSituation situation = FindSneakSituationInvolvingSim(guest); if ((situation != null) && ReferenceEquals(situation.Lot, lot)) { return situation; } switch (currentSneakType) { case SneakType.IsEmptyLot: { if (lot.Household != null) { return null; } SneakOntoLotSituation parent = new SneakOntoLotSituation(guest, lot, currentSneakType); parent.SetState(new ArrivedOnLot(parent)); return parent; } case SneakType.WithBroadcaster: { SneakOntoLotSituation parent = new SneakOntoLotSituation(guest, lot, currentSneakType); parent.SetState(new ArrivedOnLot(parent)); return parent; } } } return null; } public static void EnterTombRoom(Sim sneakingSim) { SneakOntoLotSituation parent = FindSneakSituationInvolvingSim(sneakingSim); if (parent != null) { parent.SetState(new InTombRoom(parent)); } } public static SneakOntoLotSituation FindSneakSituationInvolvingSim(Sim guest) { SneakOntoLotSituation situation3; using (List<Situation>.Enumerator enumerator = guest.Autonomy.SituationComponent.Situations.GetEnumerator()) { while (true) { if (enumerator.MoveNext()) { Situation current = enumerator.Current; SneakOntoLotSituation situation2 = current as SneakOntoLotSituation; if ((situation2 == null) || !ReferenceEquals(situation2.SneakingSim, guest)) { continue; } situation3 = situation2; } else { return null; } break; } } return situation3; } public static void LeaveTombRoom(Sim sneakingSim) { SneakOntoLotSituation parent = FindSneakSituationInvolvingSim(sneakingSim); if (parent != null) { parent.SetState(new LeftTombRoom(parent)); } } private static string LocalizeString(string name, params object[] parameters) => Localization.LocalizeString("Gameplay/Situations/SneakOntoLotSituation:" + name, parameters); public override void OnParticipantDeleted(Sim participant) { this.OnParticipantRemoved(participant); } public override void OnParticipantHomeLotChanged(Sim sim) { this.CheckForArrivingAndLeaving(); } private void OnParticipantRemoved(Sim participant) { if (ReferenceEquals(participant, this.mSneakingSim)) { if (!this.mSneakingEnded) { this.mSneakingSim.UnrequestWalkStyle(Sim.WalkStyle.Sneak); this.mSneakingEnded = true; } base.Exit(); } } public override void PostLoad() { base.PostLoad(); EventTracker.AddListener(this.mEventListener); } private ListenerAction SneakingSimLeftLot(Event e) { if (!this.mSneakingEnded) { this.mSneakingSim.UnrequestWalkStyle(Sim.WalkStyle.Sneak); this.mSneakingEnded = true; } base.Exit(); return ListenerAction.Remove; } // Properties public Sim SneakingSim => this.mSneakingSim; // Nested Types private class ArrivedOnLot : ChildSituation<SneakOntoLotSituation> { // Methods private ArrivedOnLot() { } public ArrivedOnLot(SneakOntoLotSituation parent) : base(parent) { } public override void Init(SneakOntoLotSituation parent) { Lot lotToBeGreetedOn = parent.Lot; Sim mSneakingSim = parent.mSneakingSim; mSneakingSim.RequestWalkStyle(Sim.WalkStyle.Sneak); mSneakingSim.GreetSimOnLot(lotToBeGreetedOn); lotToBeGreetedOn.SetDisplayLevel(LotManager.GetBestLevelToDisplayForSim(mSneakingSim, lotToBeGreetedOn)); LotManager.SetWallsViewMode(0x12e); World.SetWallCutawayFocusPos(mSneakingSim.Position); Sim.RemoveGoHomeInteractions(mSneakingSim, false); } } private class InTombRoom : ChildSituation<SneakOntoLotSituation> { // Methods private InTombRoom() { } public InTombRoom(SneakOntoLotSituation parent) : base(parent) { } public override void Init(SneakOntoLotSituation parent) { if (!parent.mSneakingEnded) { parent.mSneakingSim.UnrequestWalkStyle(Sim.WalkStyle.Sneak); parent.mSneakingEnded = true; } } } private class LeftTombRoom : ChildSituation<SneakOntoLotSituation> { // Methods private LeftTombRoom() { } public LeftTombRoom(SneakOntoLotSituation parent) : base(parent) { } public override void Init(SneakOntoLotSituation parent) { if (parent.mSneakingEnded) { parent.mSneakingSim.RequestWalkStyle(Sim.WalkStyle.Sneak); parent.mSneakingEnded = false; } } } public enum SneakType { IsEmptyLot, WithBroadcaster } } }
Posts: 433
Thanks: 792 in 6 Posts
I will have a look at it but not today still ned to take care of some of my own mods problems. What you could do is use the message code to see if the code gets called at all if not see if you can determine where the missing link is.
Posts: 195
Thanks: 2012 in 7 Posts
Hmm i would have to look at it more thourougly. I will have a look at it but not today still ned to take care of some of my own mods problems. What you could do is use the message code to see if the code gets called at all if not see if you can determine where the missing link is. |
Oki doki, thank you!
Who Posted
|