public void ServerCardSwiped(BaseEntity.RPCMessage msg)
    {
        if (!this.IsPowered() || (double)Vector3Ex.Distance2D(((Component)msg.player).get_transform().get_position(), ((Component)this).get_transform().get_position()) > 1.0 || (this.IsInvoking(new Action(this.GrantCard)) || this.IsInvoking(new Action(this.FailCard))))
        {
            return;
        }
        uint    uid     = msg.read.UInt32();
        Keycard keycard = BaseNetworkable.serverEntities.Find(uid) as Keycard;

        Effect.server.Run(this.swipeEffect.resourcePath, this.audioPosition.get_position(), Vector3.get_up(), msg.player.net.get_connection(), false);
        if (!Object.op_Inequality((Object)keycard, (Object)null))
        {
            return;
        }
        Item obj = keycard.GetItem();

        if (obj != null && keycard.accessLevel == this.accessLevel && (double)obj.conditionNormalized > 0.0)
        {
            this.Invoke(new Action(this.GrantCard), 0.5f);
            obj.LoseCondition(1f);
        }
        else
        {
            this.Invoke(new Action(this.FailCard), 0.5f);
        }
    }
Beispiel #2
0
    public void ServerCardSwiped(BaseEntity.RPCMessage msg)
    {
        if (!this.IsPowered())
        {
            return;
        }
        if (Vector3Ex.Distance2D(msg.player.transform.position, base.transform.position) > 1f)
        {
            return;
        }
        if (base.IsInvoking(new Action(this.GrantCard)) || base.IsInvoking(new Action(this.FailCard)))
        {
            return;
        }
        uint    num     = msg.read.UInt32();
        Keycard keycard = BaseNetworkable.serverEntities.Find(num) as Keycard;

        Effect.server.Run(this.swipeEffect.resourcePath, this.audioPosition.position, Vector3.up, msg.player.net.connection, false);
        if (keycard != null)
        {
            Item item = keycard.GetItem();
            if (item != null && keycard.accessLevel == this.accessLevel && item.conditionNormalized > 0f)
            {
                base.Invoke(new Action(this.GrantCard), 0.5f);
                item.LoseCondition(1f);
                return;
            }
            base.Invoke(new Action(this.FailCard), 0.5f);
        }
    }
Beispiel #3
0
    public void ServerCardSwiped(RPCMessage msg)
    {
        if (!IsPowered() || Vector3Ex.Distance2D(msg.player.transform.position, base.transform.position) > 1f || IsInvoking(GrantCard) || IsInvoking(FailCard))
        {
            return;
        }
        uint    uid     = msg.read.UInt32();
        Keycard keycard = BaseNetworkable.serverEntities.Find(uid) as Keycard;

        Effect.server.Run(swipeEffect.resourcePath, audioPosition.position, Vector3.up, msg.player.net.connection);
        if (keycard != null && Interface.CallHook("OnCardSwipe", this, keycard, msg.player) == null)
        {
            Item item = keycard.GetItem();
            if (item != null && keycard.accessLevel == accessLevel && item.conditionNormalized > 0f)
            {
                Invoke(GrantCard, 0.5f);
                item.LoseCondition(1f);
            }
            else
            {
                Invoke(FailCard, 0.5f);
            }
        }
    }