private void OpenRequest(bool open, long identityId) { AdminSettingsEnum enum2; MyPlayer playerFromCharacter; MyRelationsBetweenPlayerAndBlock userRelationToOwner = base.GetUserRelationToOwner(identityId); MyIdentity identity = MySession.Static.Players.TryGetIdentity(identityId); if ((identity == null) || (identity.Character == null)) { playerFromCharacter = null; } else { playerFromCharacter = MyPlayer.GetPlayerFromCharacter(identity.Character); } MyPlayer player = playerFromCharacter; bool flag = false; if (((player != null) && !userRelationToOwner.IsFriendly()) && MySession.Static.RemoteAdminSettings.TryGetValue(player.Client.SteamUserId, out enum2)) { flag = enum2.HasFlag(AdminSettingsEnum.UseTerminals); } if (userRelationToOwner.IsFriendly() | flag) { this.Open = open; } }
static void UseSuccessCallback(MySyncControllableEntity sync, ref UseObject_UseMsg msg, MyNetworkClient sender) { MyEntity controlledEntity; if (MyEntities.TryGetEntityById <MyEntity>(msg.UsedByEntityId, out controlledEntity)) { var controllableEntity = controlledEntity as IMyControllableEntity; Debug.Assert(controllableEntity != null, "Controllable entity needs to get control from another controllable entity"); if (controllableEntity != null) { MyRelationsBetweenPlayerAndBlock relation = MyRelationsBetweenPlayerAndBlock.NoOwnership; var cubeBlock = sync.Entity as MyCubeBlock; if (cubeBlock != null && controllableEntity.ControllerInfo.Controller != null) { relation = cubeBlock.GetUserRelationToOwner(controllableEntity.ControllerInfo.Controller.Player.Identity.IdentityId); } if (relation.IsFriendly()) { sync.RaiseUseSuccess(msg.UseAction, controllableEntity); } else { sync.RaiseUseFailure(msg.UseAction, msg.UseResult, controllableEntity); } } } }
public virtual bool HasPlayerAccess(long playerId) { if (!MyFakes.SHOW_FACTIONS_GUI) { return(true); } MyRelationsBetweenPlayerAndBlock relation = GetUserRelationToOwner(playerId); bool accessAllowed = relation.IsFriendly(); return(accessAllowed); }
static void ChangeDoorRequest(ref ChangeDoorMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); if (entity is MyAdvancedDoor) { 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); } } }