public void ServerSetFrequency(BaseEntity.RPCMessage msg)
    {
        if (msg.player == null || !msg.player.CanBuild())
        {
            return;
        }
        if (!this.playerUsable)
        {
            return;
        }
        if (UnityEngine.Time.time < this.nextChangeTime)
        {
            return;
        }
        this.nextChangeTime = UnityEngine.Time.time + 2f;
        int num = msg.read.Int32();

        if (RFManager.IsReserved(num))
        {
            RFManager.ReserveErrorPrint(msg.player);
            return;
        }
        RFManager.ChangeFrequency(this.frequency, num, this, false, this.IsPowered());
        this.frequency = num;
        this.MarkDirty();
        base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
    }
예제 #2
0
    public void ServerSetFrequency(BaseEntity.RPCMessage msg)
    {
        if (msg.player == null || !msg.player.CanBuild())
        {
            return;
        }
        if (base.GetOwnerPlayer() != msg.player)
        {
            return;
        }
        if (UnityEngine.Time.time < this.nextChangeTime)
        {
            return;
        }
        this.nextChangeTime = UnityEngine.Time.time + 2f;
        int num = msg.read.Int32();

        if (RFManager.IsReserved(num))
        {
            RFManager.ReserveErrorPrint(msg.player);
            return;
        }
        RFManager.ChangeFrequency(this.frequency, num, this, false, base.IsOn());
        this.frequency = num;
        base.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
        Item item = this.GetItem();

        if (item != null)
        {
            item.MarkDirty();
        }
    }
예제 #3
0
    public void ServerSetFrequency(BaseEntity.RPCMessage msg)
    {
        if (Object.op_Equality((Object)msg.player, (Object)null) || !msg.player.CanBuild() || (Object.op_Inequality((Object)this.GetOwnerPlayer(), (Object)msg.player) || (double)Time.get_time() < (double)this.nextChangeTime))
        {
            return;
        }
        this.nextChangeTime = Time.get_time() + 2f;
        int num = msg.read.Int32();

        if (RFManager.IsReserved(num))
        {
            RFManager.ReserveErrorPrint(msg.player);
        }
        else
        {
            RFManager.ChangeFrequency(this.frequency, num, (IRFObject)this, false, this.IsOn());
            this.frequency = num;
            this.SendNetworkUpdate(BasePlayer.NetworkQueue.Update);
            this.GetItem()?.MarkDirty();
        }
    }
예제 #4
0
    public void ServerSetFrequency(RPCMessage msg)
    {
        if (msg.player == null || !msg.player.CanBuild() || GetOwnerPlayer() != msg.player || UnityEngine.Time.time < nextChangeTime)
        {
            return;
        }
        nextChangeTime = UnityEngine.Time.time + 2f;
        int num = msg.read.Int32();

        if (RFManager.IsReserved(num))
        {
            RFManager.ReserveErrorPrint(msg.player);
        }
        else
        {
            if (Interface.CallHook("OnRfFrequencyChange", this, num, msg.player) != null)
            {
                return;
            }
            RFManager.ChangeFrequency(frequency, num, this, false, IsOn());
            frequency = num;
            SendNetworkUpdate();
            Item item = GetItem();
            if (item != null)
            {
                if (item.instanceData == null)
                {
                    item.instanceData            = new ProtoBuf.Item.InstanceData();
                    item.instanceData.ShouldPool = false;
                }
                item.instanceData.dataInt = frequency;
                item.MarkDirty();
            }
            Interface.CallHook("OnRfFrequencyChanged", this, num, msg.player);
        }
    }