Example #1
0
    private void RPC_OpenDoor(BaseEntity.RPCMessage rpc)
    {
        if (!rpc.player.CanInteract())
        {
            return;
        }
        if (!this.canHandOpen)
        {
            return;
        }
        if (base.IsOpen())
        {
            return;
        }
        if (base.IsBusy())
        {
            return;
        }
        if (base.IsLocked())
        {
            return;
        }
        BaseLock slot = base.GetSlot(BaseEntity.Slot.Lock) as BaseLock;

        if (slot != null)
        {
            if (!slot.OnTryToOpen(rpc.player))
            {
                return;
            }
            if (slot.IsLocked() && UnityEngine.Time.realtimeSinceStartup - this.decayResetTimeLast > 60f)
            {
                BuildingBlock buildingBlock = base.FindLinkedEntity <BuildingBlock>();
                if (!buildingBlock)
                {
                    Decay.RadialDecayTouch(base.transform.position, 40f, 2097408);
                }
                else
                {
                    Decay.BuildingDecayTouch(buildingBlock);
                }
                this.decayResetTimeLast = UnityEngine.Time.realtimeSinceStartup;
            }
        }
        base.SetFlag(BaseEntity.Flags.Open, true, false, true);
        base.SendNetworkUpdateImmediate(false);
        if (this.isSecurityDoor && this.NavMeshLink != null)
        {
            this.SetNavMeshLinkEnabled(true);
        }
        Interface.CallHook("OnDoorOpened", this, rpc.player);
    }
Example #2
0
    private void RPC_OpenDoor(BaseEntity.RPCMessage rpc)
    {
        if (!rpc.player.CanInteract() || !this.canHandOpen || (this.IsOpen() || this.IsBusy()) || this.IsLocked())
        {
            return;
        }
        BaseLock slot = this.GetSlot(BaseEntity.Slot.Lock) as BaseLock;

        if (Object.op_Inequality((Object)slot, (Object)null))
        {
            if (!slot.OnTryToOpen(rpc.player))
            {
                return;
            }
            if (slot.IsLocked() && (double)Time.get_realtimeSinceStartup() - (double)this.decayResetTimeLast > 60.0)
            {
                BuildingBlock linkedEntity = this.FindLinkedEntity <BuildingBlock>();
                if (Object.op_Implicit((Object)linkedEntity))
                {
                    Decay.BuildingDecayTouch(linkedEntity);
                }
                else
                {
                    Decay.RadialDecayTouch(((Component)this).get_transform().get_position(), 40f, 2097408);
                }
                this.decayResetTimeLast = Time.get_realtimeSinceStartup();
            }
        }
        this.SetFlag(BaseEntity.Flags.Open, true, false, true);
        this.SendNetworkUpdateImmediate(false);
        if (this.isSecurityDoor && Object.op_Inequality((Object)this.NavMeshLink, (Object)null))
        {
            this.SetNavMeshLinkEnabled(true);
        }
        Interface.CallHook("OnDoorOpened", (object)this, (object)rpc.player);
    }