コード例 #1
0
ファイル: JakePlugin.cs プロジェクト: rustmy/JakeOxidePlugins
    } //Both functions should return float from 0 - 100f+, indicating violation level

    public void UpdateRecoilViolation(Vector2 recoilAmount, BaseProjectile weapon)
    {
        RecoilProperties recoil           = weapon.recoil;
        Vector2          obviousThreshold = new Vector2(Mathf.Abs(recoil.recoilYawMin - recoil.recoilYawMax), Mathf.Abs(recoil.recoilPitchMax) * 2f);

        if (!(recoil.recoilYawMin < 0 && recoil.recoilYawMax > 0)) //If recoil is only one direction, make limit harder to hit (only horizontal)
        {
            obviousThreshold.Set(obviousThreshold.x * 3f, obviousThreshold.y);
        }
        obviousThreshold /= 350f; //Around 10f y, and
        //JakePlugin.Write("Obvious threshold", obviousThreshold * 1000f);
        JakePlugin.Write(recoilAmount - obviousThreshold * 1000f, "above threshold");
        if (recoilAmount.x <= obviousThreshold.x && recoilAmount.y <= obviousThreshold.y) //Absolute obvious recoil, accounts for sway
        {
            concurrentRecoilViolations++;
            recoilViolationLevel += (concurrentRecoilViolations - 1) * 500f + 100f; //If there is a one off violation, will add a bit
            JakePlugin.Write("Recoil Violation UPDATED ------------->", recoilViolationLevel);
        }
        obviousThreshold *= 5f;
    }
コード例 #2
0
ファイル: JakePlugin.cs プロジェクト: rustmy/JakeOxidePlugins
    public float CheckBoneSnapping(ShootTick tick)
    {
        float distanceOff = 0f;

        if (tick.hitInfo == null)
        {
            JakePlugin.Write("Null Tick for boneSnapping");
            return(float.MaxValue);
        }
        if (tick.hitInfo.HitEntity != null)
        {
            if (tick.hitPlayer)
            {
                BasePlayer player       = (BasePlayer)tick.hitInfo.HitEntity;
                Vector3    bonePos      = player.skeletonProperties.FindBone(tick.hitInfo.HitBone).bone.transform.position;
                Vector3    boneWorldPos = bonePos + player.transform.position;
                JakePlugin.Write(tick.hitInfo.HitBone, bonePos);
            }
        }
        return(distanceOff);
    }
コード例 #3
0
ファイル: JakePlugin.cs プロジェクト: rustmy/JakeOxidePlugins
    public void Update()
    {
        if (player == null)
        {
            JakePlugin.Write("PlayerNull, returning");
            return;
        }

        //JakePlugin.Write(player.displayName, ", items in group:", groupPlayerList.Count);
        //JakePlugin.Write(player.userID, ", players to check:", playersToCheck.Count);

        /*
         * for (int i = 0; i < groupPlayerList.Count; i++)
         * {*/
        for (int i = 0; i < JakePlugin.fakePlayers.Count; i++)
        {
            //PlayerCulling targetPlayerCulling = JakePlugin.customData[groupPlayerList[i].userid].playerCull;
            PlayerCulling targetPlayerCulling = JakePlugin.customData[JakePlugin.fakePlayers[i].userID].playerCull;
            BasePlayer    playerToCheck       = targetPlayerCulling.player;
            if (playerToCheck == player)
            {
                continue;
            }
            if (JakePlugin.customData.ContainsKey(playerToCheck.userID))
            {
                if (targetPlayerCulling.playersToCheck.Contains(player))
                {
                    if (playersToCheck.Contains(playerToCheck))
                    {
                        playersToCheck.Remove(playerToCheck);
                        //JakePlugin.Write("ERROR: Players set to check eachother");
                    }
                    continue;
                }
                else
                {
                    playersToCheck.Add(playerToCheck);
                }

                if (!nextTimeToCheck.ContainsKey(playerToCheck))
                {
                    nextTimeToCheck.Add(playerToCheck, Time.realtimeSinceStartup + PlayerCulling.timeStep);
                }

                if (nextTimeToCheck[playerToCheck] >= Time.realtimeSinceStartup)
                {
                    continue;
                }

                //JakePlugin.Write(string.Format("{0}: Players to check: {1}", player.displayName, playersToCheck.Count));

                targetPlayerCulling.playersToCheck.Add(player);
                float num        = Vector3.Distance(player.eyes.position, playerToCheck.transform.position);
                bool  shouldShow = false;
                if (playerToCheck.IsSleeping() && num > PlayerCulling.maxSleeperDist)
                {
                    JakePlugin.Write("Player sleeping: won't show");
                    shouldShow = false;
                }
                else if (num > PlayerCulling.maxPlayerDist)
                {
                    JakePlugin.Write("Player above max distance: won't show");
                    shouldShow = false;
                }
                else if (num <= PlayerCulling.minCullDist)
                {
                    JakePlugin.Write(playerToCheck.displayName, player.displayName);
                    JakePlugin.Write("Player below min distance: will show");
                    shouldShow = true;
                }
                else if (IsAimingAt(player, playerToCheck, 0.99f))
                {
                    shouldShow = true;
                }
                else if (IsAimingAt(playerToCheck, player, 0.99f))
                {
                    shouldShow = true;
                }
                else
                {
                    Vector3 normalized = (player.eyes.position - player.eyes.position).normalized;
                    float   num2       = Vector3.Dot(player.eyes.HeadForward(), normalized);
                    shouldShow = (num2 >= 0f && AnyPartVisible(player, playerToCheck));
                    //JakePlugin.Write("Playercull Update:", shouldShow);
                }
                PlayerCulling targetCulling = JakePlugin.customData[playerToCheck.userID].playerCull;
                if (shouldShow)
                {
                    nextTimeToCheck[playerToCheck] = Time.realtimeSinceStartup + PlayerCulling.timeVisableAfterSeen;
                    targetCulling.visiblePlayerList.Add(player);
                    visiblePlayerList.Add(playerToCheck);
                }
                else
                {
                    if (playerToCheck.IsSleeping())
                    {
                        nextTimeToCheck[playerToCheck] = Time.realtimeSinceStartup + PlayerCulling.timeToUpdateSleepers;
                    }
                    targetCulling.visiblePlayerList.Remove(player);
                    visiblePlayerList.Remove(playerToCheck);
                }
            }
        }
    }