public static void AboutToPlanRouteCallback(Route r, string routeType, Vector3 point) { if (r == null || r.Follower == null) { return; } Sim router = r.Follower.Target as Sim; if (router == null) { return; } Lot lot = router.LotCurrent; if (lot == null) { return; } InteractionInstance instance = router.CurrentInteraction; int destRoom = -1; if (instance != null && instance.Target != null) { destRoom = instance.Target.RoomId; } if (destRoom == -1) { return; } if (instance.Autonomous) { return; } //Common.Notify(router.FullName + " trying to route to " + destRoom); /* * int depth = 5; * int currentRoom = 0; * while (depth < 5) * { * if (currentRoom == 0) currentRoom = destRoom; * bool allow = false; * foreach (CommonDoor door in lot.GetObjectsInRoom<CommonDoor>(currentRoom)) * { * if (door != null) * { * CommonDoor.tSide side; * door.GetSideOfDoorInRoom(currentRoom, out side); * if (side != CommonDoor.tSide.Front) continue; * * DoorSettings settings = GoHere.Settings.GetDoorSettings(door.ObjectId, false); * if (settings != null) * { * if (!DoorSettings.TestPortalObject(router, currentRoom, door)) * { * // r.AddObjectToForbiddenPortalList(door.ObjectId); * //r.DoRouteFail = false; * continue; * } * } * * allow = true; * break; * } * } * * if (!allow) router.AddExitReason(ExitReason.CancelExternal); * depth++; * } */ //bool allow = false; foreach (CommonDoor door in lot.GetObjects <CommonDoor>()) // lot.GetObjectsInRoom<CommonDoor>(destRoom) { if (door != null) { DoorSettings settings = GoHere.Settings.GetDoorSettings(door.ObjectId, false); if (settings != null) { if (!DoorSettings.TestPortalObject(router, door.RoomId, door)) { if (r == null) { return; } r.AddObjectToForbiddenPortalList(door.ObjectId); r.DoRouteFail = false; // this seems to be ignored... // for minor zerbu compatability, stops route fail /* * if (destRoom == door.RoomId) * { * Common.Notify(router.FullName + ": denied"); * router.AddExitReason(ExitReason.CancelExternal); * router.InteractionQueue.CancelAllInteractions(); * } */ //router.AddExitReason(ExitReason.CancelExternal); continue; } } //allow = true; //break; } } //if (allow) { } /* * * if (instance != null && Sims3.SimIFace.Route.IsRouteToObjectUnobstructed(router.ObjectId, instance.Target.Position, router.GetRouteOptions(), instance.Target.ObjectId, router.SimDescription.AgeGenderSpecies) != BlockedStatus.Unobstructed) * { * //Common.Notify("Route obstructructed: " + router.SimDescription.FullName + " going to " + instance.Target.GetLocalizedName() + " in " + destRoom); * router.AddExitReason(ExitReason.CanceledByScript); * if (!router.IsInActiveHousehold) * { * router.InteractionQueue.CancelAllInteractions(); * } * } */ }