private static int ProcessMessage(int messageIndex) { Sims3.SimIFace.StopWatch stopWatch = Sims3.SimIFace.StopWatch.Create(Sims3.SimIFace.StopWatch.TickStyles.Milliseconds); stopWatch.Start(); uint message = 0; stopWatch.SetElapsedTime(10); int readIndex = messageIndex; while (message == 0) { try { message = BitConverter.ToUInt32(messageBuffer, readIndex); readIndex += intSize; } catch { } while (stopWatch.GetElapsedTime() < 10) { } stopWatch.Restart(); } if (message == (uint)MessageIDs.HandShakeRequest) { byte[] comfirmBytes = BitConverter.GetBytes((uint)MessageIDs.HandShakeComfirm); sendBuffer.Add(comfirmBytes); bufferConnected = true; } else if (message == (uint)MessageIDs.StartGame) { Sims3.Gameplay.Gameflow.SetGameSpeed(Sims3.SimIFace.Gameflow.GameSpeed.Normal, Sims3.Gameplay.Gameflow.SetGameSpeedContext.GameStates); gameStarted = true; } else if (message == (uint)MessageIDs.GameFlowNormal) { Sims3.Gameplay.Gameflow.SetGameSpeed(Sims3.SimIFace.Gameflow.GameSpeed.Normal, Sims3.Gameplay.Gameflow.SetGameSpeedContext.GameStates); } else if (message == (uint)MessageIDs.GameFlowPause) { Sims3.Gameplay.Gameflow.SetGameSpeed(Sims3.SimIFace.Gameflow.GameSpeed.Pause, Sims3.Gameplay.Gameflow.SetGameSpeedContext.GameStates); } else if (message == (uint)MessageIDs.InteractionTerrain) { uint type = BitConverter.ToUInt32(messageBuffer, readIndex); readIndex += intSize; if (type == (uint)InteractionTerrainTypes.GoHereSameLot) { ulong targetID = BitConverter.ToUInt64(messageBuffer, readIndex); readIndex += longSize; float x = BitConverter.ToSingle(messageBuffer, readIndex); readIndex += sizeof(float); float y = BitConverter.ToSingle(messageBuffer, readIndex); readIndex += sizeof(float); float z = BitConverter.ToSingle(messageBuffer, readIndex); readIndex += sizeof(float); InteractionPriority priority = new InteractionPriority(); priority.Level = InteractionPriorityLevel.UserDirected; ObjectGuid guid = new ObjectGuid(); guid.Value = targetID; guid.mValue = targetID; Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(Terrain.GoHere.SameLotSingleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); Terrain.GoHere gohere = new Terrain.GoHere(); gohere.Init(ref paras); gohere.SetTargetPosition(new Vector3(x, y, z)); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(gohere); } } else if (message == (uint)MessageIDs.InteractionShared) { uint type = BitConverter.ToUInt32(messageBuffer, readIndex); readIndex += intSize; ulong targetID = BitConverter.ToUInt64(messageBuffer, readIndex); readIndex += longSize; InteractionPriority priority = new InteractionPriority(); priority.Level = InteractionPriorityLevel.UserDirected; ObjectGuid guid = new ObjectGuid(); guid.Value = targetID; guid.mValue = targetID; if (type == (uint)InteractionSharedTypes.JumpOnObject) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(JumpOnObject.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); JumpOnObject interaction = new JumpOnObject(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } else if (type == (uint)InteractionSharedTypes.JumpOffObject) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(JumpOffObject.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); JumpOffObject interaction = new JumpOffObject(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } else if (type == (uint)InteractionSharedTypes.SleepAndNapOnObject) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(SleepAndNapOnObject.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); SleepAndNapOnObject interaction = new SleepAndNapOnObject(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } else if (type == (uint)InteractionSharedTypes.StretchOnObject) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(StretchOnObject.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); StretchOnObject interaction = new StretchOnObject(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } else if (type == (uint)InteractionSharedTypes.ShooOff) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(ShooOff.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); ShooOff interaction = new ShooOff(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } else if (type == (uint)InteractionSharedTypes.ShooNeighborPet) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(ShooNeighborPet.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); ShooNeighborPet interaction = new ShooNeighborPet(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } else if (type == (uint)InteractionSharedTypes.ShooFromFood) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(ShooFromFood.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); ShooFromFood interaction = new ShooFromFood(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } else if (type == (uint)InteractionSharedTypes.ScratchObject) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(ScratchObject.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); ScratchObject interaction = new ScratchObject(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } else if (type == (uint)InteractionSharedTypes.PetSingAlong) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(PetSingAlong.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); PetSingAlong interaction = new PetSingAlong(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } else if (type == (uint)InteractionSharedTypes.ReactToDisturbance) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(ReactToDisturbance.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); ReactToDisturbance interaction = new ReactToDisturbance(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } else if (type == (uint)InteractionSharedTypes.Sit) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(Sit.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); Sit interaction = new Sit(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } else if (type == (uint)InteractionSharedTypes.Stand) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(Stand.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); Stand interaction = new Stand(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } else if (type == (uint)InteractionSharedTypes.ViewObjects) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(ViewObjects.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); ViewObjects interaction = new ViewObjects(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } else if (type == (uint)InteractionSharedTypes.Reminisce) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(Reminisce.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); Reminisce interaction = new Reminisce(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } else if (type == (uint)InteractionSharedTypes.CatchFlies) { Sims3.Gameplay.Autonomy.InteractionObjectPair iop = new Sims3.Gameplay.Autonomy.InteractionObjectPair(CatchFlies.Singleton, Terrain.GetObject(guid)); InteractionInstanceParameters paras = new InteractionInstanceParameters(iop, Sims3.Gameplay.Actors.Sim.ActiveActor, priority, false, true); CatchFlies interaction = new CatchFlies(); interaction.Init(ref paras); netIntercactionAdded = true; Sims3.Gameplay.Actors.Sim.ActiveActor.InteractionQueue.Add(interaction); } } else { return(-1); } return(readIndex); }
/* * public static void DebugMsg(Sim sim, Common.StringBuilder msg, string text) * { * if (text != null) * { * msg += Common.NewLine + text; * } * * if ((sim != null) && (sim.FirstName == "Roberto")) * { * Common.Notify(msg); * } * } */ public override bool DoRoute(Route r) { Sim routeSim = null; if (!GoHere.Settings.mAllowCarRouting) { r.SetOption(Route.RouteOption.EnablePlanningAsCar, false); r.SetOption(Route.RouteOption.BeginAsCar, false); } Common.StringBuilder msg = new Common.StringBuilder("DoRoute"); try { if (r.Follower != null) { routeSim = r.Follower.Target as Sim; } if (!GoHere.Settings.mAllowBoatRouting) { Houseboat boat; if (!Houseboat.IsPointOnHouseboat(mOwnerSim.Position, out boat)) { r.SetOption2(Route.RouteOption2.EnablePlanningAsBoat, false); r.SetOption2(Route.RouteOption2.BeginAsBoat, false); r.SetOption2(Route.RouteOption2.EndAsBoat, false); bool water = false; if (mOwnerSim.InteractionQueue != null) { Terrain.GoHere interaction = mOwnerSim.InteractionQueue.GetHeadInteraction() as Terrain.GoHere; if (interaction != null && interaction.mDestinationType == Terrain.GoHere.DestinationType.OnSeaWater) { water = true; } } if (mOwnerSim.Posture is Ocean.PondAndOceanRoutingPosture || mOwnerSim.Posture is SwimmingInPool) { water = true; } if (water) { r.SetOption(Route.RouteOption.EnableWaterPlanning, true); r.SetOption(Route.RouteOption.DoNotEmitDegenerateRoutesForRadialRangeGoals, true); r.SetOption(Route.RouteOption.DisallowGoalsOnBridges, true); } } } if (!GoHere.Settings.mAllowMermaidRouting) { r.SetOption2(Route.RouteOption2.RouteAsMermaid, false); } // why did he use routeSim here? It seems to always be null... if ((routeSim != null) && (routeSim.Occupation != null)) { if (routeSim.SimDescription.GetOutfitCount(OutfitCategories.Career) == 0) { routeSim.Occupation.SetOccupationOutfitForCurrentLevel(); } } if (!r.PlanResult.Succeeded()) { msg += Common.NewLine + "A: " + r.PlanResult + " False"; DoRouteFailureBehavior(r); mOwnerSim.AddExitReason(ExitReason.RouteFailed); return(false); } bool flag = false; IGameObject destObj = r.DestObj as IGameObject; try { if (destObj != null) { destObj.AddToRoutingReferenceList(mOwnerSim); mOwnerSim.LookAtManager.SetRoutingLookAt(destObj as GameObject); } mbIgnoreAllObstaclesStartTimeValid = false; if (mOwnerSim.IsActiveSim) { Route.SetFadePriority(mOwnerSim.ObjectId, 0x186a3); } else if (mOwnerSim.IsInActiveHousehold) { Route.SetFadePriority(mOwnerSim.ObjectId, 0x186a2); } else { Route.SetFadePriority(mOwnerSim.ObjectId, 0x186a1); } while (true) { flag = false; if (mbPushRequested) { if ((!(mOwnerSim.Posture is SittingInVehicle) && !(mOwnerSim.Posture is SittingInBoat)) && (mOwnerSim.RoutingComponent.RoutingParent == null)) { try { MidRouteBePushed(r.ExecutionFromNonSimTaskIsSafe); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(routeSim, e); } r.Replan(); } else { mbPushRequested = false; } continue; } StartPushImmunity(OnRouteStartedImmuneToPushesDuration); flag = DoSingleRouteEx(r, true); flag &= r.PlanResult.Succeeded(); if (mbPushRequested) { continue; } if (r.GetOption(Route.RouteOption.CheckForFootprintsNearGoals)) { ObjectGuid guid = r.IsPointObstructedBySim(mOwnerSim.PositionOnFloor); if (guid != ObjectGuid.InvalidObjectGuid) { ObjectGuid runningTargetId = ObjectGuid.InvalidObjectGuid; if (((mOwnerSim.InteractionQueue != null) && (mOwnerSim.InteractionQueue.RunningInteraction != null)) && (mOwnerSim.InteractionQueue.RunningInteraction.Target != null)) { runningTargetId = mOwnerSim.InteractionQueue.RunningInteraction.Target.ObjectId; } if ((guid != runningTargetId) && !PushSims(mOwnerSim.PositionOnFloor, 0.5f, false)) { bool option = r.GetOption(Route.RouteOption.BlockedByPeople); r.SetOption(Route.RouteOption.BlockedByPeople, true); r.Replan(); r.SetOption(Route.RouteOption.BlockedByPeople, option); if (r.PlanResult.Succeeded() && (r.IsPointObstructedBySim(mOwnerSim.PositionOnFloor) == ObjectGuid.InvalidObjectGuid)) { continue; } StartPushImmunity(OnEmergencyGetAwayRouteStartedImmuneToPushesDuration); Route route = PlanRouteForPush(mOwnerSim, null, PushSimsAwayDistanceMin, PushSimsAwayDistanceMax); DoSingleRouteEx(route, false); flag = false; if (r.DoRouteFail) { Sim sim = guid.ObjectFromId <Sim>(); PlayRouteFailureIfAppropriate(sim); } RouteFailureTurnJigBlocker = ObjectGuid.InvalidObjectGuid; HasRouteFailureFromTurnJig = false; msg += Common.NewLine + "B: " + r.PlanResult + " " + flag; return(flag); } } } break; } if (HasRouteFailureFromTurnJig && r.DoRouteFail) { GameObject obj3 = GameObject.GetObject(RouteFailureTurnJigBlocker); PlayRouteFailureIfAppropriate(obj3); } } finally { if (destObj != null) { destObj.RemoveFromRoutingReferenceList(mOwnerSim); } mbIgnoreAllObstaclesStartTimeValid = false; mbPushImmunityStartTimeValid = false; Route.SetFadePriority(mOwnerSim.ObjectId, 0x186a0); mOwnerSim.LookAtManager.SetRoutingLookAt(null); } RouteFailureTurnJigBlocker = ObjectGuid.InvalidObjectGuid; HasRouteFailureFromTurnJig = false; msg += Common.NewLine + "C: " + flag; return(flag); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(routeSim, e); throw; } finally { //Common.DebugNotify(msg, routeSim); } }
public static void ShouldBabyOrToddler(Sims3.Gameplay.ActorSystems.InteractionQueue simIQ) { if (simIQ.mBabyOrToddlerTransitionTargetInteraction != null) { return; } DaycareTransportSituation daycareTransportSituation = DaycareSituation.GetDaycareSituationForSim(simIQ.mActor) as DaycareTransportSituation; if (daycareTransportSituation != null) { return; } Sim sim = simIQ.mActor; InteractionInstance interactionInstance = simIQ.mInteractionList._items[0]; if (interactionInstance == null) { return; } Lot targetLot = interactionInstance.GetTargetLot(); LotLocation location = LotLocation.Invalid; World.GetLotLocation(GetGameObjectInForInteractionPosition(interactionInstance), ref location); int mRoom = location.mRoom; int mLevel = location.mLevel; if (interactionInstance.Target == simIQ.mActor || interactionInstance.Target == simIQ.mActor.Posture.Container) { return; } ItemComponent itemComp = interactionInstance.Target.ItemComp; if ((itemComp != null && itemComp.InventoryParent != null && itemComp.InventoryParent.Owner == sim) || simIQ.TryLocalToddlerCareRules(sim, interactionInstance, targetLot, mLevel, mRoom) || interactionInstance is Terrain.GoHereWith || (interactionInstance is Terrain.TeleportMeHere && !(interactionInstance is Terrain.TeleporterTeleportMe))) { return; } PreconditionOptions posturePreconditions = interactionInstance.PosturePreconditions; bool flag = posturePreconditions != null && posturePreconditions.ContainsPosture(CommodityKind.CarryingChild); Lot lotHome = sim.LotHome; bool flag2 = lotHome == sim.LotCurrent; if (flag2 && lotHome != null && lotHome.HasVirtualResidentialSlots) { flag2 = !sim.IsInPublicResidentialRoom; } CarryingChildPosture carryingChildPosture = sim.CarryingChildPosture; if (carryingChildPosture != null && carryingChildPosture.Child.Household == sim.Household && !flag2 && !flag) { if (simIQ.ShouldTakeBabyOrToddlerWithUsTo(interactionInstance)) { float num = (sim.Position - GetGameObjectInForInteractionPosition(interactionInstance)).LengthSqr(); float num2 = 0.99f / num; float num3 = 9.01f + num2 % num; if (!(num < num2) && !(num > num3)) { return; } Route route = sim.CreateRoute(); int[] validRooms = new int[1] { interactionInstance.Target.RoomId }; route.PlanToPointRadialRange(GetGameObjectInForInteractionPosition(interactionInstance), 1f, 3f, RouteDistancePreference.NoPreference, RouteOrientationPreference.NoPreference, targetLot.LotId, validRooms); if (route.PlanResult.Succeeded()) { float num4 = (route.GetDestPoint() - sim.Position).LengthSqr(); if (num4 >= 0.00250000018f) { Terrain.GoHere goHere = Terrain.GoHere.OtherLotWithCarriedChildSingleton.CreateInstance(Terrain.Singleton, sim, interactionInstance.GetPriority(), interactionInstance.Autonomous, true) as Terrain.GoHere; goHere.SetDestination(route.PlanResult.mDestination, false); simIQ.InsertBabyOrToddlerTransition(goHere); } } return; } if (targetLot != lotHome || (lotHome.HasVirtualResidentialSlots && sim.IsInPublicResidentialRoom && !targetLot.IsRoomPublic(mRoom))) { simIQ.InsertTakeBabyOrToddlerHome(sim, interactionInstance); return; } } if ((interactionInstance.Autonomous || CaregiverRoutingMonitor.TreatPlayerSimsLikeNPCs) && sim.SimDescription.TeenOrAbove && sim.Household != null && sim.Household.LotHome != null && sim.InheritedPriority().Level < InteractionPriorityLevel.ESRB) { bool flag3 = false; bool flag4 = false; if (targetLot == null || targetLot.IsResidentialLot) { flag4 = true; } else { MetaAutonomyTuning tuning = MetaAutonomyManager.GetTuning(interactionInstance.GetTargetLot().GetMetaAutonomyVenueType()); if (tuning != null) { flag3 = tuning.BabiesCanVisit; flag4 = tuning.ToddlersCanVisit; } } if (flag3 || flag4) { foreach (Sim sim2 in sim.Household.Sims) { if ((!sim2.SimDescription.Baby || sim2.LotCurrent != sim2.LotHome) && (!sim2.SimDescription.Baby || flag3) && (!sim2.SimDescription.Toddler || flag4) && sim2.SimDescription.ToddlerOrBelow && sim2.LotCurrent == sim.LotCurrent) { if (CaregiverRoutingMonitor.EnoughCaregiversRemain(sim.Household, sim.LotCurrent, false) || (carryingChildPosture != null && carryingChildPosture.Child.Household == sim.Household) || (!flag && flag2)) { break; } simIQ.InsertPickUpBabyOrToddler(sim, sim2, sim2.LotCurrent.IsActive || sim2.Posture.Container != sim2); return; } } } } if (carryingChildPosture != null && carryingChildPosture.Child.Household != sim.Household) { simIQ.InsertPutDownBabyOrToddler(sim); return; } if (carryingChildPosture != null) { DaycareSituation daycareSituationForChild = DaycareSituation.GetDaycareSituationForChild(carryingChildPosture.Child); if (daycareSituationForChild != null && daycareSituationForChild.Lot != interactionInstance.GetTargetLot()) { simIQ.InsertPutDownBabyOrToddler(sim); return; } } if ((interactionInstance.Autonomous || CaregiverRoutingMonitor.TreatPlayerSimsLikeNPCs) && carryingChildPosture != null && carryingChildPosture.Child.SimDescription.Baby && flag2 && targetLot != sim.LotCurrent) { simIQ.InsertPutDownBabyOrToddler(sim); } else if (sim.Household != null && sim.Household.LotHome != null) { foreach (Sim sim3 in sim.Household.Sims) { if (sim3.SimDescription.ToddlerOrBelow) { CaregiverRoutingMonitor.StartMonitoring(sim3); } } } }