Exemple #1
0
    // Token: 0x06002115 RID: 8469 RVA: 0x0007A0B4 File Offset: 0x000782B4
    public static global::NetEntityID.Kind Of(GameObject entity, out global::NetEntityID entID, out MonoBehaviour view)
    {
        if (!entity)
        {
            entID = global::NetEntityID.unassigned;
            view  = null;
            return(global::NetEntityID.Kind.Missing);
        }
        uLink.NetworkView component = entity.GetComponent <uLink.NetworkView>();
        if (component)
        {
            entID = new global::NetEntityID(component.viewID);
            view  = component;
            return(global::NetEntityID.Kind.Net);
        }
        global::NGCView component2 = entity.GetComponent <global::NGCView>();

        if (component2)
        {
            entID = new global::NetEntityID(component2);
            view  = component2;
            return(global::NetEntityID.Kind.NGC);
        }
        entID = global::NetEntityID.unassigned;
        view  = null;
        return(global::NetEntityID.Kind.Missing);
    }
    // Token: 0x06003536 RID: 13622 RVA: 0x000C3AF8 File Offset: 0x000C1CF8
    public virtual void Local_SecondaryFire(global::ViewModel vm, global::ItemRepresentation itemRep, global::IMeleeWeaponItem itemInstance, ref global::HumanController.InputSample sample)
    {
        global::Character character = itemInstance.character;

        if (character == null)
        {
            return;
        }
        Ray        eyesRay = character.eyesRay;
        RaycastHit raycastHit;
        bool       flag = Physics.SphereCast(eyesRay, 0.3f, ref raycastHit, this.GetRange(), 406721553);

        if (flag)
        {
            IDBase component = raycastHit.collider.gameObject.GetComponent <IDBase>();
            if (component)
            {
                global::NetEntityID    netEntityID = global::NetEntityID.Get(component);
                global::RepairReceiver local       = component.GetLocal <global::RepairReceiver>();
                if (local != null && netEntityID != global::NetEntityID.unassigned)
                {
                    if (vm)
                    {
                        vm.PlayFireAnimation();
                    }
                    itemInstance.QueueSwingSound(Time.time + this.swingSoundDelay);
                    itemRep.Action <global::NetEntityID>(2, 0, netEntityID);
                }
            }
        }
    }
    protected void SACH(global::NetEntityID makingForCharacterIDNow, uLink.NetworkMessageInfo info)
    {
        AudioSource audio = base.audio;

        if (audio)
        {
            audio.Play();
        }
    }
    // Token: 0x0600353C RID: 13628 RVA: 0x000C4068 File Offset: 0x000C2268
    public override void DoAction2(BitStream stream, global::ItemRepresentation rep, ref uLink.NetworkMessageInfo info)
    {
        global::NetEntityID netEntityID = stream.Read <global::NetEntityID>(new object[0]);

        if (!netEntityID.isUnassigned)
        {
            IDBase idBase = netEntityID.idBase;
            if (!idBase)
            {
                return;
            }
        }
    }
Exemple #5
0
 // Token: 0x0600210A RID: 8458 RVA: 0x00079F14 File Offset: 0x00078114
 public static global::NetEntityID.Kind Of(Component component, out global::NetEntityID entID, out MonoBehaviour view)
 {
     if (component is MonoBehaviour)
     {
         return(global::NetEntityID.Of((MonoBehaviour)component, out entID, out view));
     }
     if (component)
     {
         return(global::NetEntityID.Of(component.gameObject, out entID, out view));
     }
     entID = global::NetEntityID.unassigned;
     view  = null;
     return(global::NetEntityID.Kind.Missing);
 }
Exemple #6
0
    // Token: 0x06002108 RID: 8456 RVA: 0x00079E68 File Offset: 0x00078068
    private static void Serializer(BitStream bs, object value, params object[] codecOptions)
    {
        global::NetEntityID netEntityID = (global::NetEntityID)value;

        bs.Write <ushort>(netEntityID.p1, codecOptions);
        if (netEntityID.p1 == 0)
        {
            bs.Write <uLink.NetworkViewID>(netEntityID._viewID, codecOptions);
        }
        else
        {
            bs.Write <ushort>(netEntityID.p2, new object[0]);
        }
    }
