Exemple #1
0
        bool MinePlacementRequest(IArea currentArea, Player player, int mineID, ref float xPos, ref float yPos, out string resultMessage)
        {
            if (currentArea.AreaType != AreaTypes.System && currentArea.AreaType != AreaTypes.Planet)
            {
                resultMessage = "Not in area where mines can be placed.";//Client shouldn't ever see this...
                return(false);
            }


            if (!currentArea.CanAddStructure(player, StructureTypes.Mine, xPos, yPos, out resultMessage))
            {
                return(false);
            }
            else if (player.GetActiveShip().Cargo.IsCargoInHolds(mineID) != StatefulCargoTypes.DefensiveMine)
            {
                resultMessage = "Mine not found in ship cargo.";
                return(false);
            }
            else if (!currentArea.GetValidStructurePosition(StructureStatManager.GetStats(StructureTypes.Mine), ref xPos, ref yPos))
            {
                resultMessage = "Invalid structure position.";
                return(false);
            }


            resultMessage = "Success";
            return(true);
        }