// Door.RPC_CloseDoor()/RPC_OpenDoor() public static void DoorUse(Door door, BaseEntity.RPCMessage rpc, bool open) { BaseLock baseLock = door.GetSlot(BaseEntity.Slot.Lock) as BaseLock; if (baseLock != null) { bool TryCloseOpen = open ? !baseLock.OnTryToOpen(rpc.player) : !baseLock.OnTryToClose(rpc.player); if (TryCloseOpen) { return; } } DoorUseEvent due = new DoorUseEvent(new Entity(door), Server.GetPlayer(rpc.player), open); OnDoorUse.OnNext(due); door.SetFlag(BaseEntity.Flags.Open, due.Open); door.Invoke("UpdateLayer", 0f); door.SendNetworkUpdate(BasePlayer.NetworkQueue.Update); if (due.DenyReason != "") { rpc.player.SendConsoleCommand("chat.add", 0, String.Format("{0}: {1}", Server.server_message_name.ColorText("fa5"), due.DenyReason)); } }
// Door.RPC_CloseDoor()/RPC_OpenDoor() public static void On_DoorUse(Door door, BaseEntity.RPCMessage rpc, bool open) { if ((open && door.IsOpen()) || (!open && !door.IsOpen())) { return; } DoorUseEvent due = new DoorUseEvent(new Entity(door), Server.GetPlayer(rpc.player), open); OnNext("On_DoorUse", due); if (!due.Allow) { if (due.DenyReason != "") { rpc.player.SendConsoleCommand("chat.add", 0, String.Format("{0}: {1}", Server.server_message_name.ColorText("fa5"), due.DenyReason)); } return; } bool doaction = true; BaseLock baseLock = door.GetSlot(BaseEntity.Slot.Lock) as BaseLock; if (!due.IgnoreLock && baseLock != null) { doaction = open ? baseLock.OnTryToOpen(rpc.player) : baseLock.OnTryToClose(rpc.player); if (doaction && open && (baseLock.IsLocked() && Time.realtimeSinceStartup - (float)door.GetFieldValue("decayResetTimeLast") > 60)) { Decay.RadialDecayTouch(door.transform.position, 40, 270532608); door.SetFieldValue("decayResetTimeLast", Time.realtimeSinceStartup); } } if (doaction) { door.SetFlag(BaseEntity.Flags.Open, open); door.SendNetworkUpdateImmediate(false); door.CallMethod("UpdateDoorAnimationParameters", false); } }
private void RPC_CloseDoor(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) && !slot.OnTryToClose(rpc.player)) { return; } this.SetFlag(BaseEntity.Flags.Open, false, false, true); this.SendNetworkUpdateImmediate(false); if (this.isSecurityDoor && Object.op_Inequality((Object)this.NavMeshLink, (Object)null)) { this.SetNavMeshLinkEnabled(false); } Interface.CallHook("OnDoorClosed", (object)this, (object)rpc.player); }
private void RPC_CloseDoor(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 && !slot.OnTryToClose(rpc.player)) { return; } base.SetFlag(BaseEntity.Flags.Open, false, false, true); base.SendNetworkUpdateImmediate(false); if (this.isSecurityDoor && this.NavMeshLink != null) { this.SetNavMeshLinkEnabled(false); } Interface.CallHook("OnDoorClosed", this, rpc.player); }