Exemple #7
0
    // Token: 0x06002109 RID: 8457 RVA: 0x00079EBC File Offset: 0x000780BC
    private static object Deserializer(BitStream bs, params object[] codecOptions)
    {
        global::NetEntityID netEntityID = default(global::NetEntityID);

        netEntityID.p1 = bs.Read <ushort>(codecOptions);
        if (netEntityID.p1 == 0)
        {
            netEntityID._viewID = bs.Read <uLink.NetworkViewID>(codecOptions);
        }
        else
        {
            netEntityID.p2 = bs.Read <ushort>(codecOptions);
        }
        return(netEntityID);
    }
Exemple #8
0
 // Token: 0x0600210E RID: 8462 RVA: 0x00079FAC File Offset: 0x000781AC
 public static global::NetEntityID.Kind Of(MonoBehaviour script, out global::NetEntityID entID, out MonoBehaviour view)
 {
     if (!script)
     {
         entID = global::NetEntityID.unassigned;
         view  = null;
         return(global::NetEntityID.Kind.Missing);
     }
     if (script is uLink.NetworkView)
     {
         view  = script;
         entID = ((uLink.NetworkView)script).viewID;
         return(global::NetEntityID.Kind.Net);
     }
     if (script is global::NGCView)
     {
         view  = script;
         entID = new global::NetEntityID((global::NGCView)script);
         return(global::NetEntityID.Kind.NGC);
     }
     return(global::NetEntityID.Of(script.gameObject, out entID, out view));
 }
Exemple #9
0
    // Token: 0x060035F8 RID: 13816 RVA: 0x000C4DD0 File Offset: 0x000C2FD0
    public virtual void FireSingleBullet(BitStream sendStream, Ray ray, global::ItemRepresentation itemRep, out Component hitComponent, out bool allowBlood)
    {
        global::NetEntityID hitView = global::NetEntityID.unassigned;
        bool        flag            = false;
        RaycastHit2 raycastHit;
        bool        flag2 = Physics2.Raycast2(ray, ref raycastHit, this.GetBulletRange(itemRep), 406721553);

        if (flag2)
        {
            Vector3 point = raycastHit.point;
            IDBase  id    = raycastHit.id;
            hitComponent = ((!raycastHit.remoteBodyPart) ? raycastHit.collider : raycastHit.remoteBodyPart);
            IDMain idmain = (!id) ? null : id.idMain;
            if (idmain)
            {
                hitView = global::NetEntityID.Get(idmain);
                if (!hitView.isUnassigned)
                {
                    global::TakeDamage component = idmain.GetComponent <global::TakeDamage>();
                    if (component)
                    {
                        flag = true;
                        if (component.ShouldPlayHitNotification())
                        {
                            this.PlayHitNotification(point, null);
                        }
                    }
                }
            }
        }
        else
        {
            Vector3 point = ray.GetPoint(this.GetBulletRange(itemRep));
            hitComponent = null;
        }
        this.WriteHitInfo(sendStream, ref ray, flag2, ref raycastHit, flag, hitView);
        allowBlood = (flag2 && flag);
    }
    // Token: 0x0600353E RID: 13630 RVA: 0x000C40B0 File Offset: 0x000C22B0
    public override void DoAction1(BitStream stream, global::ItemRepresentation rep, ref uLink.NetworkMessageInfo info)
    {
        bool       flag = stream.ReadBoolean();
        GameObject gameObject;

        if (flag)
        {
            global::NetEntityID netEntityID = stream.Read <global::NetEntityID>(new object[0]);
            if (!netEntityID.isUnassigned)
            {
                gameObject = netEntityID.gameObject;
                if (!gameObject)
                {
                    netEntityID = global::NetEntityID.unassigned;
                }
            }
            else
            {
                gameObject = null;
            }
        }
        else
        {
            global::NetEntityID netEntityID = global::NetEntityID.unassigned;
            gameObject = null;
        }
        Vector3 vector = stream.ReadVector3();
        bool    flag2  = stream.ReadBoolean();

        this.EndSwingWorldAnimations(rep);
        if (gameObject)
        {
            Quaternion rot = Quaternion.LookRotation((rep.transform.position - vector).normalized);
            this.DoMeleeEffects(rep.transform.position, vector, rot, gameObject);
        }
    }
    // Token: 0x0600353A RID: 13626 RVA: 0x000C3E1C File Offset: 0x000C201C
    public virtual void Local_MidSwing(global::ViewModel vm, global::ItemRepresentation itemRep, global::IMeleeWeaponItem itemInstance, ref global::HumanController.InputSample sample)
    {
        global::Character character = itemInstance.character;

        if (character == null)
        {
            return;
        }
        Ray                 eyesRay     = character.eyesRay;
        Collider            collider    = null;
        Vector3             zero        = Vector3.zero;
        Vector3             up          = Vector3.up;
        global::NetEntityID netEntityID = global::NetEntityID.unassigned;
        bool                flag        = false;
        BodyPart            bodyPart;
        bool                flag2      = this.Physics2SphereCast(eyesRay, 0.3f, this.GetRange(), 406721553, out zero, out up, out collider, out bodyPart);
        bool                flag3      = false;
        global::TakeDamage  takeDamage = null;

        if (flag2)
        {
            IDBase idbase;
            global::TransformHelpers.GetIDBaseFromCollider(collider, out idbase);
            IDMain idmain = (!idbase) ? null : idbase.idMain;
            if (idmain)
            {
                netEntityID = global::NetEntityID.Get(idmain);
                flag        = !netEntityID.isUnassigned;
                takeDamage  = idmain.GetComponent <global::TakeDamage>();
                if (takeDamage && takeDamage.ShouldPlayHitNotification())
                {
                    this.PlayHitNotification(zero, character);
                }
            }
            flag3 = collider.gameObject.CompareTag("Tree Collider");
            if (flag3)
            {
                global::WoodBlockerTemp blockerForPoint = global::WoodBlockerTemp.GetBlockerForPoint(zero);
                if (!blockerForPoint.HasWood())
                {
                    flag3 = false;
                    Rust.Notice.Popup("", "There's no wood left here", 2f);
                }
                else
                {
                    blockerForPoint.ConsumeWood(this.efficiencies[2]);
                }
            }
            this.DoMeleeEffects(eyesRay.origin, zero, Quaternion.LookRotation(up), collider.gameObject);
            if (vm && (takeDamage || flag3))
            {
                vm.CrossFade("pull_out", 0.05f, 0, 1.1f);
            }
        }
        BitStream bitStream = new BitStream(false);

        if (flag)
        {
            bitStream.WriteBoolean(flag);
            bitStream.Write <global::NetEntityID>(netEntityID, new object[0]);
            bitStream.WriteVector3(zero);
        }
        else
        {
            bitStream.WriteBoolean(false);
            bitStream.WriteVector3(zero);
        }
        bitStream.WriteBoolean(flag3);
        itemRep.ActionStream(1, 0, bitStream);
        this.EndSwingWorldAnimations(itemRep);
    }
