Exemple #1
0
        public static Vector3 get_non_world_lot_pos(Sim actor_obj = null, Sim target_obj = null, bool safe = true)
        {
            bool is_t_null = false;

            if (target_obj == null)
            {
                is_t_null  = true;
                target_obj = actor_obj;
            }

            if (target_obj != null)
            {
                var lotC = target_obj.LotCurrent;
                Lot lotHome;

                if (lotC != null)
                {
                    if (lotC.IsWorldLot)
                    {
                        lotHome = target_obj.LotHome;
                        if (lotHome != null && !(lotHome is WorldLot))
                        {
                            return(lotHome.EntryPoint());
                        }
                    }
                    else
                    {
                        return(target_obj.Position);
                    }
                }

                if (is_t_null)
                {
                    actor_obj = null;
                }

                var other_obj = actor_obj ?? NFinalizeDeath.ActiveActor_AAndChildAndTeen;// ?? NFinalizeDeath.GetRandomSim();
                if (other_obj != null)
                {
                    lotC = other_obj.LotCurrent;
                    if (lotC != null)
                    {
                        if (lotC.IsWorldLot)
                        {
                            lotHome = other_obj.LotHome;
                            if (lotHome != null && !(lotHome is WorldLot))
                            {
                                return(lotHome.EntryPoint());
                            }
                        }
                        else
                        {
                            var other_obj_pos = NFinalizeDeath.GetPositionBase
                                                    (other_obj.ObjectId.mValue);

                            other_obj_pos +=
                                (NFinalizeDeath.Random_CoinFlip() ? 1.8f : 2.7f) *
                                NFinalizeDeath.GetForwardBase(other_obj.ObjectId.mValue);

                            if (!(GetPostionTargetLot(other_obj_pos) is WorldLot))
                            {
                                return(other_obj_pos);
                            }
                        }
                    }
                }
            }

            var t = GetCameraTargetLot();

            if (t is WorldLot)
            {
                var lots = LotManager.sLots;
                if (lots != null && lots.Count > 0)
                {
                    foreach (var item in lots)
                    {
                        Lot item_lot = item.value;
                        if (item_lot == null || item_lot.IsWorldLot)
                        {
                            continue;
                        }
                        return(item_lot.EntryPoint());
                    }
                }
                if (!safe)
                {
                    var p = ScriptCore.CameraController.Camera_GetTarget();
                    if (NFinalizeDeath.Vector3_IsUnsafe(p))
                    {
                        return(snwlot_return_failed);
                    }
                    else
                    {
                        return(p);
                    }
                }
                else
                {
                    return(snwlot_return_failed);
                }
            }
            else
            {
                return(t.EntryPoint());
            }
        }