public void SendChangeDoorRequest(bool open, long identityId) { var msg = new ChangeDoorMsg(); msg.EntityId = m_block.EntityId; msg.PlayerId = identityId; msg.Open = open; Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }
static void ChangeDoorSuccess(ref ChangeDoorMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); MyDoor block = entity as MyDoor; if (block != null) { block.Open = msg.Open; } }
static void ChangeDoorSuccess(ref ChangeDoorMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); MyAdvancedDoor block = entity as MyAdvancedDoor; if (block != null) { block.Open = msg.Open; } }
static void ChangeDoorRequest(ref ChangeDoorMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); if (entity is MyDoor) { MyRelationsBetweenPlayerAndBlock relation = MyRelationsBetweenPlayerAndBlock.NoOwnership; var cubeBlock = entity as MyCubeBlock; if (cubeBlock != null) { relation = cubeBlock.GetUserRelationToOwner(msg.PlayerId); } if (relation.IsFriendly()) { Sync.Layer.SendMessageToAllAndSelf(ref msg, MyTransportMessageEnum.Success); } } }
static void ChangeDoorRequest(ref ChangeDoorMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); if (entity is MyAdvancedDoor) { MyRelationsBetweenPlayerAndBlock relation = MyRelationsBetweenPlayerAndBlock.FactionShare; var cubeBlock = entity as MyCubeBlock; if (cubeBlock != null) { relation = cubeBlock.GetUserRelationToOwner(msg.PlayerId); } if (relation == MyRelationsBetweenPlayerAndBlock.FactionShare || relation == MyRelationsBetweenPlayerAndBlock.Owner) { Sync.Layer.SendMessageToAllAndSelf(ref msg, MyTransportMessageEnum.Success); } } }
static void ChangeDoorFailure(ref ChangeDoorMsg msg, MyNetworkClient sender) { }