Exemple #12
0
    // Token: 0x06003316 RID: 13078 RVA: 0x000C07F8 File Offset: 0x000BE9F8
    public virtual void Local_FireWeapon(global::ViewModel vm, global::ItemRepresentation itemRep, global::IBulletWeaponItem itemInstance, ref global::HumanController.InputSample sample)
    {
        global::Character character = itemInstance.character;

        if (character == null)
        {
            return;
        }
        if (itemInstance.clipAmmo <= 0)
        {
            return;
        }
        Ray eyesRay = character.eyesRay;
        global::NetEntityID hitView = global::NetEntityID.unassigned;
        bool hitNetworkView         = false;
        int  num = 1;

        itemInstance.Consume(ref num);
        RaycastHit2        raycastHit;
        bool               flag       = Physics2.Raycast2(eyesRay, ref raycastHit, this.GetBulletRange(itemRep), 406721553);
        global::TakeDamage takeDamage = null;
        Vector3            point;
        Component          hitComponent;

        if (flag)
        {
            point = raycastHit.point;
            IDBase id = raycastHit.id;
            hitComponent = ((!raycastHit.remoteBodyPart) ? raycastHit.collider : raycastHit.remoteBodyPart);
            IDMain idmain = (!id) ? null : id.idMain;
            if (idmain)
            {
                hitView = global::NetEntityID.Get(idmain);
                if (!hitView.isUnassigned)
                {
                    hitNetworkView = true;
                    takeDamage     = idmain.GetComponent <global::TakeDamage>();
                    if (takeDamage && takeDamage.ShouldPlayHitNotification())
                    {
                        this.PlayHitNotification(point, character);
                    }
                    bool flag2 = false;
                    if (raycastHit.remoteBodyPart)
                    {
                        BodyPart bodyPart = raycastHit.remoteBodyPart.bodyPart;
                        switch (bodyPart)
                        {
                        case 16:
                        case 20:
                        case 21:
                            break;

                        default:
                            switch (bodyPart)
                            {
                            case 9:
                            case 12:
                                goto IL_164;
                            }
                            flag2 = false;
                            goto IL_174;
                        }
IL_164:
                        flag2 = true;
                    }
IL_174:
                    if (flag2)
                    {
                        this.headshotSound.Play();
                    }
                }
            }
        }
        else
        {
            point        = eyesRay.GetPoint(1000f);
            hitComponent = null;
        }
        bool           allowBlood = flag && (!raycastHit.isHitboxHit || BodyParts.IsDefined(raycastHit.bodyPart) || takeDamage != null);
        global::Socket socket;
        bool           flag3;

        if (vm)
        {
            socket = vm.socketMap["muzzle"].socket;
            flag3  = true;
        }
        else
        {
            socket = itemRep.muzzle;
            flag3  = false;
        }
        Vector3 position = socket.position;

        this.DoWeaponEffects(character.transform, position, point, socket, flag3, hitComponent, allowBlood, itemRep);
        if (flag3)
        {
            vm.PlayFireAnimation();
        }
        float num2  = 1f;
        bool  flag4 = sample.aim && sample.crouch;

        if (flag4)
        {
            num2 -= this.aimingRecoilSubtract + this.crouchRecoilSubtract * 0.5f;
        }
        else if (sample.aim)
        {
            num2 -= this.aimingRecoilSubtract;
        }
        else if (sample.crouch)
        {
            num2 -= this.crouchRecoilSubtract;
        }
        num2 = Mathf.Clamp01(num2);
        float pitch = Random.Range(this.recoilPitchMin, this.recoilPitchMax) * num2;
        float yaw   = Random.Range(this.recoilYawMin, this.recoilYawMax) * num2;

        if (!global::BulletWeaponDataBlock.weaponRecoil && character.recoilSimulation)
        {
            character.recoilSimulation.AddRecoil(this.recoilDuration, pitch, yaw);
        }
        global::HeadBob component = global::CameraMount.current.GetComponent <global::HeadBob>();

        if (component && this.shotBob && global::BulletWeaponDataBlock.headRecoil)
        {
            component.AddEffect(this.shotBob);
        }
        BitStream bitStream = new BitStream(false);

        this.WriteHitInfo(bitStream, ref eyesRay, flag, ref raycastHit, hitNetworkView, hitView);
        itemRep.ActionStream(1, 0, bitStream);
    }
