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); }
public bool CanBeUsedByPlayer(long playerId) => MyDataBroadcaster.CanBeUsedByPlayer(playerId, base.Entity);
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; }