Exemple #1
0
    public override void AttemptMount(BasePlayer player)
    {
        if (this._mounted != null)
        {
            return;
        }
        if (!this.MountEligable())
        {
            return;
        }
        BaseMountable idealMountPoint = this.GetIdealMountPoint(player.eyes.position);

        if (idealMountPoint == null)
        {
            return;
        }
        if (idealMountPoint != this)
        {
            idealMountPoint.AttemptMount(player);
        }
        else
        {
            base.AttemptMount(player);
        }
        if (player.GetMountedVehicle() == this)
        {
            this.PlayerMounted(player, idealMountPoint);
        }
    }
Exemple #2
0
        public static void mount(Arg arg)
        {
            BasePlayer basePlayer = ArgEx.Player(arg);

            if (!basePlayer.IsAdmin && !basePlayer.IsDeveloper && !Server.cinematic)
            {
                return;
            }
            uint       uInt        = arg.GetUInt(0);
            BasePlayer basePlayer2 = BasePlayer.FindByID(uInt);

            if (basePlayer2 == null)
            {
                basePlayer2 = BasePlayer.FindBot(uInt);
            }
            RaycastHit hitInfo;

            if (!basePlayer2 || !UnityEngine.Physics.Raycast(basePlayer.eyes.position, basePlayer.eyes.HeadForward(), out hitInfo, 5f, 10496, QueryTriggerInteraction.Ignore))
            {
                return;
            }
            BaseEntity entity = RaycastHitEx.GetEntity(hitInfo);

            if (!entity)
            {
                return;
            }
            BaseMountable baseMountable = entity.GetComponent <BaseMountable>();

            if (!baseMountable)
            {
                BaseVehicle baseVehicle = entity.GetComponentInParent <BaseVehicle>();
                if ((bool)baseVehicle)
                {
                    if (!baseVehicle.isServer)
                    {
                        baseVehicle = BaseNetworkable.serverEntities.Find(baseVehicle.net.ID) as BaseVehicle;
                    }
                    baseVehicle.AttemptMount(basePlayer2);
                    return;
                }
            }
            if ((bool)baseMountable && !baseMountable.isServer)
            {
                baseMountable = BaseNetworkable.serverEntities.Find(baseMountable.net.ID) as BaseMountable;
            }
            if ((bool)baseMountable)
            {
                baseMountable.AttemptMount(basePlayer2);
            }
        }
Exemple #3
0
    public override void AttemptMount(BasePlayer player)
    {
        if (Object.op_Inequality((Object)this._mounted, (Object)null) || !this.MountEligable())
        {
            return;
        }
        BaseMountable idealMountPoint = this.GetIdealMountPoint(player.eyes.position);

        if (Object.op_Equality((Object)idealMountPoint, (Object)null))
        {
            return;
        }
        if (Object.op_Equality((Object)idealMountPoint, (Object)this))
        {
            base.AttemptMount(player);
        }
        else
        {
            idealMountPoint.AttemptMount(player);
        }
    }
Exemple #4
0
    public override void AttemptMount(BasePlayer player, bool doMountChecks = true)
    {
        if (_mounted != null || !MountEligable(player))
        {
            return;
        }
        BaseMountable idealMountPointFor = GetIdealMountPointFor(player);

        if (!(idealMountPointFor == null))
        {
            if (idealMountPointFor == this)
            {
                base.AttemptMount(player, doMountChecks);
            }
            else
            {
                idealMountPointFor.AttemptMount(player, doMountChecks);
            }
            if (player.GetMountedVehicle() == this)
            {
                PlayerMounted(player, idealMountPointFor);
            }
        }
    }