Exemple #13
0
    // Token: 0x06003319 RID: 13081 RVA: 0x000C0CA0 File Offset: 0x000BEEA0
    protected virtual void ReadHitInfo(BitStream stream, out GameObject hitObj, out bool hitNetworkObj, out bool hitBodyPart, out BodyPart bodyPart, out IDRemoteBodyPart remoteBodyPart, out global::NetEntityID hitViewID, out Transform fromTransform, out Vector3 endPos, out Vector3 offset, out bool isHeadshot)
    {
        byte b = stream.ReadByte();

        if (b < 255)
        {
            hitNetworkObj = true;
            if (b < 120)
            {
                hitBodyPart = true;
                bodyPart    = (int)b;
            }
            else
            {
                hitBodyPart = false;
                bodyPart    = 0;
            }
        }
        else
        {
            hitNetworkObj = false;
            hitBodyPart   = false;
            bodyPart      = 0;
        }
        if (hitNetworkObj)
        {
            hitViewID = stream.Read <global::NetEntityID>(new object[0]);
            if (!hitViewID.isUnassigned)
            {
                hitObj = hitViewID.gameObject;
                if (hitObj)
                {
                    IDBase idbase = IDBase.Get(hitObj);
                    if (idbase)
                    {
                        IDMain idMain = idbase.idMain;
                        if (idMain)
                        {
                            global::HitBoxSystem hitBoxSystem;
                            if (idMain is global::Character)
                            {
                                hitBoxSystem = ((global::Character)idMain).hitBoxSystem;
                            }
                            else
                            {
                                hitBoxSystem = idMain.GetRemote <global::HitBoxSystem>();
                            }
                            if (hitBoxSystem)
                            {
                                hitBoxSystem.bodyParts.TryGetValue(bodyPart, ref remoteBodyPart);
                            }
                            else
                            {
                                remoteBodyPart = null;
                            }
                        }
                        else
                        {
                            remoteBodyPart = null;
                        }
                    }
                    else
                    {
                        remoteBodyPart = null;
                    }
                }
                else
                {
                    remoteBodyPart = null;
                }
            }
            else
            {
                hitObj         = null;
                remoteBodyPart = null;
            }
        }
        else
        {
            hitViewID      = global::NetEntityID.unassigned;
            hitObj         = null;
            remoteBodyPart = null;
        }
        endPos = stream.ReadVector3();
        offset = Vector3.zero;
        if (remoteBodyPart)
        {
            fromTransform = remoteBodyPart.transform;
            BodyPart bodyPart2 = bodyPart;
            switch (bodyPart2)
            {
            case 16:
            case 20:
            case 21:
                break;

            default:
                switch (bodyPart2)
                {
                case 9:
                case 12:
                    goto IL_1A3;
                }
                isHeadshot = false;
                goto IL_1B5;
            }
IL_1A3:
            isHeadshot = true;
            IL_1B5 :;
        }
        else if (hitObj)
        {
            fromTransform = hitObj.transform;
            isHeadshot    = false;
        }
        else
        {
            fromTransform = null;
            isHeadshot    = false;
        }
        if (fromTransform)
        {
            offset = endPos;
            endPos = fromTransform.TransformPoint(endPos);
        }
    }
