Exemplo n.º 1
0
 public bool CanIUseIt(MyDataBroadcaster broadcaster, long localPlayerId)
 {
     if (broadcaster.Parent is IMyComponentOwner <MyIDModule> )
     {
         MyIDModule broadcasterId;
         if ((broadcaster.Parent as IMyComponentOwner <MyIDModule>).GetComponent(out broadcasterId))
         {
             MyRelationsBetweenPlayerAndBlock relation = broadcasterId.GetUserRelationToOwner(localPlayerId);
             if (relation == MyRelationsBetweenPlayerAndBlock.Enemies || relation == MyRelationsBetweenPlayerAndBlock.Neutral || broadcasterId.Owner == 0)
             {
                 return(false);
             }
         }
     }
     if (broadcaster.Parent is MyCharacter)
     {
         var relation = (broadcaster.Parent as MyCharacter).GetRelationTo(localPlayerId);
         if (relation == MyRelationsBetweenPlayerAndBlock.Enemies || relation == MyRelationsBetweenPlayerAndBlock.Neutral)
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 2
0
 public bool CanBeUsedByPlayer(long playerId) =>
 MyDataBroadcaster.CanBeUsedByPlayer(playerId, base.Entity);
Exemplo n.º 3
0
 public bool CanIUseIt(MyDataBroadcaster broadcaster, long localPlayerId)
 {
     if (broadcaster.Parent is IMyComponentOwner<MyIDModule>)
     {
         MyIDModule broadcasterId;
         if ((broadcaster.Parent as IMyComponentOwner<MyIDModule>).GetComponent(out broadcasterId))
         {
             MyRelationsBetweenPlayerAndBlock relation = broadcasterId.GetUserRelationToOwner(localPlayerId);
             if (relation == MyRelationsBetweenPlayerAndBlock.Enemies || relation == MyRelationsBetweenPlayerAndBlock.Neutral || broadcasterId.Owner == 0)
                 return false;
         }
     }
     if (broadcaster.Parent is MyCharacter)
     {
         var relation = (broadcaster.Parent as MyCharacter).GetRelationTo(localPlayerId);
         if (relation == MyRelationsBetweenPlayerAndBlock.Enemies || relation == MyRelationsBetweenPlayerAndBlock.Neutral)
             return false;
     }
     return true;
 }