Exemple #14
0
 // Token: 0x06002106 RID: 8454 RVA: 0x00079E40 File Offset: 0x00078040
 public int CompareTo(global::NetEntityID other)
 {
     return(this.v.CompareTo(other.v));
 }
Exemple #15
0
    // Token: 0x06002114 RID: 8468 RVA: 0x0007A09C File Offset: 0x0007829C
    public static global::NetEntityID.Kind Of(GameObject entity, out global::NetEntityID entID)
    {
        MonoBehaviour monoBehaviour;

        return(global::NetEntityID.Of(entity, out entID, out monoBehaviour));
    }
Exemple #16
0
    // Token: 0x0600210F RID: 8463 RVA: 0x0007A024 File Offset: 0x00078224
    public static global::NetEntityID.Kind Of(MonoBehaviour script, out global::NetEntityID entID)
    {
        MonoBehaviour monoBehaviour;

        return(global::NetEntityID.Of(script, out entID, out monoBehaviour));
    }
Exemple #17
0
    // Token: 0x0600210B RID: 8459 RVA: 0x00079F64 File Offset: 0x00078164
    public static global::NetEntityID.Kind Of(Component component, out global::NetEntityID entID)
    {
        MonoBehaviour monoBehaviour;

        return(global::NetEntityID.Of(component, out entID, out monoBehaviour));
    }
 // Token: 0x06002D05 RID: 11525 RVA: 0x000A8714 File Offset: 0x000A6914
 public static bool ContextOf(global::NetEntityID entityID, out global::Contextual contextual)
 {
     return(global::Contextual.GetMB(entityID.view, out contextual));
 }
Exemple #19
0
 private void A(global::NetEntityID hit, uLink.NetworkMessageInfo info)
 {
 }
 // Token: 0x06002CE9 RID: 11497 RVA: 0x000A820C File Offset: 0x000A640C
 internal void OnServerQuerySent(MonoBehaviour script, global::NetEntityID entID)
 {
     this.clientQuery = script;
     this.OnClientPromptBegin(new global::NetEntityID?(entID));
 }
Exemple #21
0
    // Token: 0x06003318 RID: 13080 RVA: 0x000C0BF0 File Offset: 0x000BEDF0
    protected virtual void WriteHitInfo(BitStream sendStream, ref Ray ray, bool didHit, ref RaycastHit2 hit, bool hitNetworkView, global::NetEntityID hitView)
    {
        Vector3 vector;

        if (didHit)
        {
            if (hitNetworkView)
            {
                IDRemoteBodyPart remoteBodyPart = hit.remoteBodyPart;
                Transform        transform;
                if (remoteBodyPart)
                {
                    sendStream.WriteByte(remoteBodyPart.bodyPart);
                    transform = remoteBodyPart.transform;
                }
                else
                {
                    sendStream.WriteByte(254);
                    transform = hitView.transform;
                }
                sendStream.Write <global::NetEntityID>(hitView, new object[0]);
                vector = transform.InverseTransformPoint(hit.point);
            }
            else
            {
                sendStream.WriteByte(byte.MaxValue);
                vector = hit.point;
            }
        }
        else
        {
            sendStream.WriteByte(byte.MaxValue);
            vector = ray.GetPoint(1000f);
        }
        sendStream.WriteVector3(vector);
    }
Exemple #22
0
 // Token: 0x06002C5E RID: 11358 RVA: 0x000A6004 File Offset: 0x000A4204
 internal static void Issue_Request(global::NetEntityID clientQueryEntID)
 {
     global::Context.network.RPC <global::NetEntityID>("Context:A", 0, clientQueryEntID);
 }
Exemple #23
0
 // Token: 0x060020FB RID: 8443 RVA: 0x00079BE4 File Offset: 0x00077DE4
 public bool Equals(global::NetEntityID obj)
 {
     return(this.v == obj.v);
 }